This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b591bb
commit eb058c5
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import MistralClient from '../client.js'; | ||
|
||
const apiKey = process.env.MISTRAL_API_KEY; | ||
|
||
const client = new MistralClient(apiKey); | ||
|
||
const chatResponse = await client.chat( | ||
'mistral-tiny', | ||
[{role: 'user', content: 'What is the best French cheese?'}], | ||
); | ||
|
||
console.log('Chat:', chatResponse); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import MistralClient from '../client.js'; | ||
|
||
const apiKey = process.env.MISTRAL_API_KEY; | ||
|
||
const client = new MistralClient(apiKey); | ||
|
||
const chatStreamResponse = await client.chatStream( | ||
'mistral-tiny', | ||
[{role: 'user', content: 'What is the best French cheese?'}], | ||
); | ||
|
||
for await (const chunk of chatStreamResponse) { | ||
console.log('Chat Stream:', '' + chunk); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import MistralClient from '../client.js'; | ||
|
||
const apiKey = process.env.MISTRAL_API_KEY; | ||
|
||
const client = new MistralClient(apiKey); | ||
|
||
const input = []; | ||
for (let i = 0; i < 10; i++) { | ||
input.push('What is the best French cheese?'); | ||
} | ||
|
||
const embeddingsBatchResponse = await client.embeddings('mistral-embed', input); | ||
|
||
console.log('Embeddings Batch:', embeddingsBatchResponse.data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import MistralClient from '../client.js'; | ||
|
||
const apiKey = process.env.MISTRAL_API_KEY; | ||
|
||
const client = new MistralClient(apiKey); | ||
|
||
const listModelsResponse = await client.listModels(); | ||
|
||
listModelsResponse.data.forEach((model) => { | ||
console.log('Model:', model); | ||
}); |