langchain-ai / langchain-google

MIT License
104 stars 121 forks source link

community: enforce attribute validation in VertexAISearchRetriever #246

Closed yoursemicolon closed 4 months ago

yoursemicolon commented 4 months ago

This commit updates the VertexAISearchRetriever configuration to forbid unknown fields during initialization. This change ensures that users receive immediate feedback if they accidentally pass a wrong or misspelled attribute name, improving error handling and robustness of the initialization process.

The change modifies the Pydantic BaseModel configuration to set extra = Extra.forbid, which throws errors for any extraneous fields. This update is essential for preventing runtime errors related to attribute misconfigurations and is in line with best practices for Pydantic model setup.

yoursemicolon commented 4 months ago

please review @lkuligin