Formatron v0.4.9
Formatron empowers everyone to control the output format of language models with minimal overhead.
Loading...
Searching...
No Matches
formatron.schemas.pydantic Namespace Reference

A module that implements the Schema interface using pydantic. More...

Classes

class  ClassSchema
 A wrapper for pydantic BaseModel that implements the Schema interface. More...
 
class  FieldInfo
 A wrapper for pydantic FieldInfo. More...
 

Functions

CallableT callable_schema (CallableT func, *, ConfigDict config=None, bool validate_return=False)
 A decorator that wraps pydantic's validate_call.
 

Variables

 CallableT = typing.TypeVar('CallableT', bound=typing.Callable)
 

Detailed Description

A module that implements the Schema interface using pydantic.

Function Documentation

◆ callable_schema()

CallableT formatron.schemas.pydantic.callable_schema ( CallableT func,
* ,
ConfigDict config = None,
bool validate_return = False )

A decorator that wraps pydantic's validate_call.

The decorated callable also implements the Schema interface.

Parameters
funcThe function to decorate.
configThe pydantic configuration of validate_call.
validate_returnWhether to validate the return value.
Returns
The decorated callable.

Definition at line 123 of file pydantic.py.

Variable Documentation

◆ CallableT

formatron.schemas.pydantic.CallableT = typing.TypeVar('CallableT', bound=typing.Callable)

Definition at line 109 of file pydantic.py.