@mistralai/mistralai 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -7
- package/funcs/audioTranscriptionsStream.d.ts +1 -1
- package/funcs/audioTranscriptionsStream.js +1 -1
- package/funcs/betaAgentsDelete.d.ts +15 -0
- package/funcs/betaAgentsDelete.d.ts.map +1 -0
- package/funcs/betaAgentsDelete.js +121 -0
- package/funcs/betaAgentsDelete.js.map +1 -0
- package/funcs/betaAgentsGet.js +4 -0
- package/funcs/betaAgentsGet.js.map +1 -1
- package/funcs/betaAgentsList.js +5 -0
- package/funcs/betaAgentsList.js.map +1 -1
- package/funcs/betaConversationsDelete.d.ts +18 -0
- package/funcs/betaConversationsDelete.d.ts.map +1 -0
- package/funcs/betaConversationsDelete.js +124 -0
- package/funcs/betaConversationsDelete.js.map +1 -0
- package/funcs/betaConversationsList.js +1 -0
- package/funcs/betaConversationsList.js.map +1 -1
- package/funcs/betaLibrariesDocumentsList.d.ts +1 -1
- package/funcs/betaLibrariesDocumentsList.js +2 -1
- package/funcs/betaLibrariesDocumentsList.js.map +1 -1
- package/funcs/filesList.js +1 -0
- package/funcs/filesList.js.map +1 -1
- package/funcs/modelsList.d.ts +1 -2
- package/funcs/modelsList.d.ts.map +1 -1
- package/funcs/modelsList.js +2 -6
- package/funcs/modelsList.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/agent.d.ts +12 -0
- package/models/components/agent.d.ts.map +1 -1
- package/models/components/agent.js +10 -0
- package/models/components/agent.js.map +1 -1
- package/models/components/agentconversation.d.ts +11 -0
- package/models/components/agentconversation.d.ts.map +1 -1
- package/models/components/agentconversation.js +6 -0
- package/models/components/agentconversation.js.map +1 -1
- package/models/components/agentcreationrequest.d.ts +6 -0
- package/models/components/agentcreationrequest.d.ts.map +1 -1
- package/models/components/agentcreationrequest.js +2 -0
- package/models/components/agentcreationrequest.js.map +1 -1
- package/models/components/agentscompletionrequest.d.ts +14 -2
- package/models/components/agentscompletionrequest.d.ts.map +1 -1
- package/models/components/agentscompletionrequest.js +2 -0
- package/models/components/agentscompletionrequest.js.map +1 -1
- package/models/components/agentscompletionstreamrequest.d.ts +14 -2
- package/models/components/agentscompletionstreamrequest.d.ts.map +1 -1
- package/models/components/agentscompletionstreamrequest.js +2 -0
- package/models/components/agentscompletionstreamrequest.js.map +1 -1
- package/models/components/agentupdaterequest.d.ts +8 -0
- package/models/components/agentupdaterequest.d.ts.map +1 -1
- package/models/components/agentupdaterequest.js +6 -0
- package/models/components/agentupdaterequest.js.map +1 -1
- package/models/components/audiotranscriptionrequest.d.ts +3 -0
- package/models/components/audiotranscriptionrequest.d.ts.map +1 -1
- package/models/components/audiotranscriptionrequest.js.map +1 -1
- package/models/components/batchjobin.d.ts +15 -0
- package/models/components/batchjobin.d.ts.map +1 -1
- package/models/components/batchjobin.js.map +1 -1
- package/models/components/chatcompletionrequest.d.ts +26 -2
- package/models/components/chatcompletionrequest.d.ts.map +1 -1
- package/models/components/chatcompletionrequest.js +2 -0
- package/models/components/chatcompletionrequest.js.map +1 -1
- package/models/components/chatcompletionstreamrequest.d.ts +26 -2
- package/models/components/chatcompletionstreamrequest.d.ts.map +1 -1
- package/models/components/chatcompletionstreamrequest.js +2 -0
- package/models/components/chatcompletionstreamrequest.js.map +1 -1
- package/models/components/conversationrequest.d.ts +13 -2
- package/models/components/conversationrequest.d.ts.map +1 -1
- package/models/components/conversationrequest.js +16 -6
- package/models/components/conversationrequest.js.map +1 -1
- package/models/components/conversationrestartrequest.d.ts +14 -0
- package/models/components/conversationrestartrequest.d.ts.map +1 -1
- package/models/components/conversationrestartrequest.js +6 -0
- package/models/components/conversationrestartrequest.js.map +1 -1
- package/models/components/conversationrestartstreamrequest.d.ts +14 -0
- package/models/components/conversationrestartstreamrequest.d.ts.map +1 -1
- package/models/components/conversationrestartstreamrequest.js +6 -0
- package/models/components/conversationrestartstreamrequest.js.map +1 -1
- package/models/components/conversationstreamrequest.d.ts +13 -2
- package/models/components/conversationstreamrequest.d.ts.map +1 -1
- package/models/components/conversationstreamrequest.js +16 -6
- package/models/components/conversationstreamrequest.js.map +1 -1
- package/models/components/documentout.d.ts +18 -10
- package/models/components/documentout.d.ts.map +1 -1
- package/models/components/documentout.js +14 -10
- package/models/components/documentout.js.map +1 -1
- package/models/components/documentupdatein.d.ts +27 -0
- package/models/components/documentupdatein.d.ts.map +1 -1
- package/models/components/documentupdatein.js +66 -1
- package/models/components/documentupdatein.js.map +1 -1
- package/models/components/embeddingrequest.d.ts +4 -4
- package/models/components/fimcompletionrequest.d.ts +7 -5
- package/models/components/fimcompletionrequest.d.ts.map +1 -1
- package/models/components/fimcompletionrequest.js +2 -0
- package/models/components/fimcompletionrequest.js.map +1 -1
- package/models/components/fimcompletionstreamrequest.d.ts +7 -5
- package/models/components/fimcompletionstreamrequest.d.ts.map +1 -1
- package/models/components/fimcompletionstreamrequest.js +2 -0
- package/models/components/fimcompletionstreamrequest.js.map +1 -1
- package/models/components/index.d.ts +2 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +2 -0
- package/models/components/index.js.map +1 -1
- package/models/components/libraryout.d.ts +7 -4
- package/models/components/libraryout.d.ts.map +1 -1
- package/models/components/libraryout.js +6 -6
- package/models/components/libraryout.js.map +1 -1
- package/models/components/listfilesout.d.ts +2 -2
- package/models/components/listfilesout.d.ts.map +1 -1
- package/models/components/listfilesout.js +2 -2
- package/models/components/listfilesout.js.map +1 -1
- package/models/components/modelcapabilities.d.ts +8 -2
- package/models/components/modelcapabilities.d.ts.map +1 -1
- package/models/components/modelcapabilities.js +12 -6
- package/models/components/modelcapabilities.js.map +1 -1
- package/models/components/modelconversation.d.ts +9 -0
- package/models/components/modelconversation.d.ts.map +1 -1
- package/models/components/modelconversation.js +2 -0
- package/models/components/modelconversation.js.map +1 -1
- package/models/components/ocrpageobject.d.ts +21 -0
- package/models/components/ocrpageobject.d.ts.map +1 -1
- package/models/components/ocrpageobject.js +9 -0
- package/models/components/ocrpageobject.js.map +1 -1
- package/models/components/ocrrequest.d.ts +32 -0
- package/models/components/ocrrequest.d.ts.map +1 -1
- package/models/components/ocrrequest.js +33 -1
- package/models/components/ocrrequest.js.map +1 -1
- package/models/components/ocrtableobject.d.ts +74 -0
- package/models/components/ocrtableobject.d.ts.map +1 -0
- package/models/components/ocrtableobject.js +96 -0
- package/models/components/ocrtableobject.js.map +1 -0
- package/models/components/prediction.d.ts +3 -0
- package/models/components/prediction.d.ts.map +1 -1
- package/models/components/prediction.js.map +1 -1
- package/models/components/requestsource.d.ts +31 -0
- package/models/components/requestsource.d.ts.map +1 -0
- package/models/components/requestsource.js +61 -0
- package/models/components/requestsource.js.map +1 -0
- package/models/components/responseformat.d.ts +3 -3
- package/models/components/responseformat.d.ts.map +1 -1
- package/models/components/responseformats.d.ts +0 -6
- package/models/components/responseformats.d.ts.map +1 -1
- package/models/components/responseformats.js +0 -3
- package/models/components/responseformats.js.map +1 -1
- package/models/components/sharingdelete.d.ts +2 -2
- package/models/components/sharingdelete.d.ts.map +1 -1
- package/models/components/sharingdelete.js +2 -2
- package/models/components/sharingdelete.js.map +1 -1
- package/models/components/sharingin.d.ts +2 -2
- package/models/components/sharingin.d.ts.map +1 -1
- package/models/components/sharingin.js +2 -2
- package/models/components/sharingin.js.map +1 -1
- package/models/components/sharingout.d.ts +2 -2
- package/models/components/sharingout.d.ts.map +1 -1
- package/models/components/sharingout.js +2 -2
- package/models/components/sharingout.js.map +1 -1
- package/models/components/toolexecutiondeltaevent.d.ts +23 -2
- package/models/components/toolexecutiondeltaevent.d.ts.map +1 -1
- package/models/components/toolexecutiondeltaevent.js +26 -3
- package/models/components/toolexecutiondeltaevent.js.map +1 -1
- package/models/components/toolexecutiondoneevent.d.ts +23 -2
- package/models/components/toolexecutiondoneevent.d.ts.map +1 -1
- package/models/components/toolexecutiondoneevent.js +26 -3
- package/models/components/toolexecutiondoneevent.js.map +1 -1
- package/models/components/toolexecutionentry.d.ts +23 -2
- package/models/components/toolexecutionentry.d.ts.map +1 -1
- package/models/components/toolexecutionentry.js +27 -3
- package/models/components/toolexecutionentry.js.map +1 -1
- package/models/components/toolexecutionstartedevent.d.ts +23 -2
- package/models/components/toolexecutionstartedevent.d.ts.map +1 -1
- package/models/components/toolexecutionstartedevent.js +26 -3
- package/models/components/toolexecutionstartedevent.js.map +1 -1
- package/models/operations/agentsapiv1agentsdelete.d.ts +29 -0
- package/models/operations/agentsapiv1agentsdelete.d.ts.map +1 -0
- package/models/operations/agentsapiv1agentsdelete.js +78 -0
- package/models/operations/agentsapiv1agentsdelete.js.map +1 -0
- package/models/operations/agentsapiv1agentsget.d.ts +2 -0
- package/models/operations/agentsapiv1agentsget.d.ts.map +1 -1
- package/models/operations/agentsapiv1agentsget.js +4 -0
- package/models/operations/agentsapiv1agentsget.js.map +1 -1
- package/models/operations/agentsapiv1agentslist.d.ts +15 -0
- package/models/operations/agentsapiv1agentslist.d.ts.map +1 -1
- package/models/operations/agentsapiv1agentslist.js +15 -0
- package/models/operations/agentsapiv1agentslist.js.map +1 -1
- package/models/operations/agentsapiv1conversationsdelete.d.ts +32 -0
- package/models/operations/agentsapiv1conversationsdelete.d.ts.map +1 -0
- package/models/operations/agentsapiv1conversationsdelete.js +78 -0
- package/models/operations/agentsapiv1conversationsdelete.js.map +1 -0
- package/models/operations/agentsapiv1conversationslist.d.ts +6 -0
- package/models/operations/agentsapiv1conversationslist.d.ts.map +1 -1
- package/models/operations/agentsapiv1conversationslist.js +2 -0
- package/models/operations/agentsapiv1conversationslist.js.map +1 -1
- package/models/operations/filesapirouteslistfiles.d.ts +2 -0
- package/models/operations/filesapirouteslistfiles.d.ts.map +1 -1
- package/models/operations/filesapirouteslistfiles.js +4 -0
- package/models/operations/filesapirouteslistfiles.js.map +1 -1
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/librariesdocumentslistv1.d.ts +2 -0
- package/models/operations/librariesdocumentslistv1.d.ts.map +1 -1
- package/models/operations/librariesdocumentslistv1.js +4 -0
- package/models/operations/librariesdocumentslistv1.js.map +1 -1
- package/package.json +1 -1
- package/sdk/conversations.d.ts +7 -0
- package/sdk/conversations.d.ts.map +1 -1
- package/sdk/conversations.js +10 -0
- package/sdk/conversations.js.map +1 -1
- package/sdk/documents.d.ts +1 -1
- package/sdk/documents.js +1 -1
- package/sdk/mistralagents.d.ts +4 -0
- package/sdk/mistralagents.d.ts.map +1 -1
- package/sdk/mistralagents.js +7 -0
- package/sdk/mistralagents.js.map +1 -1
- package/sdk/transcriptions.d.ts +1 -1
- package/sdk/transcriptions.js +1 -1
- package/src/funcs/audioTranscriptionsStream.ts +1 -1
- package/src/funcs/betaAgentsDelete.ts +174 -0
- package/src/funcs/betaAgentsGet.ts +6 -1
- package/src/funcs/betaAgentsList.ts +5 -0
- package/src/funcs/betaConversationsDelete.ts +179 -0
- package/src/funcs/betaConversationsList.ts +1 -0
- package/src/funcs/betaLibrariesDocumentsList.ts +2 -1
- package/src/funcs/filesList.ts +1 -0
- package/src/funcs/modelsList.ts +2 -11
- package/src/lib/config.ts +2 -2
- package/src/models/components/agent.ts +18 -0
- package/src/models/components/agentconversation.ts +13 -0
- package/src/models/components/agentcreationrequest.ts +4 -0
- package/src/models/components/agentscompletionrequest.ts +12 -2
- package/src/models/components/agentscompletionstreamrequest.ts +12 -2
- package/src/models/components/agentupdaterequest.ts +10 -0
- package/src/models/components/audiotranscriptionrequest.ts +3 -0
- package/src/models/components/batchjobin.ts +15 -0
- package/src/models/components/chatcompletionrequest.ts +24 -2
- package/src/models/components/chatcompletionstreamrequest.ts +24 -2
- package/src/models/components/conversationrequest.ts +79 -72
- package/src/models/components/conversationrestartrequest.ts +16 -0
- package/src/models/components/conversationrestartstreamrequest.ts +16 -0
- package/src/models/components/conversationstreamrequest.ts +79 -72
- package/src/models/components/documentout.ts +28 -20
- package/src/models/components/documentupdatein.ts +144 -0
- package/src/models/components/embeddingrequest.ts +4 -4
- package/src/models/components/fimcompletionrequest.ts +5 -5
- package/src/models/components/fimcompletionstreamrequest.ts +5 -5
- package/src/models/components/index.ts +2 -0
- package/src/models/components/libraryout.ts +13 -10
- package/src/models/components/listfilesout.ts +4 -4
- package/src/models/components/modelcapabilities.ts +20 -8
- package/src/models/components/modelconversation.ts +7 -0
- package/src/models/components/ocrpageobject.ts +34 -0
- package/src/models/components/ocrrequest.ts +44 -0
- package/src/models/components/ocrtableobject.ts +111 -0
- package/src/models/components/prediction.ts +3 -0
- package/src/models/components/requestsource.ts +34 -0
- package/src/models/components/responseformat.ts +3 -3
- package/src/models/components/responseformats.ts +0 -6
- package/src/models/components/sharingdelete.ts +4 -4
- package/src/models/components/sharingin.ts +4 -4
- package/src/models/components/sharingout.ts +4 -4
- package/src/models/components/toolexecutiondeltaevent.ts +56 -4
- package/src/models/components/toolexecutiondoneevent.ts +54 -4
- package/src/models/components/toolexecutionentry.ts +44 -4
- package/src/models/components/toolexecutionstartedevent.ts +56 -4
- package/src/models/operations/agentsapiv1agentsdelete.ts +77 -0
- package/src/models/operations/agentsapiv1agentsget.ts +6 -0
- package/src/models/operations/agentsapiv1agentslist.ts +25 -0
- package/src/models/operations/agentsapiv1conversationsdelete.ts +83 -0
- package/src/models/operations/agentsapiv1conversationslist.ts +4 -0
- package/src/models/operations/filesapirouteslistfiles.ts +6 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/librariesdocumentslistv1.ts +6 -0
- package/src/sdk/conversations.ts +18 -0
- package/src/sdk/documents.ts +1 -1
- package/src/sdk/mistralagents.ts +15 -0
- package/src/sdk/transcriptions.ts +1 -1
- package/.devcontainer/README.md +0 -35
- package/docs/sdks/accesses/README.md +0 -256
- package/docs/sdks/agents/README.md +0 -189
- package/docs/sdks/audio/README.md +0 -6
- package/docs/sdks/batch/README.md +0 -6
- package/docs/sdks/beta/README.md +0 -6
- package/docs/sdks/chat/README.md +0 -189
- package/docs/sdks/classifiers/README.md +0 -355
- package/docs/sdks/conversations/README.md +0 -835
- package/docs/sdks/documents/README.md +0 -785
- package/docs/sdks/embeddings/README.md +0 -92
- package/docs/sdks/files/README.md +0 -455
- package/docs/sdks/fim/README.md +0 -173
- package/docs/sdks/finetuning/README.md +0 -6
- package/docs/sdks/jobs/README.md +0 -379
- package/docs/sdks/libraries/README.md +0 -380
- package/docs/sdks/mistral/README.md +0 -7
- package/docs/sdks/mistralagents/README.md +0 -386
- package/docs/sdks/mistraljobs/README.md +0 -305
- package/docs/sdks/models/README.md +0 -453
- package/docs/sdks/ocr/README.md +0 -92
- package/docs/sdks/transcriptions/README.md +0 -163
- package/examples/README.md +0 -44
- package/packages/mistralai-azure/FUNCTIONS.md +0 -111
- package/packages/mistralai-azure/LICENSE +0 -201
- package/packages/mistralai-azure/README.md +0 -447
- package/packages/mistralai-azure/RUNTIMES.md +0 -48
- package/packages/mistralai-azure/docs/sdks/chat/README.md +0 -114
- package/packages/mistralai-azure/docs/sdks/mistralazure/README.md +0 -9
- package/packages/mistralai-gcp/FUNCTIONS.md +0 -112
- package/packages/mistralai-gcp/LICENSE +0 -201
- package/packages/mistralai-gcp/README.md +0 -455
- package/packages/mistralai-gcp/RUNTIMES.md +0 -48
- package/packages/mistralai-gcp/docs/sdks/chat/README.md +0 -115
- package/packages/mistralai-gcp/docs/sdks/fim/README.md +0 -58
- package/packages/mistralai-gcp/docs/sdks/mistralgcp/README.md +0 -9
- package/src/extra/README.md +0 -52
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
# Mistral on GCP Typescript Client
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<!-- Start SDK Installation [installation] -->
|
|
6
|
-
## SDK Installation
|
|
7
|
-
|
|
8
|
-
### NPM
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npm add @mistralai/mistralai-gcp
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### PNPM
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
pnpm add @mistralai/mistralai-gcp
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Bun
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
bun add @mistralai/mistralai-gcp
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Yarn
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
yarn add @mistralai/mistralai-gcp zod
|
|
30
|
-
|
|
31
|
-
# Note that Yarn does not install peer dependencies automatically. You will need
|
|
32
|
-
# to install zod as shown above.
|
|
33
|
-
```
|
|
34
|
-
<!-- End SDK Installation [installation] -->
|
|
35
|
-
|
|
36
|
-
<!-- Start Requirements [requirements] -->
|
|
37
|
-
## Requirements
|
|
38
|
-
|
|
39
|
-
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
|
40
|
-
<!-- End Requirements [requirements] -->
|
|
41
|
-
|
|
42
|
-
<!-- Start SDK Example Usage [usage] -->
|
|
43
|
-
## SDK Example Usage
|
|
44
|
-
|
|
45
|
-
### Create Chat Completions
|
|
46
|
-
|
|
47
|
-
This example shows how to create chat completions.
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const sdk = new MistralGoogleCloud({
|
|
54
|
-
region: "europe-west4",
|
|
55
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
async function run() {
|
|
59
|
-
const result = await MistralGoogleCloud.chat.complete({
|
|
60
|
-
model: "mistral-small-latest",
|
|
61
|
-
messages: [
|
|
62
|
-
{
|
|
63
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
64
|
-
role: "user",
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// Handle the result
|
|
70
|
-
console.log(result);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
run();
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
<!-- End SDK Example Usage [usage] -->
|
|
77
|
-
|
|
78
|
-
<!-- Start Available Resources and Operations [operations] -->
|
|
79
|
-
## Available Resources and Operations
|
|
80
|
-
|
|
81
|
-
### [chat](docs/sdks/chat/README.md)
|
|
82
|
-
|
|
83
|
-
* [stream](docs/sdks/chat/README.md#stream) - Stream chat completion
|
|
84
|
-
* [create](docs/sdks/chat/README.md#create) - Chat Completion
|
|
85
|
-
|
|
86
|
-
### [fim](docs/sdks/fim/README.md)
|
|
87
|
-
|
|
88
|
-
* [create](docs/sdks/fim/README.md#create) - Fim Completion
|
|
89
|
-
<!-- End Available Resources and Operations [operations] -->
|
|
90
|
-
|
|
91
|
-
<!-- Start Server-sent event streaming [eventstream] -->
|
|
92
|
-
## Server-sent event streaming
|
|
93
|
-
|
|
94
|
-
[Server-sent events][mdn-sse] are used to stream content from certain
|
|
95
|
-
operations. These operations will expose the stream as an async iterable that
|
|
96
|
-
can be consumed using a [`for await...of`][mdn-for-await-of] loop. The loop will
|
|
97
|
-
terminate when the server no longer has any events to send and closes the
|
|
98
|
-
underlying connection.
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
102
|
-
|
|
103
|
-
const sdk = new MistralGoogleCloud({
|
|
104
|
-
region: "europe-west4",
|
|
105
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
async function run() {
|
|
109
|
-
const result = await MistralGoogleCloud.chat.stream({
|
|
110
|
-
model: "mistral-small-latest",
|
|
111
|
-
messages: [
|
|
112
|
-
{
|
|
113
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
114
|
-
role: "user",
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
for await (const event of result) {
|
|
120
|
-
// Handle the event
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
run();
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
[mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
|
|
129
|
-
[mdn-for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
130
|
-
<!-- End Server-sent event streaming [eventstream] -->
|
|
131
|
-
|
|
132
|
-
<!-- Start Retries [retries] -->
|
|
133
|
-
## Retries
|
|
134
|
-
|
|
135
|
-
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
|
136
|
-
|
|
137
|
-
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
|
|
138
|
-
```typescript
|
|
139
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
140
|
-
|
|
141
|
-
const sdk = new MistralGoogleCloud({
|
|
142
|
-
region: "europe-west4",
|
|
143
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
async function run() {
|
|
147
|
-
const result = await MistralGoogleCloud.chat.stream(
|
|
148
|
-
{
|
|
149
|
-
model: "mistral-small-latest",
|
|
150
|
-
messages: [
|
|
151
|
-
{
|
|
152
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
153
|
-
role: "user",
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
retries: {
|
|
159
|
-
strategy: "backoff",
|
|
160
|
-
backoff: {
|
|
161
|
-
initialInterval: 1,
|
|
162
|
-
maxInterval: 50,
|
|
163
|
-
exponent: 1.1,
|
|
164
|
-
maxElapsedTime: 100,
|
|
165
|
-
},
|
|
166
|
-
retryConnectionErrors: false,
|
|
167
|
-
},
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
for await (const event of result) {
|
|
172
|
-
// Handle the event
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
run();
|
|
177
|
-
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
|
|
181
|
-
```typescript
|
|
182
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
183
|
-
|
|
184
|
-
const MistralGoogleCloud = new MistralGoogleCloud({
|
|
185
|
-
retryConfig: {
|
|
186
|
-
strategy: "backoff",
|
|
187
|
-
backoff: {
|
|
188
|
-
initialInterval: 1,
|
|
189
|
-
maxInterval: 50,
|
|
190
|
-
exponent: 1.1,
|
|
191
|
-
maxElapsedTime: 100,
|
|
192
|
-
},
|
|
193
|
-
retryConnectionErrors: false,
|
|
194
|
-
},
|
|
195
|
-
region: "europe-west4",
|
|
196
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
async function run() {
|
|
200
|
-
const result = await MistralGoogleCloud.chat.stream({
|
|
201
|
-
model: "mistral-small-latest",
|
|
202
|
-
messages: [
|
|
203
|
-
{
|
|
204
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
205
|
-
role: "user",
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
for await (const event of result) {
|
|
211
|
-
// Handle the event
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
run();
|
|
216
|
-
|
|
217
|
-
```
|
|
218
|
-
<!-- End Retries [retries] -->
|
|
219
|
-
|
|
220
|
-
<!-- Start Error Handling [errors] -->
|
|
221
|
-
## Error Handling
|
|
222
|
-
|
|
223
|
-
All SDK methods return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.
|
|
224
|
-
|
|
225
|
-
| Error Object | Status Code | Content Type |
|
|
226
|
-
| -------------------------- | ----------- | ---------------- |
|
|
227
|
-
| errors.HTTPValidationError | 422 | application/json |
|
|
228
|
-
| errors.SDKError | 4xx-5xx | */* |
|
|
229
|
-
|
|
230
|
-
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted string since validation errors can list many issues and the plain error string may be difficult read when debugging.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
```typescript
|
|
234
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
235
|
-
import { SDKValidationError } from "@mistralai/mistralai-gcp/models/errors";
|
|
236
|
-
|
|
237
|
-
const MistralGoogleCloud = new MistralGoogleCloud({
|
|
238
|
-
region: "europe-west4",
|
|
239
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
async function run() {
|
|
243
|
-
let result;
|
|
244
|
-
try {
|
|
245
|
-
result = await MistralGoogleCloud.chat.complete({
|
|
246
|
-
model: "mistral-small-latest",
|
|
247
|
-
messages: [
|
|
248
|
-
{
|
|
249
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
250
|
-
role: "user",
|
|
251
|
-
},
|
|
252
|
-
],
|
|
253
|
-
});
|
|
254
|
-
} catch (err) {
|
|
255
|
-
switch (true) {
|
|
256
|
-
case err instanceof SDKValidationError: {
|
|
257
|
-
// Validation errors can be pretty-printed
|
|
258
|
-
console.error(err.pretty());
|
|
259
|
-
// Raw value may also be inspected
|
|
260
|
-
console.error(err.rawValue);
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
case err instanceof errors.HTTPValidationError: {
|
|
264
|
-
console.error(err); // handle exception
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
default: {
|
|
268
|
-
throw err;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Handle the result
|
|
274
|
-
console.log(result);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
run();
|
|
278
|
-
|
|
279
|
-
```
|
|
280
|
-
<!-- End Error Handling [errors] -->
|
|
281
|
-
|
|
282
|
-
<!-- Start Server Selection [server] -->
|
|
283
|
-
## Server Selection
|
|
284
|
-
|
|
285
|
-
### Select Server by Name
|
|
286
|
-
|
|
287
|
-
You can override the default server globally by passing a server name to the `server` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
|
|
288
|
-
|
|
289
|
-
| Name | Server | Variables |
|
|
290
|
-
| ------ | ------------------------ | --------- |
|
|
291
|
-
| `prod` | `https://api.mistral.ai` | None |
|
|
292
|
-
|
|
293
|
-
```typescript
|
|
294
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
295
|
-
|
|
296
|
-
const MistralGoogleCloud = new MistralGoogleCloud({
|
|
297
|
-
server: "prod",
|
|
298
|
-
region: "europe-west4",
|
|
299
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
async function run() {
|
|
303
|
-
const result = await MistralGoogleCloud.chat.stream({
|
|
304
|
-
model: "mistral-small-latest",
|
|
305
|
-
messages: [
|
|
306
|
-
{
|
|
307
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
308
|
-
role: "user",
|
|
309
|
-
},
|
|
310
|
-
],
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
for await (const event of result) {
|
|
314
|
-
// Handle the event
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
run();
|
|
319
|
-
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
### Override Server URL Per-Client
|
|
324
|
-
|
|
325
|
-
The default server can also be overridden globally by passing a URL to the `serverURL` optional parameter when initializing the SDK client instance. For example:
|
|
326
|
-
|
|
327
|
-
```typescript
|
|
328
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
329
|
-
|
|
330
|
-
const MistralGoogleCloud = new MistralGoogleCloud({
|
|
331
|
-
serverURL: "https://api.mistral.ai",
|
|
332
|
-
region: "europe-west4",
|
|
333
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
async function run() {
|
|
337
|
-
const result = await MistralGoogleCloud.chat.stream({
|
|
338
|
-
model: "mistral-small-latest",
|
|
339
|
-
messages: [
|
|
340
|
-
{
|
|
341
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
342
|
-
role: "user",
|
|
343
|
-
},
|
|
344
|
-
],
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
for await (const event of result) {
|
|
348
|
-
// Handle the event
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
run();
|
|
353
|
-
|
|
354
|
-
```
|
|
355
|
-
<!-- End Server Selection [server] -->
|
|
356
|
-
|
|
357
|
-
<!-- Start Custom HTTP Client [http-client] -->
|
|
358
|
-
## Custom HTTP Client
|
|
359
|
-
|
|
360
|
-
The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
|
|
361
|
-
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
|
|
362
|
-
client is a thin wrapper around `fetch` and provides the ability to attach hooks
|
|
363
|
-
around the request lifecycle that can be used to modify the request or handle
|
|
364
|
-
errors and response.
|
|
365
|
-
|
|
366
|
-
The `HTTPClient` constructor takes an optional `fetcher` argument that can be
|
|
367
|
-
used to integrate a third-party HTTP client or when writing tests to mock out
|
|
368
|
-
the HTTP client and feed in fixtures.
|
|
369
|
-
|
|
370
|
-
The following example shows how to use the `"beforeRequest"` hook to to add a
|
|
371
|
-
custom header and a timeout to requests and how to use the `"requestError"` hook
|
|
372
|
-
to log errors:
|
|
373
|
-
|
|
374
|
-
```typescript
|
|
375
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
376
|
-
import { HTTPClient } from "@mistralai/mistralai-gcp/lib/http";
|
|
377
|
-
|
|
378
|
-
const httpClient = new HTTPClient({
|
|
379
|
-
// fetcher takes a function that has the same signature as native `fetch`.
|
|
380
|
-
fetcher: (request) => {
|
|
381
|
-
return fetch(request);
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
httpClient.addHook("beforeRequest", (request) => {
|
|
386
|
-
const nextRequest = new Request(request, {
|
|
387
|
-
signal: request.signal || AbortSignal.timeout(5000)
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
nextRequest.headers.set("x-custom-header", "custom value");
|
|
391
|
-
|
|
392
|
-
return nextRequest;
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
httpClient.addHook("requestError", (error, request) => {
|
|
396
|
-
console.group("Request Error");
|
|
397
|
-
console.log("Reason:", `${error}`);
|
|
398
|
-
console.log("Endpoint:", `${request.method} ${request.url}`);
|
|
399
|
-
console.groupEnd();
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
const sdk = new MistralGoogleCloud({ httpClient });
|
|
403
|
-
```
|
|
404
|
-
<!-- End Custom HTTP Client [http-client] -->
|
|
405
|
-
|
|
406
|
-
<!-- Start Authentication [security] -->
|
|
407
|
-
## Authentication
|
|
408
|
-
|
|
409
|
-
### Per-Client Security Schemes
|
|
410
|
-
|
|
411
|
-
This SDK supports the following security scheme globally:
|
|
412
|
-
|
|
413
|
-
| Name | Type | Scheme |
|
|
414
|
-
| -------- | ---- | ----------- |
|
|
415
|
-
| `apiKey` | http | HTTP Bearer |
|
|
416
|
-
|
|
417
|
-
To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
|
|
418
|
-
```typescript
|
|
419
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
420
|
-
|
|
421
|
-
const MistralGoogleCloud = new MistralGoogleCloud({
|
|
422
|
-
region: "europe-west4",
|
|
423
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
async function run() {
|
|
427
|
-
const result = await MistralGoogleCloud.chat.stream({
|
|
428
|
-
model: "mistral-small-latest",
|
|
429
|
-
messages: [
|
|
430
|
-
{
|
|
431
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
432
|
-
role: "user",
|
|
433
|
-
},
|
|
434
|
-
],
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
for await (const event of result) {
|
|
438
|
-
// Handle the event
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
run();
|
|
443
|
-
|
|
444
|
-
```
|
|
445
|
-
<!-- End Authentication [security] -->
|
|
446
|
-
|
|
447
|
-
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
448
|
-
|
|
449
|
-
# Development
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
## Contributions
|
|
453
|
-
|
|
454
|
-
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
|
455
|
-
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# Supported JavaScript runtimes
|
|
2
|
-
|
|
3
|
-
This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
|
|
4
|
-
|
|
5
|
-
* [Web Fetch API][web-fetch]
|
|
6
|
-
* [Web Streams API][web-streams] and in particular `ReadableStream`
|
|
7
|
-
* [Async iterables][async-iter] using `Symbol.asyncIterator`
|
|
8
|
-
|
|
9
|
-
[web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
|
10
|
-
[web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
|
|
11
|
-
[async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
|
|
12
|
-
|
|
13
|
-
Runtime environments that are explicitly supported are:
|
|
14
|
-
|
|
15
|
-
- Evergreen browsers which include: Chrome, Safari, Edge, Firefox
|
|
16
|
-
- Node.js active and maintenance LTS releases
|
|
17
|
-
- Currently, this is v18 and v20
|
|
18
|
-
- Bun v1 and above
|
|
19
|
-
- Deno v1.39
|
|
20
|
-
- Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
|
|
21
|
-
|
|
22
|
-
[deno-file-streaming]: https://github.com/denoland/deno/issues/11018
|
|
23
|
-
|
|
24
|
-
## Recommended TypeScript compiler options
|
|
25
|
-
|
|
26
|
-
The following `tsconfig.json` options are recommended for projects using this
|
|
27
|
-
SDK in order to get static type support for features like async iterables,
|
|
28
|
-
streams and `fetch`-related APIs ([`for await...of`][for-await-of],
|
|
29
|
-
[`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
|
|
30
|
-
so on):
|
|
31
|
-
|
|
32
|
-
[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
33
|
-
[abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
34
|
-
[request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
35
|
-
[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
|
|
36
|
-
|
|
37
|
-
```jsonc
|
|
38
|
-
{
|
|
39
|
-
"compilerOptions": {
|
|
40
|
-
"target": "es2020", // or higher
|
|
41
|
-
"lib": ["es2020", "dom", "dom.iterable"],
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
While `target` can be set to older ECMAScript versions, it may result in extra,
|
|
47
|
-
unnecessary compatibility code being generated if you are not targeting old
|
|
48
|
-
runtimes.
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# Chat
|
|
2
|
-
(*chat*)
|
|
3
|
-
|
|
4
|
-
## Overview
|
|
5
|
-
|
|
6
|
-
Chat Completion API.
|
|
7
|
-
|
|
8
|
-
### Available Operations
|
|
9
|
-
|
|
10
|
-
* [stream](#stream) - Stream chat completion
|
|
11
|
-
* [create](#create) - Chat Completion
|
|
12
|
-
|
|
13
|
-
## stream
|
|
14
|
-
|
|
15
|
-
Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
|
|
16
|
-
|
|
17
|
-
### Example Usage
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
21
|
-
|
|
22
|
-
const MistralGoogleCloud = new MistralGoogleCloud({
|
|
23
|
-
region: "europe-west4",
|
|
24
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
async function run() {
|
|
28
|
-
const result = await MistralGoogleCloud.chat.stream({
|
|
29
|
-
model: "mistral-small-latest",
|
|
30
|
-
messages: [
|
|
31
|
-
{
|
|
32
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
33
|
-
role: "user",
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
for await (const event of result) {
|
|
39
|
-
// Handle the event
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
run();
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Parameters
|
|
47
|
-
|
|
48
|
-
| Parameter | Type | Required | Description |
|
|
49
|
-
| ---------------------- | ------------------------------------------------------------------------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
50
|
-
| `request` | [components.ChatCompletionStreamRequest](../../models/components/chatcompletionstreamrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
51
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
52
|
-
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
53
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Response
|
|
57
|
-
|
|
58
|
-
**Promise\<[EventStream<components.ChatCompletionEvent>](../../models/.md)\>**
|
|
59
|
-
### Errors
|
|
60
|
-
|
|
61
|
-
| Error Object | Status Code | Content Type |
|
|
62
|
-
| --------------- | ----------- | ------------ |
|
|
63
|
-
| errors.SDKError | 4xx-5xx | */* |
|
|
64
|
-
|
|
65
|
-
## create
|
|
66
|
-
|
|
67
|
-
Chat Completion
|
|
68
|
-
|
|
69
|
-
### Example Usage
|
|
70
|
-
|
|
71
|
-
```typescript
|
|
72
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
73
|
-
|
|
74
|
-
const MistralGoogleCloud = new MistralGoogleCloud({
|
|
75
|
-
region: "europe-west4",
|
|
76
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
async function run() {
|
|
80
|
-
const result = await MistralGoogleCloud.chat.complete({
|
|
81
|
-
model: "mistral-small-latest",
|
|
82
|
-
messages: [
|
|
83
|
-
{
|
|
84
|
-
content: "Who is the best French painter? Answer in one short sentence.",
|
|
85
|
-
role: "user",
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// Handle the result
|
|
91
|
-
console.log(result)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
run();
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Parameters
|
|
98
|
-
|
|
99
|
-
| Parameter | Type | Required | Description |
|
|
100
|
-
| ---------------------- | --------------------------------------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
101
|
-
| `request` | [components.ChatCompletionRequest](../../models/components/chatcompletionrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
102
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
103
|
-
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
104
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
### Response
|
|
108
|
-
|
|
109
|
-
**Promise\<[components.ChatCompletionResponse](../../models/components/chatcompletionresponse.md)\>**
|
|
110
|
-
### Errors
|
|
111
|
-
|
|
112
|
-
| Error Object | Status Code | Content Type |
|
|
113
|
-
| -------------------------- | ----------- | ---------------- |
|
|
114
|
-
| errors.HTTPValidationError | 422 | application/json |
|
|
115
|
-
| errors.SDKError | 4xx-5xx | */* |
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Fim
|
|
2
|
-
(*fim*)
|
|
3
|
-
|
|
4
|
-
## Overview
|
|
5
|
-
|
|
6
|
-
Fill-in-the-middle API.
|
|
7
|
-
|
|
8
|
-
### Available Operations
|
|
9
|
-
|
|
10
|
-
* [create](#create) - Fim Completion
|
|
11
|
-
|
|
12
|
-
## create
|
|
13
|
-
|
|
14
|
-
FIM completion.
|
|
15
|
-
|
|
16
|
-
### Example Usage
|
|
17
|
-
|
|
18
|
-
```typescript
|
|
19
|
-
import { MistralGoogleCloud } from "@mistralai/mistralai-gcp";
|
|
20
|
-
|
|
21
|
-
const MistralGoogleCloud = new MistralGoogleCloud({
|
|
22
|
-
region: "europe-west4",
|
|
23
|
-
projectId: process.env["GOOGLE_PROJECT_ID"],
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
async function run() {
|
|
27
|
-
const result = await MistralGoogleCloud.fim.complete({
|
|
28
|
-
model: "codestral-2405",
|
|
29
|
-
prompt: "def",
|
|
30
|
-
suffix: "return a+b",
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Handle the result
|
|
34
|
-
console.log(result)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
run();
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Parameters
|
|
41
|
-
|
|
42
|
-
| Parameter | Type | Required | Description |
|
|
43
|
-
| ---------------------- | --------------------------------------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
44
|
-
| `request` | [components.FIMCompletionRequest](../../models/components/fimcompletionrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
45
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
46
|
-
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
47
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Response
|
|
51
|
-
|
|
52
|
-
**Promise\<[components.FIMCompletionResponse](../../models/components/fimcompletionresponse.md)\>**
|
|
53
|
-
### Errors
|
|
54
|
-
|
|
55
|
-
| Error Object | Status Code | Content Type |
|
|
56
|
-
| -------------------------- | ----------- | ---------------- |
|
|
57
|
-
| errors.HTTPValidationError | 422 | application/json |
|
|
58
|
-
| errors.SDKError | 4xx-5xx | */* |
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# MistralGoogleCloud SDK
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
## Overview
|
|
5
|
-
|
|
6
|
-
Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it.
|
|
7
|
-
|
|
8
|
-
### Available Operations
|
|
9
|
-
|