Skip to content

Commit

Permalink
fix: enforce attribute validation in VertexAISearchRetriever (#246)
Browse files Browse the repository at this point in the history
Co-authored-by: Amanda <[email protected]>
  • Loading branch information
yoursemicolon and Amanda committed May 23, 2024
1 parent 2e4b93b commit 3fb9667
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/community/langchain_google_community/vertex_ai_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class VertexAISearchRetriever(BaseRetriever, _BaseVertexAISearchRetriever):
class Config:
"""Configuration for this pydantic object."""

extra = Extra.ignore
extra = Extra.forbid
arbitrary_types_allowed = True
underscore_attrs_are_private = True

Expand All @@ -267,7 +267,11 @@ def __init__(self, **kwargs: Any) -> None:
"`pip install langchain-google-community[vertexaisearch]`"
) from exc

super().__init__(**kwargs)
try:
super().__init__(**kwargs)
except ValueError as e:
print(f"Error initializing GoogleVertexAISearchRetriever: {str(e)}")
raise

# For more information, refer to:
# https://cloud.google.com/generative-ai-app-builder/docs/locations#specify_a_multi-region_for_your_data_store
Expand Down

0 comments on commit 3fb9667

Please sign in to comment.