Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat models code samples #344

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ Install the SDK, if you haven't already.
Then, set up the Cohere client.

```python PYTHON
import cohere
import cohere

co = cohere.ClientV2(api_key="<YOUR API KEY>")
```

Expand All @@ -66,8 +67,8 @@ message = "Write an introductory paragraph for a blog post about language models
### Generate text

```python PYTHON
response = co.chat(model="command",
messages=[{"role" : "user", "content" : message}]
response = co.chat(
model="command", messages=[{"role": "user", "content": message}]
)

intro_paragraph = response.message.content[0].text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ The model has been trained to respond in the language of the user. Here's an exa

```python PYTHON
import cohere

co = cohere.ClientV2("<YOUR API KEY>")

co.chat(
model="command-r-plus-08-2024",
messages=[
{
"role" : "user",
"content" : "Écris une description de produit pour une voiture électrique en 50 à 75 mots"
}
]
"role": "user",
"content": "Écris une description de produit pour une voiture électrique en 50 à 75 mots",
}
],
)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@ The model has been trained to respond in the language of the user. Here's an exa

```python PYTHON
import cohere

co = cohere.ClientV2(api_key="<YOUR API KEY>")

res = co.chat(
model="command-r-plus-08-2024",
messages=[
model="command-r-plus-08-2024",
messages=[
{
"role" : "user",
"content" : "Écris une description de produit pour une voiture électrique en 50 à 75 mots"
"role": "user",
"content": "Écris une description de produit pour une voiture électrique en 50 à 75 mots",
}
]
],
)

print(res)
Expand Down
Loading