ChatMistralAI features and configurations head to the API reference.
概述
集成详情
模型功能
请参阅下表标题中的链接,了解如何使用特定功能。设置
要访问 Mistral AI models,你需要create a Mistral AI account, get an API key, and install the@langchain/mistralai integration package.
凭证
Visit the Mistral console to sign up and generate an API key. Once you’ve done this set theMISTRAL_API_KEY environment variable:
安装
LangChain 的 ChatMistralAI 集成位于@langchain/mistralai 包中:
实例化
现在我们可以实例化模型对象并生成聊天补全:调用
When sending chat messages to mistral, there are a few requirements to follow:- The first message can not be an assistant (ai) message.
- Messages must alternate between user and assistant (ai) messages.
- Messages can not end with an assistant (ai) or system message.
工具调用
Mistral’s API supports tool calling for a subset of their models. You can see which models support tool calling on this page. The examples below demonstrates how to use it:Hooks
Mistral AI supports custom hooks for three events: beforeRequest, requestError, and response. Examples of the function signature for each hook type can be seen below:API 参考
有关所有ChatMistralAI 功能和配置的详细文档,请前往 API 参考。
将这些文档连接到 Claude、VSCode 等工具,通过 MCP 获取实时答案。

