Leverage Cohere’s powerful command models and more.

Cohere has a wide range of models and is really good for fine-tuning. See their library of models here.

We recommend experimenting to find the best-suited model for your use-case. Here are some general recommendations:

  • command model is good for most basic use-cases.
  • command-light model is good for smaller tasks and faster inference.
  • command-r7b-12-2024 model is good with RAG tasks, complex reasoning and multi-step tasks.

Cohere also supports fine-tuning models. Here is a guide on how to do it.

Cohere has tier-based rate limits. See the docs for more information.

Authentication

Set your CO_API_KEY environment variable. Get your key from here.

Example

Use Cohere with your Agent:

View more examples here.

Params

ParameterTypeDefaultDescription
idstr"command-r-plus"The specific model ID used for generating responses.
namestr"cohere"The name identifier for the agent.
providerstr"Cohere"The provider of the model.
temperatureOptional[float]NoneThe sampling temperature to use, between 0 and 2. Higher values like 0.8 make the output more random, while lower values like 0.2 make it more focused and deterministic.
max_tokensOptional[int]NoneThe maximum number of tokens to generate in the response.
top_kOptional[int]NoneThe number of highest probability vocabulary tokens to keep for top-k-filtering.
top_pOptional[float]NoneNucleus sampling parameter. The model considers the results of the tokens with top_p probability mass.
frequency_penaltyOptional[float]NoneNumber between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
presence_penaltyOptional[float]NoneNumber between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
request_paramsOptional[Dict[str, Any]]NoneAdditional parameters to include in the request.
add_chat_historyboolFalseWhether to add chat history to the Cohere messages instead of using the conversation_id.
api_keyOptional[str]NoneThe API key for authenticating requests to the Cohere service.
client_paramsOptional[Dict[str, Any]]NoneAdditional parameters for client configuration.
cohere_clientOptional[CohereClient]NoneA pre-configured instance of the Cohere client.
structured_outputsboolFalseWhether to use structured outputs with this Model.
supports_structured_outputsboolTrueWhether the Model supports structured outputs.
add_images_to_message_contentboolTrueWhether to add images to the message content.
override_system_roleboolTrueWhether to override the system role.
system_message_rolestr"system"The role to map the system message to.

Cohere is a subclass of the Model class and has access to the same params.