From cf3c81f5556c62e05586b71f18bb2874d4add86d Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Wed, 21 Aug 2024 14:02:02 -0700 Subject: [PATCH 1/8] Small change to fix an API issue --- backend/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/settings.py b/backend/settings.py index 9fcf767b69..dda4492cc5 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -182,7 +182,7 @@ def extract_embedding_dependency(self) -> Optional[dict]: "endpoint": self.embedding_endpoint, "authentication": { "type": "api_key", - "api_key": self.embedding_key + "key": self.embedding_key } } else: From fae9d84b0d36836683af41eaf906472f7f9d709d Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Wed, 21 Aug 2024 14:11:51 -0700 Subject: [PATCH 2/8] Test update --- .../dotenv_with_embedding_dependency_1 | 37 +++++++++++++++++++ .../dotenv_with_embedding_dependency_2 | 37 +++++++++++++++++++ .../dotenv_with_embedding_dependency_3 | 37 +++++++++++++++++++ tests/unit_tests/test_settings.py | 37 +++++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_1 create mode 100644 tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_2 create mode 100644 tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_3 diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_1 b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_1 new file mode 100644 index 0000000000..8e313ac995 --- /dev/null +++ b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_1 @@ -0,0 +1,37 @@ +# Chat +DEBUG=True +DATASOURCE_TYPE="AzureCognitiveSearch" +AZURE_OPENAI_RESOURCE= +AZURE_OPENAI_MODEL=my_model +AZURE_OPENAI_KEY=dummy +AZURE_OPENAI_MODEL_NAME=model_name +AZURE_OPENAI_TEMPERATURE=0 +AZURE_OPENAI_TOP_P=1.0 +AZURE_OPENAI_MAX_TOKENS=1000 +AZURE_OPENAI_STOP_SEQUENCE= +AZURE_OPENAI_SYSTEM_MESSAGE=You are an AI assistant that helps people find information. +AZURE_OPENAI_PREVIEW_API_VERSION=2024-05-01-preview +AZURE_OPENAI_STREAM=False +AZURE_OPENAI_ENDPOINT=https://dummy.openai.azure.com/ +AZURE_OPENAI_EMBEDDING_NAME=embedding_model +AZURE_OPENAI_EMBEDDING_ENDPOINT= +AZURE_OPENAI_EMBEDDING_KEY= +# Chat with data: common settings +SEARCH_TOP_K=5 +SEARCH_STRICTNESS=3 +SEARCH_ENABLE_IN_DOMAIN=True +# Chat with data: Azure AI Search +AZURE_SEARCH_SERVICE=search_service +AZURE_SEARCH_INDEX=search_index +AZURE_SEARCH_KEY=dummy +AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG= +AZURE_SEARCH_TOP_K=5 +AZURE_SEARCH_ENABLE_IN_DOMAIN=true +AZURE_SEARCH_CONTENT_COLUMNS=content1,content2 +AZURE_SEARCH_FILENAME_COLUMN=filepath +AZURE_SEARCH_TITLE_COLUMN=title +AZURE_SEARCH_URL_COLUMN=url +AZURE_SEARCH_VECTOR_COLUMNS=vector1 +AZURE_SEARCH_QUERY_TYPE=simple +AZURE_SEARCH_PERMITTED_GROUPS_COLUMN= +AZURE_SEARCH_STRICTNESS=3 \ No newline at end of file diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_2 b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_2 new file mode 100644 index 0000000000..cdf41b53de --- /dev/null +++ b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_2 @@ -0,0 +1,37 @@ +# Chat +DEBUG=True +DATASOURCE_TYPE="AzureCognitiveSearch" +AZURE_OPENAI_RESOURCE= +AZURE_OPENAI_MODEL=my_model +AZURE_OPENAI_KEY=dummy +AZURE_OPENAI_MODEL_NAME=model_name +AZURE_OPENAI_TEMPERATURE=0 +AZURE_OPENAI_TOP_P=1.0 +AZURE_OPENAI_MAX_TOKENS=1000 +AZURE_OPENAI_STOP_SEQUENCE= +AZURE_OPENAI_SYSTEM_MESSAGE=You are an AI assistant that helps people find information. +AZURE_OPENAI_PREVIEW_API_VERSION=2024-05-01-preview +AZURE_OPENAI_STREAM=False +AZURE_OPENAI_ENDPOINT=https://dummy.openai.azure.com/ +AZURE_OPENAI_EMBEDDING_NAME= +AZURE_OPENAI_EMBEDDING_ENDPOINT=https://embeddings.openai.azure.com +AZURE_OPENAI_EMBEDDING_KEY=dummy +# Chat with data: common settings +SEARCH_TOP_K=5 +SEARCH_STRICTNESS=3 +SEARCH_ENABLE_IN_DOMAIN=True +# Chat with data: Azure AI Search +AZURE_SEARCH_SERVICE=search_service +AZURE_SEARCH_INDEX=search_index +AZURE_SEARCH_KEY=dummy +AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG= +AZURE_SEARCH_TOP_K=5 +AZURE_SEARCH_ENABLE_IN_DOMAIN=true +AZURE_SEARCH_CONTENT_COLUMNS=content1,content2 +AZURE_SEARCH_FILENAME_COLUMN=filepath +AZURE_SEARCH_TITLE_COLUMN=title +AZURE_SEARCH_URL_COLUMN=url +AZURE_SEARCH_VECTOR_COLUMNS=vector1 +AZURE_SEARCH_QUERY_TYPE=simple +AZURE_SEARCH_PERMITTED_GROUPS_COLUMN= +AZURE_SEARCH_STRICTNESS=3 \ No newline at end of file diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_3 b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_3 new file mode 100644 index 0000000000..1d13e3939c --- /dev/null +++ b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_3 @@ -0,0 +1,37 @@ +# Chat +DEBUG=True +DATASOURCE_TYPE="AzureCognitiveSearch" +AZURE_OPENAI_RESOURCE= +AZURE_OPENAI_MODEL=my_model +AZURE_OPENAI_KEY=dummy +AZURE_OPENAI_MODEL_NAME=model_name +AZURE_OPENAI_TEMPERATURE=0 +AZURE_OPENAI_TOP_P=1.0 +AZURE_OPENAI_MAX_TOKENS=1000 +AZURE_OPENAI_STOP_SEQUENCE= +AZURE_OPENAI_SYSTEM_MESSAGE=You are an AI assistant that helps people find information. +AZURE_OPENAI_PREVIEW_API_VERSION=2024-05-01-preview +AZURE_OPENAI_STREAM=False +AZURE_OPENAI_ENDPOINT=https://dummy.openai.azure.com/ +AZURE_OPENAI_EMBEDDING_NAME= +AZURE_OPENAI_EMBEDDING_ENDPOINT=https://embeddings.openai.azure.com +AZURE_OPENAI_EMBEDDING_KEY= +# Chat with data: common settings +SEARCH_TOP_K=5 +SEARCH_STRICTNESS=3 +SEARCH_ENABLE_IN_DOMAIN=True +# Chat with data: Azure AI Search +AZURE_SEARCH_SERVICE=search_service +AZURE_SEARCH_INDEX=search_index +AZURE_SEARCH_KEY=dummy +AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG= +AZURE_SEARCH_TOP_K=5 +AZURE_SEARCH_ENABLE_IN_DOMAIN=true +AZURE_SEARCH_CONTENT_COLUMNS=content1,content2 +AZURE_SEARCH_FILENAME_COLUMN=filepath +AZURE_SEARCH_TITLE_COLUMN=title +AZURE_SEARCH_URL_COLUMN=url +AZURE_SEARCH_VECTOR_COLUMNS=vector1 +AZURE_SEARCH_QUERY_TYPE=simple +AZURE_SEARCH_PERMITTED_GROUPS_COLUMN= +AZURE_SEARCH_STRICTNESS=3 \ No newline at end of file diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index 3bf3da2228..f5cc0603e2 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -68,5 +68,42 @@ def test_dotenv_with_elasticsearch_success(app_settings): print(payload) +def test_dotenv_with_embedding_dependency_1(app_settings): + # Validate model object + assert app_settings.azure_openai is not None + assert app_settings.azure_openai.embedding_name == "embedding_model" + + # Validate API payload structure + payload = app_settings.datasource.construct_payload_configuration() + assert payload["parameters"]["embedding_dependency"]["type"] == "deployment_name" + assert payload["parameters"]["embedding_dependency"]["deployment_name"] == "embedding_model" + print(payload) + + +def test_dotenv_with_embedding_dependency_2(app_settings): + # Validate model object + assert app_settings.azure_openai is not None + assert app_settings.azure_openai.embedding_endpoint == "https://embeddings.openai.azure.com" + assert app_settings.azure_openai.embedding_key == "dummy" + + # Validate API payload structure + payload = app_settings.datasource.construct_payload_configuration() + assert payload["parameters"]["embedding_dependency"]["type"] == "api_key" + assert payload["parameters"]["embedding_dependency"]["key"] == "dummy" + print(payload) + + +def test_dotenv_with_embedding_dependency_3(app_settings): + # Validate model object + assert app_settings.azure_openai is not None + assert app_settings.azure_openai.embedding_endpoint == "https://embeddings.openai.azure.com" + assert app_settings.azure_openai.embedding_key == None + + # Validate API payload structure + payload = app_settings.datasource.construct_payload_configuration() + assert payload["parameters"]["embedding_dependency"]["type"] == "system_assigned_managed_identity" + print(payload) + + From b2b92e621d017c760d24dc823dc7196a20fbc890 Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Wed, 21 Aug 2024 14:35:31 -0700 Subject: [PATCH 3/8] Test update --- tests/unit_tests/test_settings.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index f5cc0603e2..20a153c991 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -88,8 +88,9 @@ def test_dotenv_with_embedding_dependency_2(app_settings): # Validate API payload structure payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "api_key" - assert payload["parameters"]["embedding_dependency"]["key"] == "dummy" + assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint" + assert payload["parameters"]["embedding_dependency"]["authentication"]["type"] == "api_key" + assert payload["parameters"]["embedding_dependency"]["authentication"]["key"] == "dummy" print(payload) @@ -101,7 +102,8 @@ def test_dotenv_with_embedding_dependency_3(app_settings): # Validate API payload structure payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "system_assigned_managed_identity" + assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint" + assert payload["parameters"]["embedding_dependency"]["authentication"]["type"] == "system_assigned_managed_identity" print(payload) From a22b25ac7735b5c081ed7ff5e6b727f4d2b988f1 Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Wed, 21 Aug 2024 16:12:47 -0700 Subject: [PATCH 4/8] Test debug --- tests/unit_tests/test_settings.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index 20a153c991..6fbdd683c3 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -1,3 +1,4 @@ +import json import os import pytest from importlib import import_module, reload @@ -71,12 +72,12 @@ def test_dotenv_with_elasticsearch_success(app_settings): def test_dotenv_with_embedding_dependency_1(app_settings): # Validate model object assert app_settings.azure_openai is not None - assert app_settings.azure_openai.embedding_name == "embedding_model" + assert app_settings.azure_openai.embedding_name == "embedding_model", app_settings.model_dump() # Validate API payload structure payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "deployment_name" - assert payload["parameters"]["embedding_dependency"]["deployment_name"] == "embedding_model" + assert payload["parameters"]["embedding_dependency"]["type"] == "deployment_name", json.dumps(payload) + assert payload["parameters"]["embedding_dependency"]["deployment_name"] == "embedding_model", json.dumps(payload) print(payload) @@ -88,7 +89,7 @@ def test_dotenv_with_embedding_dependency_2(app_settings): # Validate API payload structure payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint" + assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint", json.dumps(payload) assert payload["parameters"]["embedding_dependency"]["authentication"]["type"] == "api_key" assert payload["parameters"]["embedding_dependency"]["authentication"]["key"] == "dummy" print(payload) @@ -102,7 +103,7 @@ def test_dotenv_with_embedding_dependency_3(app_settings): # Validate API payload structure payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint" + assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint", json.dumps(payload) assert payload["parameters"]["embedding_dependency"]["authentication"]["type"] == "system_assigned_managed_identity" print(payload) From 1e75fcf134b9335f1ab91b1eed25231fffadc72f Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Wed, 21 Aug 2024 16:19:04 -0700 Subject: [PATCH 5/8] Test debug --- tests/unit_tests/test_settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index 6fbdd683c3..cdc84686fb 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -20,6 +20,7 @@ def app_settings(dotenv_path): os.environ["DOTENV_PATH"] = dotenv_path settings_module = import_module("backend.settings") settings_module = reload(settings_module) + print(os.environ.items()) yield getattr(settings_module, "app_settings") From 90e129a44f71a978ce2761f76a3939640b0244ca Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Wed, 21 Aug 2024 16:23:23 -0700 Subject: [PATCH 6/8] Fix line endings for test files --- tests/unit_tests/test_settings.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index cdc84686fb..20a153c991 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -1,4 +1,3 @@ -import json import os import pytest from importlib import import_module, reload @@ -20,7 +19,6 @@ def app_settings(dotenv_path): os.environ["DOTENV_PATH"] = dotenv_path settings_module = import_module("backend.settings") settings_module = reload(settings_module) - print(os.environ.items()) yield getattr(settings_module, "app_settings") @@ -73,12 +71,12 @@ def test_dotenv_with_elasticsearch_success(app_settings): def test_dotenv_with_embedding_dependency_1(app_settings): # Validate model object assert app_settings.azure_openai is not None - assert app_settings.azure_openai.embedding_name == "embedding_model", app_settings.model_dump() + assert app_settings.azure_openai.embedding_name == "embedding_model" # Validate API payload structure payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "deployment_name", json.dumps(payload) - assert payload["parameters"]["embedding_dependency"]["deployment_name"] == "embedding_model", json.dumps(payload) + assert payload["parameters"]["embedding_dependency"]["type"] == "deployment_name" + assert payload["parameters"]["embedding_dependency"]["deployment_name"] == "embedding_model" print(payload) @@ -90,7 +88,7 @@ def test_dotenv_with_embedding_dependency_2(app_settings): # Validate API payload structure payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint", json.dumps(payload) + assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint" assert payload["parameters"]["embedding_dependency"]["authentication"]["type"] == "api_key" assert payload["parameters"]["embedding_dependency"]["authentication"]["key"] == "dummy" print(payload) @@ -104,7 +102,7 @@ def test_dotenv_with_embedding_dependency_3(app_settings): # Validate API payload structure payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint", json.dumps(payload) + assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint" assert payload["parameters"]["embedding_dependency"]["authentication"]["type"] == "system_assigned_managed_identity" print(payload) From 92533de80a36d29e524134a43c5307122c907d64 Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Wed, 21 Aug 2024 16:30:19 -0700 Subject: [PATCH 7/8] debug --- ...y_1 => dotenv_with_embedding_dependency_deployment_name} | 0 ...cy_2 => dotenv_with_embedding_dependency_endpointandkey} | 0 ...ing_dependency_3 => dotenv_with_embedding_dependency_mi} | 0 tests/unit_tests/test_settings.py | 6 +++--- 4 files changed, 3 insertions(+), 3 deletions(-) rename tests/unit_tests/dotenv_data/{dotenv_with_embedding_dependency_1 => dotenv_with_embedding_dependency_deployment_name} (100%) rename tests/unit_tests/dotenv_data/{dotenv_with_embedding_dependency_2 => dotenv_with_embedding_dependency_endpointandkey} (100%) rename tests/unit_tests/dotenv_data/{dotenv_with_embedding_dependency_3 => dotenv_with_embedding_dependency_mi} (100%) diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_1 b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_deployment_name similarity index 100% rename from tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_1 rename to tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_deployment_name diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_2 b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_endpointandkey similarity index 100% rename from tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_2 rename to tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_endpointandkey diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_3 b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_mi similarity index 100% rename from tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_3 rename to tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_mi diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index 20a153c991..ca1c8b594f 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -68,7 +68,7 @@ def test_dotenv_with_elasticsearch_success(app_settings): print(payload) -def test_dotenv_with_embedding_dependency_1(app_settings): +def test_dotenv_with_embedding_dependency_deployment_name(app_settings): # Validate model object assert app_settings.azure_openai is not None assert app_settings.azure_openai.embedding_name == "embedding_model" @@ -80,7 +80,7 @@ def test_dotenv_with_embedding_dependency_1(app_settings): print(payload) -def test_dotenv_with_embedding_dependency_2(app_settings): +def test_dotenv_with_embedding_dependency_endpointandkey(app_settings): # Validate model object assert app_settings.azure_openai is not None assert app_settings.azure_openai.embedding_endpoint == "https://embeddings.openai.azure.com" @@ -94,7 +94,7 @@ def test_dotenv_with_embedding_dependency_2(app_settings): print(payload) -def test_dotenv_with_embedding_dependency_3(app_settings): +def test_dotenv_with_embedding_dependency_mi(app_settings): # Validate model object assert app_settings.azure_openai is not None assert app_settings.azure_openai.embedding_endpoint == "https://embeddings.openai.azure.com" From e3e0a5c22415d9db36c73a5f76c055d8086ce076 Mon Sep 17 00:00:00 2001 From: Abigail Hartman Date: Wed, 21 Aug 2024 16:39:12 -0700 Subject: [PATCH 8/8] Remove tests for now --- ..._with_embedding_dependency_deployment_name | 37 ------------------ ...v_with_embedding_dependency_endpointandkey | 37 ------------------ .../dotenv_with_embedding_dependency_mi | 37 ------------------ tests/unit_tests/test_settings.py | 39 ------------------- 4 files changed, 150 deletions(-) delete mode 100644 tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_deployment_name delete mode 100644 tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_endpointandkey delete mode 100644 tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_mi diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_deployment_name b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_deployment_name deleted file mode 100644 index 8e313ac995..0000000000 --- a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_deployment_name +++ /dev/null @@ -1,37 +0,0 @@ -# Chat -DEBUG=True -DATASOURCE_TYPE="AzureCognitiveSearch" -AZURE_OPENAI_RESOURCE= -AZURE_OPENAI_MODEL=my_model -AZURE_OPENAI_KEY=dummy -AZURE_OPENAI_MODEL_NAME=model_name -AZURE_OPENAI_TEMPERATURE=0 -AZURE_OPENAI_TOP_P=1.0 -AZURE_OPENAI_MAX_TOKENS=1000 -AZURE_OPENAI_STOP_SEQUENCE= -AZURE_OPENAI_SYSTEM_MESSAGE=You are an AI assistant that helps people find information. -AZURE_OPENAI_PREVIEW_API_VERSION=2024-05-01-preview -AZURE_OPENAI_STREAM=False -AZURE_OPENAI_ENDPOINT=https://dummy.openai.azure.com/ -AZURE_OPENAI_EMBEDDING_NAME=embedding_model -AZURE_OPENAI_EMBEDDING_ENDPOINT= -AZURE_OPENAI_EMBEDDING_KEY= -# Chat with data: common settings -SEARCH_TOP_K=5 -SEARCH_STRICTNESS=3 -SEARCH_ENABLE_IN_DOMAIN=True -# Chat with data: Azure AI Search -AZURE_SEARCH_SERVICE=search_service -AZURE_SEARCH_INDEX=search_index -AZURE_SEARCH_KEY=dummy -AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG= -AZURE_SEARCH_TOP_K=5 -AZURE_SEARCH_ENABLE_IN_DOMAIN=true -AZURE_SEARCH_CONTENT_COLUMNS=content1,content2 -AZURE_SEARCH_FILENAME_COLUMN=filepath -AZURE_SEARCH_TITLE_COLUMN=title -AZURE_SEARCH_URL_COLUMN=url -AZURE_SEARCH_VECTOR_COLUMNS=vector1 -AZURE_SEARCH_QUERY_TYPE=simple -AZURE_SEARCH_PERMITTED_GROUPS_COLUMN= -AZURE_SEARCH_STRICTNESS=3 \ No newline at end of file diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_endpointandkey b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_endpointandkey deleted file mode 100644 index cdf41b53de..0000000000 --- a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_endpointandkey +++ /dev/null @@ -1,37 +0,0 @@ -# Chat -DEBUG=True -DATASOURCE_TYPE="AzureCognitiveSearch" -AZURE_OPENAI_RESOURCE= -AZURE_OPENAI_MODEL=my_model -AZURE_OPENAI_KEY=dummy -AZURE_OPENAI_MODEL_NAME=model_name -AZURE_OPENAI_TEMPERATURE=0 -AZURE_OPENAI_TOP_P=1.0 -AZURE_OPENAI_MAX_TOKENS=1000 -AZURE_OPENAI_STOP_SEQUENCE= -AZURE_OPENAI_SYSTEM_MESSAGE=You are an AI assistant that helps people find information. -AZURE_OPENAI_PREVIEW_API_VERSION=2024-05-01-preview -AZURE_OPENAI_STREAM=False -AZURE_OPENAI_ENDPOINT=https://dummy.openai.azure.com/ -AZURE_OPENAI_EMBEDDING_NAME= -AZURE_OPENAI_EMBEDDING_ENDPOINT=https://embeddings.openai.azure.com -AZURE_OPENAI_EMBEDDING_KEY=dummy -# Chat with data: common settings -SEARCH_TOP_K=5 -SEARCH_STRICTNESS=3 -SEARCH_ENABLE_IN_DOMAIN=True -# Chat with data: Azure AI Search -AZURE_SEARCH_SERVICE=search_service -AZURE_SEARCH_INDEX=search_index -AZURE_SEARCH_KEY=dummy -AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG= -AZURE_SEARCH_TOP_K=5 -AZURE_SEARCH_ENABLE_IN_DOMAIN=true -AZURE_SEARCH_CONTENT_COLUMNS=content1,content2 -AZURE_SEARCH_FILENAME_COLUMN=filepath -AZURE_SEARCH_TITLE_COLUMN=title -AZURE_SEARCH_URL_COLUMN=url -AZURE_SEARCH_VECTOR_COLUMNS=vector1 -AZURE_SEARCH_QUERY_TYPE=simple -AZURE_SEARCH_PERMITTED_GROUPS_COLUMN= -AZURE_SEARCH_STRICTNESS=3 \ No newline at end of file diff --git a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_mi b/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_mi deleted file mode 100644 index 1d13e3939c..0000000000 --- a/tests/unit_tests/dotenv_data/dotenv_with_embedding_dependency_mi +++ /dev/null @@ -1,37 +0,0 @@ -# Chat -DEBUG=True -DATASOURCE_TYPE="AzureCognitiveSearch" -AZURE_OPENAI_RESOURCE= -AZURE_OPENAI_MODEL=my_model -AZURE_OPENAI_KEY=dummy -AZURE_OPENAI_MODEL_NAME=model_name -AZURE_OPENAI_TEMPERATURE=0 -AZURE_OPENAI_TOP_P=1.0 -AZURE_OPENAI_MAX_TOKENS=1000 -AZURE_OPENAI_STOP_SEQUENCE= -AZURE_OPENAI_SYSTEM_MESSAGE=You are an AI assistant that helps people find information. -AZURE_OPENAI_PREVIEW_API_VERSION=2024-05-01-preview -AZURE_OPENAI_STREAM=False -AZURE_OPENAI_ENDPOINT=https://dummy.openai.azure.com/ -AZURE_OPENAI_EMBEDDING_NAME= -AZURE_OPENAI_EMBEDDING_ENDPOINT=https://embeddings.openai.azure.com -AZURE_OPENAI_EMBEDDING_KEY= -# Chat with data: common settings -SEARCH_TOP_K=5 -SEARCH_STRICTNESS=3 -SEARCH_ENABLE_IN_DOMAIN=True -# Chat with data: Azure AI Search -AZURE_SEARCH_SERVICE=search_service -AZURE_SEARCH_INDEX=search_index -AZURE_SEARCH_KEY=dummy -AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG= -AZURE_SEARCH_TOP_K=5 -AZURE_SEARCH_ENABLE_IN_DOMAIN=true -AZURE_SEARCH_CONTENT_COLUMNS=content1,content2 -AZURE_SEARCH_FILENAME_COLUMN=filepath -AZURE_SEARCH_TITLE_COLUMN=title -AZURE_SEARCH_URL_COLUMN=url -AZURE_SEARCH_VECTOR_COLUMNS=vector1 -AZURE_SEARCH_QUERY_TYPE=simple -AZURE_SEARCH_PERMITTED_GROUPS_COLUMN= -AZURE_SEARCH_STRICTNESS=3 \ No newline at end of file diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index ca1c8b594f..aeb8d01504 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -66,46 +66,7 @@ def test_dotenv_with_elasticsearch_success(app_settings): assert payload["parameters"] is not None assert payload["parameters"]["endpoint"] == "dummy" print(payload) - - -def test_dotenv_with_embedding_dependency_deployment_name(app_settings): - # Validate model object - assert app_settings.azure_openai is not None - assert app_settings.azure_openai.embedding_name == "embedding_model" - - # Validate API payload structure - payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "deployment_name" - assert payload["parameters"]["embedding_dependency"]["deployment_name"] == "embedding_model" - print(payload) - - -def test_dotenv_with_embedding_dependency_endpointandkey(app_settings): - # Validate model object - assert app_settings.azure_openai is not None - assert app_settings.azure_openai.embedding_endpoint == "https://embeddings.openai.azure.com" - assert app_settings.azure_openai.embedding_key == "dummy" - - # Validate API payload structure - payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint" - assert payload["parameters"]["embedding_dependency"]["authentication"]["type"] == "api_key" - assert payload["parameters"]["embedding_dependency"]["authentication"]["key"] == "dummy" - print(payload) - -def test_dotenv_with_embedding_dependency_mi(app_settings): - # Validate model object - assert app_settings.azure_openai is not None - assert app_settings.azure_openai.embedding_endpoint == "https://embeddings.openai.azure.com" - assert app_settings.azure_openai.embedding_key == None - - # Validate API payload structure - payload = app_settings.datasource.construct_payload_configuration() - assert payload["parameters"]["embedding_dependency"]["type"] == "endpoint" - assert payload["parameters"]["embedding_dependency"]["authentication"]["type"] == "system_assigned_managed_identity" - print(payload) -