Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
55dab8a
Update all the tests
pamelafox Nov 14, 2025
9bcd682
Sharepoint results and some TODOs
pamelafox Nov 15, 2025
b4165f1
update package version
mattgotteiner Nov 16, 2025
3e859d4
hide retireval count on agentic
mattgotteiner Nov 16, 2025
e0020ea
new ux
mattgotteiner Nov 16, 2025
1623a78
disable minimal on web
mattgotteiner Nov 16, 2025
ae103fb
refactor query rewriting
mattgotteiner Nov 16, 2025
a9711bb
disable streaming on frontend if retrieval reasoning toggled
mattgotteiner Nov 16, 2025
760721b
minimal supports answerings
mattgotteiner Nov 16, 2025
9037578
default retrieval effort
mattgotteiner Nov 16, 2025
8e54d8b
default retrieval effort
mattgotteiner Nov 16, 2025
1323de8
black + ruff
mattgotteiner Nov 16, 2025
caf5158
working on ux
mattgotteiner Nov 16, 2025
37ea146
more ux
mattgotteiner Nov 16, 2025
2189614
ux
mattgotteiner Nov 16, 2025
eb4f89b
more ux updates
mattgotteiner Nov 16, 2025
121d804
more ux updates
mattgotteiner Nov 16, 2025
34bfb63
more ux work
mattgotteiner Nov 16, 2025
d504559
more ux work
mattgotteiner Nov 17, 2025
34b067e
more ux work
mattgotteiner Nov 17, 2025
ba6990c
model cleaning up after itself
mattgotteiner Nov 17, 2025
8f1faa4
simplify
mattgotteiner Nov 17, 2025
b716b31
remove old properties
mattgotteiner Nov 17, 2025
dd84cdf
WIP select web search
mattgotteiner Nov 17, 2025
180dabf
updating ux
mattgotteiner Nov 17, 2025
1463aec
updating ux
mattgotteiner Nov 17, 2025
b455dbf
allow streaming even though web is allowed
mattgotteiner Nov 17, 2025
ebcc888
test fixes
mattgotteiner Nov 17, 2025
c9b1abb
more tests
mattgotteiner Nov 17, 2025
5958be9
Refinements
pamelafox Nov 17, 2025
81ef750
UI improvements
pamelafox Nov 17, 2025
e74c118
Update tests
pamelafox Nov 17, 2025
581d83e
Update translations
pamelafox Nov 17, 2025
f4bc020
Minimal fixes
pamelafox Nov 18, 2025
cb9b535
Fix sharepoint citations
pamelafox Nov 18, 2025
2138e4e
Sharepoint citations
pamelafox Nov 18, 2025
bae199a
Fix some sharept stuff
pamelafox Nov 18, 2025
32f8bdc
Latest fix
pamelafox Nov 18, 2025
e216a01
mypy, black, ruff
mattgotteiner Nov 18, 2025
0046ff5
snapshot update
mattgotteiner Nov 18, 2025
ece1489
Update tests
pamelafox Nov 18, 2025
7b16154
Fixed mypy issues and added missing CI var
pamelafox Nov 18, 2025
9a6a262
Fix black formatting
pamelafox Nov 18, 2025
9e91d29
Make some fixes
pamelafox Nov 18, 2025
29e4e1c
Ruff format
pamelafox Nov 18, 2025
dece150
Revert requirements.txt unneeded changes to bare minimum
pamelafox Nov 18, 2025
dc52d17
Revert document-intelligence change
pamelafox Nov 18, 2025
42df412
Address Copilot feedback
pamelafox Nov 18, 2025
b9842dc
Remove old test snapshots, add e2e tests
pamelafox Nov 18, 2025
043a192
Pin i18n-check to a version that works
pamelafox Nov 18, 2025
3f3f409
Renaming files
pamelafox Nov 18, 2025
6e2111a
Complete Contoso to Zava change
pamelafox Nov 18, 2025
0b18e4c
Fix the Zava domain to example.org since Zava.com does not exist
pamelafox Nov 18, 2025
279c5c5
Revert unneeded changes to AGENTS and evals, and fix weird azd env va…
pamelafox Nov 18, 2025
92647b4
Revert unneeded changes to AGENTS and evals, and fix weird azd env va…
pamelafox Nov 18, 2025
2aa1590
Merge branch 'main' into ignite2025
mattgotteiner Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .azdo/pipelines/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ steps:
AZURE_OPENAI_CHATGPT_DEPLOYMENT_VERSION: $(AZURE_OPENAI_CHATGPT_DEPLOYMENT_VERSION)
AZURE_OPENAI_CHATGPT_DEPLOYMENT_SKU: $(AZURE_OPENAI_CHATGPT_DEPLOYMENT_SKU)
AZURE_OPENAI_REASONING_EFFORT: $(AZURE_OPENAI_REASONING_EFFORT)
AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT: $(AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT)
AZURE_OPENAI_EMB_MODEL_NAME: $(AZURE_OPENAI_EMB_MODEL_NAME)
AZURE_OPENAI_EMB_DEPLOYMENT: $(AZURE_OPENAI_EMB_DEPLOYMENT)
AZURE_OPENAI_EMB_DEPLOYMENT_CAPACITY: $(AZURE_OPENAI_EMB_DEPLOYMENT_CAPACITY)
Expand Down Expand Up @@ -124,6 +125,9 @@ steps:
RAG_SEARCH_IMAGE_EMBEDDINGS: $(RAG_SEARCH_IMAGE_EMBEDDINGS)
RAG_SEND_TEXT_SOURCES: $(RAG_SEND_TEXT_SOURCES)
RAG_SEND_IMAGE_SOURCES: $(RAG_SEND_IMAGE_SOURCES)
USE_AGENTIC_KNOWLEDGEBASE: $(USE_AGENTIC_KNOWLEDGEBASE)
USE_WEB_SOURCE: $(USE_WEB_SOURCE)
USE_SHAREPOINT_SOURCE: $(USE_SHAREPOINT_SOURCE)
- task: AzureCLI@2
displayName: Deploy Application
inputs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY: ${{ vars.AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY }}
AZURE_OPENAI_CHATGPT_DEPLOYMENT_VERSION: ${{ vars.AZURE_OPENAI_CHATGPT_DEPLOYMENT_VERSION }}
AZURE_OPENAI_REASONING_EFFORT: ${{ vars.AZURE_OPENAI_REASONING_EFFORT }}
AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT: ${{ vars.AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT }}
AZURE_OPENAI_EMB_MODEL_NAME: ${{ vars.AZURE_OPENAI_EMB_MODEL_NAME }}
AZURE_OPENAI_EMB_DEPLOYMENT: ${{ vars.AZURE_OPENAI_EMB_DEPLOYMENT }}
AZURE_OPENAI_EMB_DEPLOYMENT_CAPACITY: ${{ vars.AZURE_OPENAI_EMB_DEPLOYMENT_CAPACITY }}
Expand Down Expand Up @@ -114,6 +115,9 @@ jobs:
RAG_SEARCH_IMAGE_EMBEDDINGS: ${{ vars.RAG_SEARCH_IMAGE_EMBEDDINGS }}
RAG_SEND_TEXT_SOURCES: ${{ vars.RAG_SEND_TEXT_SOURCES }}
RAG_SEND_IMAGE_SOURCES: ${{ vars.RAG_SEND_IMAGE_SOURCES }}
USE_AGENTIC_KNOWLEDGEBASE: ${{ vars.USE_AGENTIC_KNOWLEDGEBASE }}
USE_WEB_SOURCE: ${{ vars.USE_WEB_SOURCE }}
USE_SHAREPOINT_SOURCE: ${{ vars.USE_SHAREPOINT_SOURCE }}
steps:
- name: Checkout
uses: actions/checkout@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
npm install
npm run build
- name: Check i18n translations
run: npx -y @lingual/i18n-check --locales app/frontend/src/locales -s en -f i18next -r summary
run: npx -y @lingual/i18n-check@0.8.12 --locales app/frontend/src/locales -s en -f i18next -r summary
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
Expand Down
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ When adding new azd environment variables, update:
1. .azdo/pipelines/azure-dev.yml: Add the new environment variable under `env` section
1. .github/workflows/azure-dev.yml: Add the new environment variable under `env` section

You may also need to update:

1. app/backend/prepdocs.py: If the variable is used in the ingestion script, retrieve it from environment variables here. Not always needed.
1. app/backend/app.py: If the variable is used in the backend application, retrieve it from environment variables in setup_clients() function. Not always needed.

## Adding a new setting to "Developer Settings" in RAG app

When adding a new developer setting, update:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This template, the application code and configuration it contains, has been buil

This sample demonstrates a few approaches for creating ChatGPT-like experiences over your own data using the Retrieval Augmented Generation pattern. It uses Azure OpenAI Service to access a GPT model (gpt-4.1-mini), and Azure AI Search for data indexing and retrieval.

The repo includes sample data so it's ready to try end to end. In this sample application we use a fictitious company called Contoso Electronics, and the experience allows its employees to ask questions about the benefits, internal policies, as well as job descriptions and roles.
The repo includes sample data so it's ready to try end to end. In this sample application we use a fictitious company called Zava, and the experience allows its employees to ask questions about the benefits, internal policies, as well as job descriptions and roles.

## Features

Expand Down
114 changes: 93 additions & 21 deletions app/backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
get_bearer_token_provider,
)
from azure.monitor.opentelemetry import configure_azure_monitor
from azure.search.documents.agent.aio import KnowledgeAgentRetrievalClient
from azure.search.documents.aio import SearchClient
from azure.search.documents.indexes.aio import SearchIndexClient
from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient
from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor
from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware
from opentelemetry.instrumentation.httpx import (
Expand All @@ -44,23 +44,27 @@
)
from quart_cors import cors

from approaches.approach import Approach
from approaches.approach import Approach, DataPoints
from approaches.chatreadretrieveread import ChatReadRetrieveReadApproach
from approaches.promptmanager import PromptyManager
from approaches.retrievethenread import RetrieveThenReadApproach
from chat_history.cosmosdb import chat_history_cosmosdb_bp
from config import (
CONFIG_AGENT_CLIENT,
CONFIG_AGENTIC_RETRIEVAL_ENABLED,
CONFIG_AGENTIC_KNOWLEDGEBASE_ENABLED,
CONFIG_ASK_APPROACH,
CONFIG_AUTH_CLIENT,
CONFIG_CHAT_APPROACH,
CONFIG_CHAT_HISTORY_BROWSER_ENABLED,
CONFIG_CHAT_HISTORY_COSMOS_ENABLED,
CONFIG_CREDENTIAL,
CONFIG_DEFAULT_REASONING_EFFORT,
CONFIG_DEFAULT_RETRIEVAL_REASONING_EFFORT,
CONFIG_GLOBAL_BLOB_MANAGER,
CONFIG_INGESTER,
CONFIG_KNOWLEDGEBASE_CLIENT,
CONFIG_KNOWLEDGEBASE_CLIENT_WITH_SHAREPOINT,
CONFIG_KNOWLEDGEBASE_CLIENT_WITH_WEB,
CONFIG_KNOWLEDGEBASE_CLIENT_WITH_WEB_AND_SHAREPOINT,
CONFIG_LANGUAGE_PICKER_ENABLED,
CONFIG_MULTIMODAL_ENABLED,
CONFIG_OPENAI_CLIENT,
Expand All @@ -72,6 +76,7 @@
CONFIG_REASONING_EFFORT_ENABLED,
CONFIG_SEARCH_CLIENT,
CONFIG_SEMANTIC_RANKER_DEPLOYED,
CONFIG_SHAREPOINT_SOURCE_ENABLED,
CONFIG_SPEECH_INPUT_ENABLED,
CONFIG_SPEECH_OUTPUT_AZURE_ENABLED,
CONFIG_SPEECH_OUTPUT_BROWSER_ENABLED,
Expand All @@ -83,6 +88,7 @@
CONFIG_USER_BLOB_MANAGER,
CONFIG_USER_UPLOAD_ENABLED,
CONFIG_VECTOR_SEARCH_ENABLED,
CONFIG_WEB_SOURCE_ENABLED,
)
from core.authentication import AuthenticationHelper
from core.sessionhelper import create_session_id
Expand Down Expand Up @@ -197,7 +203,14 @@ async def ask(auth_claims: dict[str, Any]):
class JSONEncoder(json.JSONEncoder):
def default(self, o):
if dataclasses.is_dataclass(o) and not isinstance(o, type):
return dataclasses.asdict(o)
as_dict = dataclasses.asdict(o)
if isinstance(o, DataPoints):
# Drop optional data point collections that are not populated to keep API surface stable
return {k: v for k, v in as_dict.items() if v is not None}
data_points_payload = as_dict.get("data_points") if isinstance(as_dict, dict) else None
if isinstance(data_points_payload, dict) and data_points_payload.get("citation_activity_details") is None:
data_points_payload.pop("citation_activity_details")
return as_dict
return super().default(o)


Expand Down Expand Up @@ -288,6 +301,7 @@ def config():
"showReasoningEffortOption": current_app.config[CONFIG_REASONING_EFFORT_ENABLED],
"streamingEnabled": current_app.config[CONFIG_STREAMING_ENABLED],
"defaultReasoningEffort": current_app.config[CONFIG_DEFAULT_REASONING_EFFORT],
"defaultRetrievalReasoningEffort": current_app.config[CONFIG_DEFAULT_RETRIEVAL_REASONING_EFFORT],
"showVectorOption": current_app.config[CONFIG_VECTOR_SEARCH_ENABLED],
"showUserUpload": current_app.config[CONFIG_USER_UPLOAD_ENABLED],
"showLanguagePicker": current_app.config[CONFIG_LANGUAGE_PICKER_ENABLED],
Expand All @@ -296,11 +310,13 @@ def config():
"showSpeechOutputAzure": current_app.config[CONFIG_SPEECH_OUTPUT_AZURE_ENABLED],
"showChatHistoryBrowser": current_app.config[CONFIG_CHAT_HISTORY_BROWSER_ENABLED],
"showChatHistoryCosmos": current_app.config[CONFIG_CHAT_HISTORY_COSMOS_ENABLED],
"showAgenticRetrievalOption": current_app.config[CONFIG_AGENTIC_RETRIEVAL_ENABLED],
"showAgenticRetrievalOption": current_app.config[CONFIG_AGENTIC_KNOWLEDGEBASE_ENABLED],
"ragSearchTextEmbeddings": current_app.config[CONFIG_RAG_SEARCH_TEXT_EMBEDDINGS],
"ragSearchImageEmbeddings": current_app.config[CONFIG_RAG_SEARCH_IMAGE_EMBEDDINGS],
"ragSendTextSources": current_app.config[CONFIG_RAG_SEND_TEXT_SOURCES],
"ragSendImageSources": current_app.config[CONFIG_RAG_SEND_IMAGE_SOURCES],
"webSourceEnabled": current_app.config[CONFIG_WEB_SOURCE_ENABLED],
"sharepointSourceEnabled": current_app.config[CONFIG_SHAREPOINT_SOURCE_ENABLED],
}
)

Expand Down Expand Up @@ -405,12 +421,12 @@ async def setup_clients():
AZURE_SEARCH_SERVICE = os.environ["AZURE_SEARCH_SERVICE"]
AZURE_SEARCH_ENDPOINT = f"https://{AZURE_SEARCH_SERVICE}.search.windows.net"
AZURE_SEARCH_INDEX = os.environ["AZURE_SEARCH_INDEX"]
AZURE_SEARCH_AGENT = os.getenv("AZURE_SEARCH_AGENT", "")
AZURE_SEARCH_KNOWLEDGEBASE_NAME = os.getenv("AZURE_SEARCH_KNOWLEDGEBASE_NAME", "")
# Shared by all OpenAI deployments
OPENAI_HOST = OpenAIHost(os.getenv("OPENAI_HOST", "azure"))
OPENAI_CHATGPT_MODEL = os.environ["AZURE_OPENAI_CHATGPT_MODEL"]
AZURE_OPENAI_SEARCHAGENT_MODEL = os.getenv("AZURE_OPENAI_SEARCHAGENT_MODEL")
AZURE_OPENAI_SEARCHAGENT_DEPLOYMENT = os.getenv("AZURE_OPENAI_SEARCHAGENT_DEPLOYMENT")
AZURE_OPENAI_KNOWLEDGEBASE_MODEL = os.getenv("AZURE_OPENAI_KNOWLEDGEBASE_MODEL")
AZURE_OPENAI_KNOWLEDGEBASE_DEPLOYMENT = os.getenv("AZURE_OPENAI_KNOWLEDGEBASE_DEPLOYMENT")
OPENAI_EMB_MODEL = os.getenv("AZURE_OPENAI_EMB_MODEL_NAME", "text-embedding-ada-002")
OPENAI_EMB_DIMENSIONS = int(os.getenv("AZURE_OPENAI_EMB_DIMENSIONS") or 1536)
OPENAI_REASONING_EFFORT = os.getenv("AZURE_OPENAI_REASONING_EFFORT")
Expand Down Expand Up @@ -466,7 +482,10 @@ async def setup_clients():
USE_SPEECH_OUTPUT_AZURE = os.getenv("USE_SPEECH_OUTPUT_AZURE", "").lower() == "true"
USE_CHAT_HISTORY_BROWSER = os.getenv("USE_CHAT_HISTORY_BROWSER", "").lower() == "true"
USE_CHAT_HISTORY_COSMOS = os.getenv("USE_CHAT_HISTORY_COSMOS", "").lower() == "true"
USE_AGENTIC_RETRIEVAL = os.getenv("USE_AGENTIC_RETRIEVAL", "").lower() == "true"
USE_AGENTIC_KNOWLEDGEBASE = os.getenv("USE_AGENTIC_KNOWLEDGEBASE", "").lower() == "true"
USE_WEB_SOURCE = os.getenv("USE_WEB_SOURCE", "").lower() == "true"
USE_SHAREPOINT_SOURCE = os.getenv("USE_SHAREPOINT_SOURCE", "").lower() == "true"
AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT = os.getenv("AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT", "low")
USE_VECTORS = os.getenv("USE_VECTORS", "").lower() != "false"

# WEBSITE_HOSTNAME is always set by App Service, RUNNING_IN_PRODUCTION is set in main.bicep
Expand Down Expand Up @@ -510,9 +529,33 @@ async def setup_clients():
index_name=AZURE_SEARCH_INDEX,
credential=azure_credential,
)
agent_client = KnowledgeAgentRetrievalClient(
endpoint=AZURE_SEARCH_ENDPOINT, agent_name=AZURE_SEARCH_AGENT, credential=azure_credential

knowledgebase_client = KnowledgeBaseRetrievalClient(
endpoint=AZURE_SEARCH_ENDPOINT, knowledge_base_name=AZURE_SEARCH_KNOWLEDGEBASE_NAME, credential=azure_credential
)
knowledgebase_client_with_web = None
knowledgebase_client_with_sharepoint = None
knowledgebase_client_with_web_and_sharepoint = None

if AZURE_SEARCH_KNOWLEDGEBASE_NAME:
if USE_WEB_SOURCE:
knowledgebase_client_with_web = KnowledgeBaseRetrievalClient(
endpoint=AZURE_SEARCH_ENDPOINT,
knowledge_base_name=f"{AZURE_SEARCH_KNOWLEDGEBASE_NAME}-with-web",
credential=azure_credential,
)
if USE_SHAREPOINT_SOURCE:
knowledgebase_client_with_sharepoint = KnowledgeBaseRetrievalClient(
endpoint=AZURE_SEARCH_ENDPOINT,
knowledge_base_name=f"{AZURE_SEARCH_KNOWLEDGEBASE_NAME}-with-sp",
credential=azure_credential,
)
if USE_WEB_SOURCE and USE_SHAREPOINT_SOURCE:
knowledgebase_client_with_web_and_sharepoint = KnowledgeBaseRetrievalClient(
endpoint=AZURE_SEARCH_ENDPOINT,
knowledge_base_name=f"{AZURE_SEARCH_KNOWLEDGEBASE_NAME}-with-web-and-sp",
credential=azure_credential,
)

# Set up the global blob storage manager (used for global content/images, but not user uploads)
global_blob_manager = BlobManager(
Expand Down Expand Up @@ -596,7 +639,14 @@ async def setup_clients():
openai_deployment=AZURE_OPENAI_CHATGPT_DEPLOYMENT if OPENAI_HOST == OpenAIHost.AZURE else None,
)
search_info = setup_search_info(
search_service=AZURE_SEARCH_SERVICE, index_name=AZURE_SEARCH_INDEX, azure_credential=azure_credential
search_service=AZURE_SEARCH_SERVICE,
index_name=AZURE_SEARCH_INDEX,
azure_credential=azure_credential,
use_agentic_knowledgebase=USE_AGENTIC_KNOWLEDGEBASE,
azure_openai_endpoint=azure_openai_endpoint,
knowledgebase_name=AZURE_SEARCH_KNOWLEDGEBASE_NAME,
azure_openai_knowledgebase_deployment=AZURE_OPENAI_KNOWLEDGEBASE_DEPLOYMENT,
azure_openai_knowledgebase_model=AZURE_OPENAI_KNOWLEDGEBASE_MODEL,
)

text_embeddings_service = None
Expand Down Expand Up @@ -632,14 +682,20 @@ async def setup_clients():

current_app.config[CONFIG_OPENAI_CLIENT] = openai_client
current_app.config[CONFIG_SEARCH_CLIENT] = search_client
current_app.config[CONFIG_AGENT_CLIENT] = agent_client
current_app.config[CONFIG_KNOWLEDGEBASE_CLIENT] = knowledgebase_client
current_app.config[CONFIG_KNOWLEDGEBASE_CLIENT_WITH_WEB] = knowledgebase_client_with_web
current_app.config[CONFIG_KNOWLEDGEBASE_CLIENT_WITH_SHAREPOINT] = knowledgebase_client_with_sharepoint
current_app.config[CONFIG_KNOWLEDGEBASE_CLIENT_WITH_WEB_AND_SHAREPOINT] = (
knowledgebase_client_with_web_and_sharepoint
)
current_app.config[CONFIG_AUTH_CLIENT] = auth_helper

current_app.config[CONFIG_SEMANTIC_RANKER_DEPLOYED] = AZURE_SEARCH_SEMANTIC_RANKER != "disabled"
current_app.config[CONFIG_QUERY_REWRITING_ENABLED] = (
AZURE_SEARCH_QUERY_REWRITING == "true" and AZURE_SEARCH_SEMANTIC_RANKER != "disabled"
)
current_app.config[CONFIG_DEFAULT_REASONING_EFFORT] = OPENAI_REASONING_EFFORT
current_app.config[CONFIG_DEFAULT_RETRIEVAL_REASONING_EFFORT] = AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT
current_app.config[CONFIG_REASONING_EFFORT_ENABLED] = OPENAI_CHATGPT_MODEL in Approach.GPT_REASONING_MODELS
current_app.config[CONFIG_STREAMING_ENABLED] = (
OPENAI_CHATGPT_MODEL not in Approach.GPT_REASONING_MODELS
Expand All @@ -653,12 +709,16 @@ async def setup_clients():
current_app.config[CONFIG_SPEECH_OUTPUT_AZURE_ENABLED] = USE_SPEECH_OUTPUT_AZURE
current_app.config[CONFIG_CHAT_HISTORY_BROWSER_ENABLED] = USE_CHAT_HISTORY_BROWSER
current_app.config[CONFIG_CHAT_HISTORY_COSMOS_ENABLED] = USE_CHAT_HISTORY_COSMOS
current_app.config[CONFIG_AGENTIC_RETRIEVAL_ENABLED] = USE_AGENTIC_RETRIEVAL
current_app.config[CONFIG_AGENTIC_KNOWLEDGEBASE_ENABLED] = USE_AGENTIC_KNOWLEDGEBASE
current_app.config[CONFIG_MULTIMODAL_ENABLED] = USE_MULTIMODAL
current_app.config[CONFIG_RAG_SEARCH_TEXT_EMBEDDINGS] = RAG_SEARCH_TEXT_EMBEDDINGS
current_app.config[CONFIG_RAG_SEARCH_IMAGE_EMBEDDINGS] = RAG_SEARCH_IMAGE_EMBEDDINGS
current_app.config[CONFIG_RAG_SEND_TEXT_SOURCES] = RAG_SEND_TEXT_SOURCES
current_app.config[CONFIG_RAG_SEND_IMAGE_SOURCES] = RAG_SEND_IMAGE_SOURCES
current_app.config[CONFIG_WEB_SOURCE_ENABLED] = USE_WEB_SOURCE
if AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT == "minimal" and current_app.config[CONFIG_WEB_SOURCE_ENABLED]:
raise ValueError("Web source cannot be used with minimal retrieval reasoning effort")
current_app.config[CONFIG_SHAREPOINT_SOURCE_ENABLED] = USE_SHAREPOINT_SOURCE

prompt_manager = PromptyManager()

Expand All @@ -668,9 +728,12 @@ async def setup_clients():
current_app.config[CONFIG_ASK_APPROACH] = RetrieveThenReadApproach(
search_client=search_client,
search_index_name=AZURE_SEARCH_INDEX,
agent_model=AZURE_OPENAI_SEARCHAGENT_MODEL,
agent_deployment=AZURE_OPENAI_SEARCHAGENT_DEPLOYMENT,
agent_client=agent_client,
knowledgebase_model=AZURE_OPENAI_KNOWLEDGEBASE_MODEL,
knowledgebase_deployment=AZURE_OPENAI_KNOWLEDGEBASE_DEPLOYMENT,
knowledgebase_client=knowledgebase_client,
knowledgebase_client_with_web=knowledgebase_client_with_web,
knowledgebase_client_with_sharepoint=knowledgebase_client_with_sharepoint,
knowledgebase_client_with_web_and_sharepoint=knowledgebase_client_with_web_and_sharepoint,
openai_client=openai_client,
chatgpt_model=OPENAI_CHATGPT_MODEL,
chatgpt_deployment=AZURE_OPENAI_CHATGPT_DEPLOYMENT,
Expand All @@ -688,15 +751,21 @@ async def setup_clients():
image_embeddings_client=image_embeddings_client,
global_blob_manager=global_blob_manager,
user_blob_manager=user_blob_manager,
use_web_source=current_app.config[CONFIG_WEB_SOURCE_ENABLED],
use_sharepoint_source=current_app.config[CONFIG_SHAREPOINT_SOURCE_ENABLED],
retrieval_reasoning_effort=AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT,
)

# ChatReadRetrieveReadApproach is used by /chat for multi-turn conversation
current_app.config[CONFIG_CHAT_APPROACH] = ChatReadRetrieveReadApproach(
search_client=search_client,
search_index_name=AZURE_SEARCH_INDEX,
agent_model=AZURE_OPENAI_SEARCHAGENT_MODEL,
agent_deployment=AZURE_OPENAI_SEARCHAGENT_DEPLOYMENT,
agent_client=agent_client,
knowledgebase_model=AZURE_OPENAI_KNOWLEDGEBASE_MODEL,
knowledgebase_deployment=AZURE_OPENAI_KNOWLEDGEBASE_DEPLOYMENT,
knowledgebase_client=knowledgebase_client,
knowledgebase_client_with_web=knowledgebase_client_with_web,
knowledgebase_client_with_sharepoint=knowledgebase_client_with_sharepoint,
knowledgebase_client_with_web_and_sharepoint=knowledgebase_client_with_web_and_sharepoint,
openai_client=openai_client,
chatgpt_model=OPENAI_CHATGPT_MODEL,
chatgpt_deployment=AZURE_OPENAI_CHATGPT_DEPLOYMENT,
Expand All @@ -714,6 +783,9 @@ async def setup_clients():
image_embeddings_client=image_embeddings_client,
global_blob_manager=global_blob_manager,
user_blob_manager=user_blob_manager,
use_web_source=current_app.config[CONFIG_WEB_SOURCE_ENABLED],
use_sharepoint_source=current_app.config[CONFIG_SHAREPOINT_SOURCE_ENABLED],
retrieval_reasoning_effort=AGENTIC_KNOWLEDGEBASE_REASONING_EFFORT,
)


Expand Down
Loading
Loading