diff --git a/code/backend/batch/utilities/search/AzureSearchHandler.py b/code/backend/batch/utilities/search/AzureSearchHandler.py index 6b72544b9..33052ebb8 100644 --- a/code/backend/batch/utilities/search/AzureSearchHandler.py +++ b/code/backend/batch/utilities/search/AzureSearchHandler.py @@ -101,6 +101,7 @@ def _hybrid_search(self, question: str, tokenised_question: list[int]): fields=self._VECTOR_FIELD, ) ], + query_type="simple", # this is the default value filter=self.env_helper.AZURE_SEARCH_FILTER, top=self.env_helper.AZURE_SEARCH_TOP_K, ) diff --git a/code/create_app.py b/code/create_app.py index 3cad8396d..ed593ffc2 100644 --- a/code/create_app.py +++ b/code/create_app.py @@ -130,10 +130,14 @@ def conversation_with_data(request: Request, env_helper: EnvHelper): "filter": env_helper.AZURE_SEARCH_FILTER, "in_scope": env_helper.AZURE_SEARCH_ENABLE_IN_DOMAIN, "top_n_documents": env_helper.AZURE_SEARCH_TOP_K, + "embedding_dependency": { + "type": "deployment_name", + "deployment_name": env_helper.AZURE_OPENAI_EMBEDDING_MODEL, + }, "query_type": ( - "semantic" + "vector_semantic_hybrid" if env_helper.AZURE_SEARCH_USE_SEMANTIC_SEARCH - else "simple" + else "vector_simple_hybrid" ), "semantic_configuration": ( env_helper.AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG diff --git a/code/tests/functional/tests/backend_api/default/test_azure_byod.py b/code/tests/functional/tests/backend_api/default/test_azure_byod.py index da54bfb1a..4e9738b21 100644 --- a/code/tests/functional/tests/backend_api/default/test_azure_byod.py +++ b/code/tests/functional/tests/backend_api/default/test_azure_byod.py @@ -119,7 +119,11 @@ def test_post_makes_correct_call_to_azure_openai( "filter": app_config.get("AZURE_SEARCH_FILTER"), "in_scope": True, "top_n_documents": 5, - "query_type": "simple", + "embedding_dependency": { + "type": "deployment_name", + "deployment_name": "some-embedding-model", + }, + "query_type": "vector_simple_hybrid", "semantic_configuration": "", "role_information": "You are an AI assistant that helps people find information.", "authentication": { diff --git a/code/tests/functional/tests/backend_api/default/test_conversation_custom.py b/code/tests/functional/tests/backend_api/default/test_conversation_custom.py index 74f68c5f9..e9283d0ed 100644 --- a/code/tests/functional/tests/backend_api/default/test_conversation_custom.py +++ b/code/tests/functional/tests/backend_api/default/test_conversation_custom.py @@ -500,6 +500,7 @@ def test_post_makes_correct_call_to_search_documents_search_index( method="POST", json={ "filter": app_config.get("AZURE_SEARCH_FILTER"), + "queryType": "simple", "search": "What is the meaning of life?", "top": int(app_config.get("AZURE_SEARCH_TOP_K")), "vectorQueries": [ diff --git a/code/tests/functional/tests/backend_api/sk_orchestrator/test_response_with_search_documents_tool.py b/code/tests/functional/tests/backend_api/sk_orchestrator/test_response_with_search_documents_tool.py index 7a2b7cfc2..783c8006a 100644 --- a/code/tests/functional/tests/backend_api/sk_orchestrator/test_response_with_search_documents_tool.py +++ b/code/tests/functional/tests/backend_api/sk_orchestrator/test_response_with_search_documents_tool.py @@ -186,6 +186,7 @@ def test_post_makes_correct_call_to_get_search_documents( method="POST", json={ "filter": app_config.get("AZURE_SEARCH_FILTER"), + "queryType": "simple", "search": "What is the meaning of life?", "top": int(app_config.get("AZURE_SEARCH_TOP_K")), "vectorQueries": [ diff --git a/code/tests/search_utilities/test_AzureSearchHandler.py b/code/tests/search_utilities/test_AzureSearchHandler.py index bd555b60b..454c212c7 100644 --- a/code/tests/search_utilities/test_AzureSearchHandler.py +++ b/code/tests/search_utilities/test_AzureSearchHandler.py @@ -164,6 +164,7 @@ def test_query_search_performs_hybrid_search(handler, mock_llm_helper): fields="content_vector", ) ], + query_type="simple", filter=handler.env_helper.AZURE_SEARCH_FILTER, top=handler.env_helper.AZURE_SEARCH_TOP_K, ) diff --git a/code/tests/test_app.py b/code/tests/test_app.py index 5bd8ed8ba..d7ddf8e6e 100644 --- a/code/tests/test_app.py +++ b/code/tests/test_app.py @@ -9,6 +9,7 @@ AZURE_SPEECH_REGION_ENDPOINT = "mock-speech-region-endpoint" AZURE_OPENAI_ENDPOINT = "mock-openai-endpoint" AZURE_OPENAI_MODEL = "mock-openai-model" +AZURE_OPENAI_EMBEDDING_MODEL = "mock-openai-embedding-model" AZURE_OPENAI_SYSTEM_MESSAGE = "system-message" AZURE_OPENAI_API_VERSION = "mock-version" AZURE_OPENAI_API_KEY = "mock-api-key" @@ -47,6 +48,7 @@ def env_helper_mock(): env_helper.AZURE_SPEECH_REGION_ENDPOINT = AZURE_SPEECH_REGION_ENDPOINT env_helper.AZURE_OPENAI_ENDPOINT = AZURE_OPENAI_ENDPOINT env_helper.AZURE_OPENAI_MODEL = AZURE_OPENAI_MODEL + env_helper.AZURE_OPENAI_EMBEDDING_MODEL = AZURE_OPENAI_EMBEDDING_MODEL env_helper.AZURE_OPENAI_SYSTEM_MESSAGE = AZURE_OPENAI_SYSTEM_MESSAGE env_helper.AZURE_OPENAI_API_VERSION = AZURE_OPENAI_API_VERSION env_helper.AZURE_OPENAI_API_KEY = AZURE_OPENAI_API_KEY @@ -499,7 +501,11 @@ def test_converstation_azure_byod_returns_correct_response_when_streaming_with_d "filter": AZURE_SEARCH_FILTER, "in_scope": AZURE_SEARCH_ENABLE_IN_DOMAIN, "top_n_documents": AZURE_SEARCH_TOP_K, - "query_type": "semantic", + "embedding_dependency": { + "type": "deployment_name", + "deployment_name": AZURE_OPENAI_EMBEDDING_MODEL, + }, + "query_type": "vector_semantic_hybrid", "semantic_configuration": AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG, "role_information": AZURE_OPENAI_SYSTEM_MESSAGE, }, @@ -809,7 +815,7 @@ def test_converstation_azure_byod_uses_semantic_config( assert ( kwargs["extra_body"]["data_sources"][0]["parameters"]["query_type"] - == "semantic" + == "vector_semantic_hybrid" ) assert ( kwargs["extra_body"]["data_sources"][0]["parameters"][