anthropic: update attribute name and alias (#22625)

update name to `stop_sequences` and alias to `stop` (instead of the
other way around), since `stop_sequences` is the name used by anthropic.
This commit is contained in:
ccurme 2024-06-06 12:29:10 -04:00 committed by GitHub
parent 05bf98b2f9
commit c1ef731503
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -492,7 +492,7 @@ class ChatAnthropic(BaseChatModel):
max_retries: int = 2
"""Number of retries allowed for requests sent to the Anthropic Completion API."""
stop: Optional[List[str]] = Field(None, alias="stop_sequences")
stop_sequences: Optional[List[str]] = Field(None, alias="stop")
"""Default stop sequences."""
anthropic_api_url: Optional[str] = Field(None, alias="base_url")
@ -614,7 +614,7 @@ class ChatAnthropic(BaseChatModel):
) -> Dict:
# get system prompt if any
system, formatted_messages = _format_messages(messages)
stop_sequences = stop or self.stop
stop_sequences = stop or self.stop_sequences
rtn = {
"model": self.model,
"max_tokens": self.max_tokens,