response_format
parameter. This ensures the modelβs output matches your expected structureγ
Lets create a simple agent that returns a Joke with Structured Response
BaseModel
MathToolkit
and SearchToolkit
to give the model calculation and search capabilitiesChatAgent
during initializationCalculationResult
Pydantic model with three fieldsCalculationResult
schemagenerate_recipe
function manually constructs a prompt that asks for JSON