The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
anthropic[patch]: allow pop by field name (#16544)
Bagatur5c2538b9f7fb
diff --git a/libs/partners/anthropic/langchain_anthropic/chat_models.py b/libs/partners/anthropic/langchain_anthropic/chat_models.pyindex d30d2fd134..91cc511248 100644--- a/libs/partners/anthropic/langchain_anthropic/chat_models.py+++ b/libs/partners/anthropic/langchain_anthropic/chat_models.py@@ -88,6 +88,11 @@ class ChatAnthropicMessages(BaseChatModel):model_kwargs: Dict[str, Any] = Field(default_factory=dict)+ class Config:+ """Configuration for this pydantic object."""++ allow_population_by_field_name = True+@propertydef _llm_type(self) -> str:"""Return type of chat model."""diff --git a/libs/partners/anthropic/tests/unit_tests/test_chat_models.py b/libs/partners/anthropic/tests/unit_tests/test_chat_models.pyindex 4ad9b7c7b0..ebcf0386ae 100644--- a/libs/partners/anthropic/tests/unit_tests/test_chat_models.py+++ b/libs/partners/anthropic/tests/unit_tests/test_chat_models.py@@ -7,3 +7,4 @@ from langchain_anthropic.chat_models import ChatAnthropicMessagesdef test_initialization() -> None:"""Test chat model initialization."""ChatAnthropicMessages(model_name="claude-instant-1.2", anthropic_api_key="xyz")+ ChatAnthropicMessages(model="claude-instant-1.2", anthropic_api_key="xyz")