Text generation - quickstart
Cohere’s Command family of LLMs are available via the Chat endpoint. This endpoint enables you to build generative AI applications and facilitates a conversational interface for building chatbots.
This quickstart guide shows you how to perform text generation with the Chat endpoint.
Setup
First, install the Cohere Python SDK with the following command.
Next, import the library and create a client.
Cohere Platform
Private Deployment
Bedrock
SageMaker
Azure AI
Basic Text Generation
To perform a basic text generation, call the Chat endpoint by passing the messages
parameter containing the user
message.
Cohere Platform
Private Deployment
Bedrock
SageMaker
Azure AI
State Management
To maintain the state of a conversation, such as for building chatbots, append a sequence of user
and assistant
messages to the messages
list. You can also include a system
message at the start of the list to set the context of the conversation.