Warum passiert das, obwohl ich bereits ein pydantisches Eingabemodell mit Args_schema definiert habe?Python

Python-Programme
Anonymous
 Warum passiert das, obwohl ich bereits ein pydantisches Eingabemodell mit Args_schema definiert habe?

Post by Anonymous »

Ich verwende das Tool von Langchain.from_function () , um ein Tool namens Derivat zu definieren, und ich habe auch ein pydantisches Basemodel (input_structure) unter Verwendung des Args_schema -Parameters bereitgestellt:

Code: Select all

class Input_structure(BaseModel):
expression: str
variable: str

def compute_derivative(expression: str, variable: str) -> str:
...

derivative_tool = Tool.from_function(
func=compute_derivative,
name="derivative",
description="Compute derivative",
args_schema=Input_structure
)
< /code>
Wenn ich dieses Tool wie SO kette bin: < /p>
   result = derivative_tool.invoke(('x^2 + 10', 'x'))
< /code>
Ich erhalte den folgenden Fehler: < /p>
ToolException: Too many arguments to single-input tool derivative.
Consider using StructuredTool instead. Args: ['x^2 + 10', 'x']

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post