haive.core.models.llm.providers.cohereΒΆ
Cohere Provider Module.
This module implements the Cohere language model provider for the Haive framework, supporting Cohereβs Command models with advanced generation and reasoning capabilities.
The provider handles API key management, model configuration, and safe imports of the langchain-cohere package dependencies.
Examples
Basic usage:
from haive.core.models.llm.providers.cohere import CohereProvider
provider = CohereProvider(
model="command-r-plus",
temperature=0.7,
max_tokens=1000
)
llm = provider.instantiate()
With custom parameters:
provider = CohereProvider(
model="command-r",
temperature=0.1,
k=40,
p=0.9,
frequency_penalty=0.1
)
|
Cohere language model provider configuration. |
ClassesΒΆ
Cohere language model provider configuration. |
Module ContentsΒΆ
- class haive.core.models.llm.providers.cohere.CohereProvider(/, **data)[source]ΒΆ
Bases:
haive.core.models.llm.providers.base.BaseLLMProvider
Cohere language model provider configuration.
This provider supports Cohereβs Command models including Command R+, Command R, and other models optimized for reasoning, generation, and multilingual tasks.
- Parameters:
data (Any)
requests_per_second (float | None)
tokens_per_second (int | None)
tokens_per_minute (int | None)
max_retries (int)
retry_delay (float)
check_every_n_seconds (float | None)
burst_size (int | None)
provider (LLMProvider)
model (str | None)
name (str | None)
api_key (SecretStr)
cache_enabled (bool)
cache_ttl (int | None)
debug (bool)
temperature (float | None)
max_tokens (int | None)
k (int | None)
p (float | None)
frequency_penalty (float | None)
presence_penalty (float | None)
- providerΒΆ
Always LLMProvider.COHERE
- Type:
Examples
High-performance reasoning:
provider = CohereProvider( model="command-r-plus", temperature=0.3, max_tokens=2000, k=40 )
Creative writing:
provider = CohereProvider( model="command-r", temperature=0.9, p=0.95, frequency_penalty=0.2 )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.