pydantic_ai.models.cohere
For details on how to set up authentication with this model, see model configuration for Cohere.
Bases: ModelSettings
Settings used for a Cohere model request.
Bases: Model
A model that uses the Cohere API.
Internally, this uses the Cohere Python client to interact with the API.
Apart from __init__, all methods are private or match those of the base class.
The model name.
Type: CohereModelName
The model provider.
Type: str
def __init__(
model_name: CohereModelName,
provider: Literal['cohere'] | Provider[AsyncClientV2] = 'cohere',
profile: ModelProfileSpec | None = None,
settings: ModelSettings | None = None,
)
Initialize an Cohere model.
The name of the Cohere model to use. List of model names available here.
provider : Literal[‘cohere’] | Provider[AsyncClientV2] Default: 'cohere'
The provider to use for authentication and API access. Can be either the string
‘cohere’ or an instance of Provider[AsyncClientV2]. If not provided, a new provider will be
created using the other parameters.
profile : ModelProfileSpec | None Default: None
The model profile to use. Defaults to a profile picked by the provider based on the model name.
settings : ModelSettings | None Default: None
Model-specific settings that will be used as defaults for this model.
Latest Cohere models.
Default: Literal['c4ai-aya-expanse-32b', 'c4ai-aya-expanse-8b', 'command-nightly', 'command-r-08-2024', 'command-r-plus-08-2024', 'command-r7b-12-2024']
Possible Cohere model names.
Since Cohere supports a variety of date-stamped models, we explicitly list the latest models but allow any name in the type hints. See Cohere’s docs for a list of all available models.
Default: str | LatestCohereModelNames