New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/mistral

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/mistral

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.

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
46K
decreased by-20.49%
Maintainers
2
Weekly downloads
 
Created
Source

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 @ai-sdk/mistral module. You can install it with

npm i @ai-sdk/mistral

Provider Instance

You can import createMistral from @ai-sdk/mistral and create a provider instance with various settings:

import { createMistral } from '@ai-sdk/mistral';

const mistral = createMistral({
  // optional base URL for proxies etc.:
  baseURL: '',

  // optional API key, default to env property MISTRAL_API_KEY:
  apiKey: '',

  // optional custom headers:
  headers: {
    'custom-header': 'value',
  },
});

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

import { mistral } from '@ai-sdk/mistral';

Models

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

const model = mistral('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('mistral-large-latest', {
  safePrompt: true, // optional safety prompt injection
});

Keywords

FAQs

Package last updated on 22 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc