@ai-sdk/mistral
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -24,2 +24,3 @@ "use strict"; | ||
Mistral: () => Mistral, | ||
createMistral: () => createMistral, | ||
mistral: () => mistral | ||
@@ -442,8 +443,24 @@ }); | ||
}; | ||
var mistral = new Mistral(); | ||
// src/mistral-provider.ts | ||
function createMistral(options = {}) { | ||
const mistral2 = new Mistral(options); | ||
const provider = function(modelId, settings) { | ||
if (new.target) { | ||
throw new Error( | ||
"The Mistral model function cannot be called with the new keyword." | ||
); | ||
} | ||
return mistral2.chat(modelId, settings); | ||
}; | ||
provider.chat = mistral2.chat.bind(mistral2); | ||
return provider; | ||
} | ||
var mistral = createMistral(); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
Mistral, | ||
createMistral, | ||
mistral | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -33,3 +33,3 @@ import { LanguageModelV1 } from '@ai-sdk/provider'; | ||
/** | ||
* Mistral provider. | ||
* @deprecated Use `createMistral` instead. | ||
*/ | ||
@@ -64,7 +64,30 @@ declare class Mistral { | ||
} | ||
interface MistralProvider { | ||
(modelId: MistralChatModelId, settings?: MistralChatSettings): MistralChatLanguageModel; | ||
chat(modelId: MistralChatModelId, settings?: MistralChatSettings): MistralChatLanguageModel; | ||
} | ||
/** | ||
* Create a Mistral AI provider. | ||
*/ | ||
declare function createMistral(options?: { | ||
/** | ||
* Base URL for the Mistral API calls. | ||
*/ | ||
baseURL?: string; | ||
/** | ||
* @deprecated Use `baseURL` instead. | ||
*/ | ||
baseUrl?: string; | ||
/** | ||
* API key for authenticating requests. | ||
*/ | ||
apiKey?: string; | ||
generateId?: () => string; | ||
}): MistralProvider; | ||
/** | ||
* Default Mistral provider instance. | ||
*/ | ||
declare const mistral: Mistral; | ||
declare const mistral: MistralProvider; | ||
export { Mistral, mistral }; | ||
export { Mistral, type MistralProvider, createMistral, mistral }; |
@@ -24,2 +24,3 @@ "use strict"; | ||
Mistral: () => Mistral, | ||
createMistral: () => createMistral, | ||
mistral: () => mistral | ||
@@ -442,8 +443,24 @@ }); | ||
}; | ||
var mistral = new Mistral(); | ||
// src/mistral-provider.ts | ||
function createMistral(options = {}) { | ||
const mistral2 = new Mistral(options); | ||
const provider = function(modelId, settings) { | ||
if (new.target) { | ||
throw new Error( | ||
"The Mistral model function cannot be called with the new keyword." | ||
); | ||
} | ||
return mistral2.chat(modelId, settings); | ||
}; | ||
provider.chat = mistral2.chat.bind(mistral2); | ||
return provider; | ||
} | ||
var mistral = createMistral(); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
Mistral, | ||
createMistral, | ||
mistral | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ai-sdk/mistral", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -16,8 +16,8 @@ # Vercel AI SDK - Mistral Provider | ||
You can import `Mistral` from `ai/mistral` and initialize a provider instance with various settings: | ||
You can import `createMistral` from `@ai-sdk/mistral` and create a provider instance with various settings: | ||
```ts | ||
import { Mistral } from '@ai-sdk/mistral'; | ||
import { createMistral } from '@ai-sdk/mistral'; | ||
const mistral = new Mistral({ | ||
const mistral = createMistral({ | ||
baseURL: '', // optional base URL for proxies etc. | ||
@@ -34,5 +34,5 @@ apiKey: '', // optional API key, default to env property MISTRAL_API_KEY | ||
## Chat Models | ||
## Models | ||
You can create models that call the [Mistral chat API](https://docs.mistral.ai/api/#operation/createChatCompletion) using the `.chat()` factory method. | ||
You can create models that call the [Mistral chat API](https://docs.mistral.ai/api/#operation/createChatCompletion) using provider instance. | ||
The first argument is the model id, e.g. `mistral-large-latest`. | ||
@@ -42,3 +42,3 @@ Some Mistral chat models support tool calls. | ||
```ts | ||
const model = mistral.chat('mistral-large-latest'); | ||
const model = mistral('mistral-large-latest'); | ||
``` | ||
@@ -50,5 +50,5 @@ | ||
```ts | ||
const model = mistral.chat('mistral-large-latest', { | ||
const model = mistral('mistral-large-latest', { | ||
safePrompt: true, // optional safety prompt injection | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
100919
1433
0
10