From ba4e82bb47fe5eb9a06a0cdaeb09c0d56dbf9501 Mon Sep 17 00:00:00 2001 From: thehunmonkgroup Date: Thu, 27 Jul 2023 19:59:10 -0400 Subject: [PATCH] fix missing _identifying_params() in _VertexAICommon (#8303) Full set of params are missing from Vertex* LLMs when `dict()` method is called. ``` >>> from langchain.chat_models.vertexai import ChatVertexAI >>> from langchain.llms.vertexai import VertexAI >>> chat_llm = ChatVertexAI() l>>> llm = VertexAI() >>> chat_llm.dict() {'_type': 'vertexai'} >>> llm.dict() {'_type': 'vertexai'} ``` This PR just uses the same mechanism used elsewhere to expose the full params. Since `_identifying_params()` is on the `_VertexAICommon` class, it should cover the chat and non-chat cases. --- libs/langchain/langchain/llms/vertexai.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/langchain/langchain/llms/vertexai.py b/libs/langchain/langchain/llms/vertexai.py index da85f79edb..35fa573466 100644 --- a/libs/langchain/langchain/llms/vertexai.py +++ b/libs/langchain/langchain/llms/vertexai.py @@ -122,6 +122,11 @@ class _VertexAICommon(BaseModel): return enforce_stop_tokens(text, stop) return text + @property + def _identifying_params(self) -> Dict[str, Any]: + """Get the identifying parameters.""" + return {**{"model_name": self.model_name}, **self._default_params} + @property def _llm_type(self) -> str: return "vertexai"