Client Referencellms
semantic_router.llms.cohere
CohereLLM Objects
class CohereLLM(BaseLLM)LLM for Cohere. Requires a Cohere API key from https://dashboard.cohere.com/api-keys.
This class provides functionality to interact with the Cohere API for generating text responses. It extends the BaseLLM class and implements the call method to generate text responses.
__init__
def __init__(name: Optional[str] = None, cohere_api_key: Optional[str] = None)Initialize the CohereLLM.
Arguments:
name(Optional[str]): The name of the Cohere model to use can also be set via the COHERE_CHAT_MODEL_NAME environment variable.cohere_api_key(Optional[str]): The API key for the Cohere client. Can also be set via the COHERE_API_KEY environment variable.
__call__
def __call__(messages: List[Message]) -> strCall the Cohere client.
Arguments:
messages(List[Message]): The messages to pass to the Cohere client.
Returns:
str: The response from the Cohere client.