The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Use existing required args obj if specified (#9883)
William FH3103f07e0318
diff --git a/libs/langchain/langchain/tools/convert_to_openai.py b/libs/langchain/langchain/tools/convert_to_openai.pyindex 82c0a47fbb..e575b024d4 100644--- a/libs/langchain/langchain/tools/convert_to_openai.py+++ b/libs/langchain/langchain/tools/convert_to_openai.py@@ -19,7 +19,9 @@ def format_tool_to_openai_function(tool: BaseTool) -> FunctionDescription:if isinstance(tool, StructuredTool):schema_ = tool.args_schema.schema()# Bug with required missing for structured tools.- required = sorted(schema_["properties"]) # BUG WORKAROUND+ required = schema_.get(+ "required", sorted(schema_["properties"]) # Backup is a BUG WORKAROUND+ )return {"name": tool.name,"description": tool.description,