Model wrapper that returns outputs formatted to match the given schema.
Given schema can be a Pydantic class or a dict.
with_structured_output(
self,
schema: Union[Dict, Type[BaseModel]],
method: Literal['function_calling', 'tool_calling', 'json_mode', 'json_schema'] = 'json_schema',
**kwargs: Any = {}
) -> Runnable[LanguageModelInput, Union[Dict, BaseModel]]| Name | Type | Description |
|---|---|---|
schema* | Union[Dict, Type[BaseModel]] | The output schema as a |
method | Literal['function_calling', 'tool_calling', 'json_mode', 'json_schema'] | Default: 'json_schema'The method for steering model generation, one of:
|