From 7c59fd66f455c7fe5d0437dbe1fba2ef595fc4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Clgesuellip=E2=80=9D?= <“lgesuellipinto@uade.edu.ar”> Date: Thu, 26 Dec 2024 19:34:15 -0300 Subject: [PATCH] Fix tests --- libs/community/poetry.lock | 2 +- libs/community/tests/unit_tests/test_vertex_ai_search.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/community/poetry.lock b/libs/community/poetry.lock index 39738faf..cc62235e 100644 --- a/libs/community/poetry.lock +++ b/libs/community/poetry.lock @@ -4057,4 +4057,4 @@ vision = ["google-cloud-vision"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "f419e1224747e880f3b760169d59dc3cac5bfac9536a707452167e00578e0719" +content-hash = "2164d80ebaf39791c029f1fb94e8848f74a6685485e6da02d81c0d93e6e63db9" diff --git a/libs/community/tests/unit_tests/test_vertex_ai_search.py b/libs/community/tests/unit_tests/test_vertex_ai_search.py index 122955c8..a093dd7d 100644 --- a/libs/community/tests/unit_tests/test_vertex_ai_search.py +++ b/libs/community/tests/unit_tests/test_vertex_ai_search.py @@ -54,6 +54,7 @@ def test_version_initialization_stable(mock_stable_client: MagicMock) -> None: retriever = VertexAISearchRetriever( project_id="project_id_value", data_store_id="data_store_id_value", + credentials=ga_credentials.AnonymousCredentials(), ) assert not retriever.beta @@ -66,6 +67,7 @@ def test_version_initialization_beta(mock_beta_client: MagicMock) -> None: project_id="project_id_value", data_store_id="data_store_id_value", beta=True, + credentials=ga_credentials.AnonymousCredentials(), ) assert retriever.beta @@ -81,6 +83,7 @@ def test_version_compatibility_warning() -> None: project_id="project_id_value", data_store_id="data_store_id_value", beta=False, + credentials=ga_credentials.AnonymousCredentials(), custom_embedding=fake_embeddings, custom_embedding_field_path="embedding_field", custom_embedding_ratio=0.5, @@ -145,6 +148,7 @@ def test_beta_specific_params_in_stable_version() -> None: project_id="project_id_value", data_store_id="data_store_id_value", beta=False, + credentials=ga_credentials.AnonymousCredentials(), custom_embedding=FakeEmbeddings(size=100), custom_embedding_field_path="embedding_field", custom_embedding_ratio=0.5, @@ -206,6 +210,7 @@ def test_custom_embedding_with_missing_field_path() -> None: custom_embedding=embeddings, custom_embedding_ratio=0.5, beta=True, + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): retriever._create_search_request(query="query_value") @@ -224,6 +229,7 @@ def test_custom_embedding_with_missing_model() -> None: custom_embedding_field_path="embedding_field", custom_embedding_ratio=0.5, beta=True, + credentials=ga_credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): retriever._create_search_request(query="query_value") @@ -330,6 +336,7 @@ def test_get_content_spec_kwargs( "engine_data_type": engine_data_type, "get_extractive_answers": get_extractive_answers, "beta": beta_flag, + "credentials": ga_credentials.AnonymousCredentials(), **(config or {}), } @@ -458,6 +465,7 @@ def test_convert_unstructured_search_response_extractive_segments( get_extractive_answers=False, return_extractive_segment_score=True, beta=beta_flag, + credentials=ga_credentials.AnonymousCredentials(), ) documents = retriever._convert_unstructured_search_response( @@ -515,6 +523,7 @@ def test_convert_unstructured_search_response_extractive_answers( engine_data_type=0, get_extractive_answers=True, beta=beta_flag, + credentials=ga_credentials.AnonymousCredentials(), ) documents = retriever._convert_unstructured_search_response(