Skip to content

VertexAISearch Blended Search not working #786 #826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
25 changes: 18 additions & 7 deletions libs/community/langchain_google_community/vertex_ai_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@
"""The default custom credentials (google.auth.credentials.Credentials) to use
when making API calls. If not provided, credentials will be ascertained from
the environment."""
engine_data_type: int = Field(default=0, ge=0, le=2)
engine_data_type: int = Field(default=0, ge=0, le=3)
""" Defines the Vertex AI Search data type
0 - Unstructured data
1 - Structured data
2 - Website data
3 - Blended data
"""
_beta: bool = PrivateAttr(default=False)
"""Whether to use beta version of Vertex AI Search."""
Expand Down Expand Up @@ -493,9 +494,9 @@
)
else:
raise NotImplementedError(
"Only data store type 0 (Unstructured), 1 (Structured),"
"or 2 (Website) are supported currently."
+ f" Got {self.engine_data_type}"
"Only data store types 0 (Unstructured), 1 (Structured), "
"2 (Website), or 3 (Blended) are supported currently. "
+ f"Got {self.engine_data_type}"
)
return content_search_spec

Expand Down Expand Up @@ -574,11 +575,21 @@
documents = self._convert_website_search_response(
response.results, chunk_type
)
elif self.engine_data_type == 3:
# Blended search might return varied results; treat similarly to unstructured/website

Check failure on line 579 in libs/community/langchain_google_community/vertex_ai_search.py

View workflow job for this annotation

GitHub Actions / cd libs/community / - / make lint #3.9

Ruff (E501)

langchain_google_community/vertex_ai_search.py:579:89: E501 Line too long (97 > 88)

Check failure on line 579 in libs/community/langchain_google_community/vertex_ai_search.py

View workflow job for this annotation

GitHub Actions / cd libs/community / - / make lint #3.12

Ruff (E501)

langchain_google_community/vertex_ai_search.py:579:89: E501 Line too long (97 > 88)
chunk_type = (
"extractive_answers"
if self.get_extractive_answers
else "extractive_segments" # Or perhaps 'snippets', depending on API behavior

Check failure on line 583 in libs/community/langchain_google_community/vertex_ai_search.py

View workflow job for this annotation

GitHub Actions / cd libs/community / - / make lint #3.9

Ruff (E501)

langchain_google_community/vertex_ai_search.py:583:89: E501 Line too long (94 > 88)

Check failure on line 583 in libs/community/langchain_google_community/vertex_ai_search.py

View workflow job for this annotation

GitHub Actions / cd libs/community / - / make lint #3.12

Ruff (E501)

langchain_google_community/vertex_ai_search.py:583:89: E501 Line too long (94 > 88)
)
documents = self._convert_unstructured_search_response(
response.results, chunk_type
)
else:
raise NotImplementedError(
"Only data store type 0 (Unstructured), 1 (Structured),"
"or 2 (Website) are supported currently."
+ f" Got {self.engine_data_type}"
"Only data store types 0 (Unstructured), 1 (Structured), "
"2 (Website), or 3 (Blended) are supported currently. "
+ f"Got {self.engine_data_type}"
)

return documents
Expand Down
Loading