Skip to content

Commit 695c5b2

Browse files
keenborder786shinxi
authored andcommitted
(Community): Changing the BaseURL and Model for MiniMax (#29299)
- **Description:** Changed the Base Default Model and Base URL to correct versions. Plus added a more explicit exception if user provides an invalid API Key - **Issue:** #29278
1 parent 5249655 commit 695c5b2

File tree

1 file changed

+9
-3
lines changed
  • libs/community/langchain_community/chat_models

1 file changed

+9
-3
lines changed

libs/community/langchain_community/chat_models/minimax.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def _default_params(self) -> Dict[str, Any]:
370370
}
371371

372372
_client: Any = None
373-
model: str = "abab6.5-chat"
373+
model: str = "abab6.5s-chat"
374374
"""Model name to use."""
375375
max_tokens: int = 256
376376
"""Denotes the number of tokens to predict per generation."""
@@ -381,7 +381,7 @@ def _default_params(self) -> Dict[str, Any]:
381381
model_kwargs: Dict[str, Any] = Field(default_factory=dict)
382382
"""Holds any model parameters valid for `create` call not explicitly specified."""
383383
minimax_api_host: str = Field(
384-
default="https://api.minimax.chat/v1/text/chatcompletion_v2", alias="base_url"
384+
default="https://api.minimaxi.chat/v1/text/chatcompletion_v2", alias="base_url"
385385
)
386386
minimax_group_id: Optional[str] = Field(default=None, alias="group_id")
387387
"""[DEPRECATED, keeping it for for backward compatibility] Group Id"""
@@ -511,7 +511,13 @@ def _generate(
511511
with httpx.Client(headers=headers, timeout=60) as client:
512512
response = client.post(self.minimax_api_host, json=payload)
513513
response.raise_for_status()
514-
514+
final_response = response.json()
515+
if (
516+
"base_resp" in final_response
517+
and "status_msg" in final_response["base_resp"]
518+
and final_response["base_resp"]["status_msg"] == "invalid api key"
519+
):
520+
raise Exception("Invalid API Key Provided")
515521
return self._create_chat_result(response.json())
516522

517523
def _stream(

0 commit comments

Comments
 (0)