Skip to content

Commit

Permalink
Update fern/pages/v2/text-generation/chat-api.mdx
Browse files Browse the repository at this point in the history
Co-authored-by: Meor Amer <[email protected]>
Signed-off-by: billytrend-cohere <[email protected]>
  • Loading branch information
billytrend-cohere and mrmer1 authored Sep 26, 2024
1 parent 8d2eeb3 commit 71dcb69
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions fern/pages/v2/text-generation/chat-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,26 @@ public class ChatPost {
}
```
```typescript TYPESCRIPT
const { CohereClient } = require('cohere-ai');
const { CohereClientV2 } = require('cohere-ai');

const cohere = new CohereClient({
token: '<YOUR API KEY>',
const cohere = new CohereClientV2({
token: '<<apiKey>>',
});

(async () => {
const response = await cohere.chat({
message: 'Write a title for a blog post about API design. Only output the title text.',
model: 'command-r-plus',
messages: [
{
role: 'user',
content: 'hello world!',
},
],
});

console.log(response.text)
console.log(response);
})();

```
</CodeBlocks>

Expand Down

0 comments on commit 71dcb69

Please sign in to comment.