How to manipulate args_schema for LangChain's StructuredTool?

33 views Asked by At

I'm trying to alter the args_schema of a StructuredTool in Langchain. I have a dynamic args_schema depending on the tool to use, but I want to remove an attribute from the args_schema if it exists. Imagine the args_schema looks as follows:

class Model(BaseModel):
  attribute1: str
  attribute2: str

I'd like to modify the tool's args_schema to exclude attribute2 if it exists, but keep the overall schema otherwise, and the tool's functionality. How can this be done in Langchain?

0

There are 0 answers