mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-27 05:20:34 +00:00
[fix]: Only Updating max_tokens if models is provided
This commit is contained in:
parent
6eafcb324e
commit
11ac96c5da
@ -1304,7 +1304,7 @@ class ChatAnthropic(BaseChatModel):
|
||||
@classmethod
|
||||
def validate_max_tokens(cls, values: dict[str, Any]) -> Any:
|
||||
"""Validate max_tokens."""
|
||||
if values.get("max_tokens") is None:
|
||||
if values.get("max_tokens") is None and values.get("model"):
|
||||
if "claude-opus-4" in values.get("model"):
|
||||
values["max_tokens"] = 32000
|
||||
elif values.get("model") in ["claude-sonnet-4", "claude-3-7-sonnet"]:
|
||||
|
Loading…
Reference in New Issue
Block a user