The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: fix model initialization bug for deepinfra (#25727)
Moritz Schlager555f97becbf6
diff --git a/libs/community/langchain_community/chat_models/deepinfra.py b/libs/community/langchain_community/chat_models/deepinfra.pyindex 37fef6763b..3de532b0c4 100644--- a/libs/community/langchain_community/chat_models/deepinfra.py+++ b/libs/community/langchain_community/chat_models/deepinfra.py@@ -222,6 +222,11 @@ class ChatDeepInfra(BaseChatModel):streaming: bool = Falsemax_retries: int = 1+ class Config:+ """Configuration for this pydantic object."""++ allow_population_by_field_name = True+@propertydef _default_params(self) -> Dict[str, Any]:"""Get the default parameters for calling OpenAI API."""diff --git a/libs/community/tests/unit_tests/chat_models/test_deepinfra.py b/libs/community/tests/unit_tests/chat_models/test_deepinfra.pynew file mode 100644index 0000000000..48a1d08a2d--- /dev/null+++ b/libs/community/tests/unit_tests/chat_models/test_deepinfra.py@@ -0,0 +1,11 @@+from langchain_community.chat_models import ChatDeepInfra+++def test_deepinfra_model_name_param() -> None:+ llm = ChatDeepInfra(model_name="foo") # type: ignore[call-arg]+ assert llm.model_name == "foo"+++def test_deepinfra_model_param() -> None:+ llm = ChatDeepInfra(model="foo")+ assert llm.model_name == "foo"