Skip to main content

2 docs tagged with "pydantic"

View all tags

Custom Tools

The @tool decorator turns a typed, documented function into something a model can call:

Structured Output

withstructuredoutput wraps a chat model so it returns a validated Pydantic object instead of prose you then have to parse. The provider enforces the schema at generation time (constrained decoding or native tool-calling), which is far more reliable than parsing free-form output after the fact.