with_structured_output(
self,
schema: _DictOrPydanticClass | None = None,
*,
method: Literal['function_calling', | Name | Type | Description |
|---|---|---|
schema | _DictOrPydanticClass | None | Default: NoneThe output schema. Can be passed in as:
If See |
method | Literal['function_calling', 'json_mode', 'json_schema'] | Default: 'function_calling'The method for steering model generation, one of:
|
include_raw | bool | Default: FalseIf If an error occurs during model output parsing it will be raised. If If an error occurs during output parsing it will be caught and returned as well. The final output is always a |
strict | bool | None | Default: None |
kwargs | Any | Default: {} |
Model wrapper that returns outputs formatted to match the given schema.
Whether to enable strict schema adherence when generating the function
call. When set to True, DeepSeek will use the beta API endpoint
(https://api.deepseek.com/beta) for strict schema validation.
This ensures model outputs exactly match the defined schema.
DeepSeek's strict mode requires all object properties to be marked as required in the schema.
Additional keyword args aren't supported.