Model wrapper that returns outputs formatted to match the given schema.
with_structured_output(
self,
schema: dict | type[BaseModel] | None = None,
*,
method: Literal['function_calling', 'json_schema'] = 'function_calling',
include_raw: bool = False,
strict: bool | None = None,
**kwargs: Any = {}
) -> Runnable[LanguageModelInput, dict | BaseModel]| Name | Type | Description |
|---|---|---|
schema | dict | type[BaseModel] | None | Default: NoneThe output schema as a Pydantic class, TypedDict, JSON Schema, or OpenAI function schema. |
method | Literal['function_calling', 'json_schema'] | Default: 'function_calling'The method for steering model generation. |
include_raw | bool | Default: FalseIf |
strict | bool | None | Default: NoneIf If |
**kwargs | Any | Default: {}Any additional parameters. |