From c1ef73150302e307145761af86ceaba2d422d70d Mon Sep 17 00:00:00 2001 From: ccurme Date: Thu, 6 Jun 2024 12:29:10 -0400 Subject: [PATCH] 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. --- libs/partners/anthropic/langchain_anthropic/chat_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/partners/anthropic/langchain_anthropic/chat_models.py b/libs/partners/anthropic/langchain_anthropic/chat_models.py index 65eec5bef8a..2bf4c1af15c 100644 --- a/libs/partners/anthropic/langchain_anthropic/chat_models.py +++ b/libs/partners/anthropic/langchain_anthropic/chat_models.py @@ -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,