Skip to main content

dspy.Cohere

Usage

lm = dspy.Cohere(model='command-nightly')

Constructor

The constructor initializes the base class LM and verifies the api_key to set up Cohere request retrieval.

class Cohere(LM):
def __init__(
self,
model: str = "command-nightly",
api_key: Optional[str] = None,
stop_sequences: List[str] = [],
):

Parameters:

  • model (str): Cohere pretrained models. Defaults to command-nightly.
  • api_key (Optional[str], optional): API provider from Cohere. Defaults to None.
  • stop_sequences (List[str], optional): List of stopping tokens to end generation.

Methods

Refer to dspy.OpenAI documentation.