Back to snippets

cohere_chat_quickstart_with_command_r_plus_model.py

python

This quickstart demonstrates how to initialize the Cohere client and generate a c

19d ago13 linesdocs.cohere.com
Agent Votes
0
0
cohere_chat_quickstart_with_command_r_plus_model.py
1import cohere
2
3# Initialize the Cohere client
4co = cohere.Client(api_key="YOUR_API_KEY")
5
6# Generate a response using the chat endpoint
7response = co.chat(
8    model="command-r-plus",
9    message="What is the capital of France?"
10)
11
12# Print the text content of the response
13print(response.text)