The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
fix(core): widen openai tool/function conversion input type to `Mapping` (#34304)
Mason Daugherty10377a7373e1
diff --git a/libs/core/langchain_core/utils/function_calling.py b/libs/core/langchain_core/utils/function_calling.pyindex 18373e3b3b..e64389a820 100644--- a/libs/core/langchain_core/utils/function_calling.py+++ b/libs/core/langchain_core/utils/function_calling.py@@ -8,6 +8,7 @@ import loggingimport typesimport typingimport uuid+from collections.abc import Mappingfrom typing import (TYPE_CHECKING,Annotated,@@ -327,7 +328,7 @@ def _format_tool_to_openai_function(tool: BaseTool) -> FunctionDescription:def convert_to_openai_function(- function: dict[str, Any] | type | Callable | BaseTool,+ function: Mapping[str, Any] | type | Callable | BaseTool,*,strict: bool | None = None,) -> dict[str, Any]:@@ -454,7 +455,7 @@ _WellKnownOpenAITools = (def convert_to_openai_tool(- tool: dict[str, Any] | type[BaseModel] | Callable | BaseTool,+ tool: Mapping[str, Any] | type[BaseModel] | Callable | BaseTool,*,strict: bool | None = None,) -> dict[str, Any]: