Find answers from the community

Updated 3 months ago

Hi all, I'm creating my own BaseToolSpec

Hi all, I'm creating my own BaseToolSpec class and I'm wondering if anyone has bumped into the issue where you want to validate user data from the prompt prior to calling a function.

In this way, the agent would first confirm the structure of the data with the user before calling the correct function of the BaseToolSpec
r
v
2 comments
I faced something like this. Here is a suggestion:

  1. Retrieve the Schema using the get_fn_schema_from_fn_name method to get the schema for the function you plan to call. This schema is a Pydantic model that defines the structure and types of data expected by the function.
  1. Share the Schema with the User : The agent can ask the user to fill in / confirm schema
  1. Validate User Data: Before calling the function, validate the user's data against the schema. Pydantic models can be used to parse and validate data structures, ensuring that the data conforms to the expected structure.
thank you so much! looking at this when I'm at my desk
Add a reply
Sign up and join the conversation on Discord