mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-28 09:28:48 +00:00
Use existing required args obj if specified (#9883)
We always overwrote the required args but we infer them by default. Doing it only the old way makes it so the llm guesses even if an arg is optional (e.g., for uuids)
This commit is contained in:
parent
b14d74dd4d
commit
3103f07e03
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user