The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Add additional VertexAI Params (#5837)
Aidan Holland9f4b720a632a
diff --git a/langchain/llms/vertexai.py b/langchain/llms/vertexai.pyindex d9d67b37db..58ea7359ec 100644--- a/langchain/llms/vertexai.py+++ b/langchain/llms/vertexai.py@@ -29,6 +29,8 @@ class _VertexAICommon(BaseModel):top_k: int = 40"How the model selects tokens for output, the next token is selected from ""among the top-k most probable tokens."+ stop: Optional[List[str]] = None+ "Optional list of stop words to use when generating."project: Optional[str] = None"The default GCP project to use when making Vertex API calls."location: str = "us-central1"@@ -48,11 +50,13 @@ class _VertexAICommon(BaseModel):}return {**base_params}- def _predict(self, prompt: str, stop: Optional[List[str]]) -> str:+ def _predict(self, prompt: str, stop: Optional[List[str]] = None) -> str:res = self.client.predict(prompt, **self._default_params)return self._enforce_stop_words(res.text, stop)- def _enforce_stop_words(self, text: str, stop: Optional[List[str]]) -> str:+ def _enforce_stop_words(self, text: str, stop: Optional[List[str]] = None) -> str:+ if stop is None and self.stop is not None:+ stop = self.stopif stop:return enforce_stop_tokens(text, stop)return text