| 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' |
Model wrapper that returns outputs formatted to match the given schema.
Given schema can be a Pydantic class or a dict.
The method for steering model generation, one of:
'function_calling' or 'tool_calling':
Uses Cohere's tool-calling (formerly called function calling)
API: https://docs.cohere.com/v2/docs/tool-use
'json_schema':
Uses Cohere's Structured Output API: https://docs.cohere.com/docs/structured-outputs
Allows the user to pass a json schema (or pydantic) to the model for structured output.
This is the default method.
Supported for 'command-a-03-2025' and later models.
'json_mode':
Uses Cohere's Structured Output API: https://docs.cohere.com/docs/structured-outputs
Supported for 'command-a-03-2025' and later models.