0.0.1 • Published 1 year ago

@khulnasoft/mistral v0.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

Vercel AI SDK - Mistral Provider

The Mistral provider contains language model support for the Mistral chat API. It creates language model objects that can be used with the generateText, streamText, generateObject, and streamObject AI functions.

Setup

The Mistral provider is available in the @khulnasoft/mistral module. You can install it with

npm i @khulnasoft/mistral

Provider Instance

You can import Mistral from ai/mistral and initialize a provider instance with various settings:

import { Mistral } from '@khulnasoft/mistral';

const mistral = new Mistral({
  baseUrl: '', // optional base URL for proxies etc.
  apiKey: '', // optional API key, default to env property MISTRAL_API_KEY
});

The AI SDK also provides a shorthand mistral import with a Mistral provider instance that uses defaults:

import { mistral } from '@khulnasoft/mistral';

Chat Models

You can create models that call the Mistral chat API using the .chat() factory method. The first argument is the model id, e.g. mistral-large-latest. Some Mistral chat models support tool calls.

const model = mistral.chat('mistral-large-latest');

Mistral chat models also support additional model settings that are not part of the standard call settings. You can pass them as an options argument:

const model = mistral.chat('mistral-large-latest', {
  safePrompt: true, // optional safety prompt injection
});
0.0.1

1 year ago

0.0.0

1 year ago