The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community:Fix a bug of LLM in moonshot (#25878)
rainsubtimef75d5621e205
diff --git a/libs/community/langchain_community/llms/moonshot.py b/libs/community/langchain_community/llms/moonshot.pyindex 8051f5146d..390113c1f9 100644--- a/libs/community/langchain_community/llms/moonshot.py+++ b/libs/community/langchain_community/llms/moonshot.py@@ -33,7 +33,7 @@ class _MoonshotClient(BaseModel):class MoonshotCommon(BaseModel):"""Common parameters for Moonshot LLMs."""- _client: _MoonshotClient+ client: _MoonshotClientbase_url: str = MOONSHOT_SERVICE_URL_BASEmoonshot_api_key: Optional[SecretStr] = Field(default=None, alias="api_key")"""Moonshot API key. Get it here: https://platform.moonshot.cn/console/api-keys"""@@ -84,7 +84,7 @@ class MoonshotCommon(BaseModel):get_from_dict_or_env(values, "moonshot_api_key", "MOONSHOT_API_KEY"))- values["_client"] = _MoonshotClient(+ values["client"] = _MoonshotClient(api_key=values["moonshot_api_key"],base_url=values["base_url"]if "base_url" in values@@ -125,7 +125,7 @@ class Moonshot(MoonshotCommon, LLM):request = self._invocation_paramsrequest["messages"] = [{"role": "user", "content": prompt}]request.update(kwargs)- text = self._client.completion(request)+ text = self.client.completion(request)if stop is not None:# This is required since the stop tokens# are not enforced by the model parameters