跳过主内容

Outscale

介绍

Mistral AI 模型在 Outscale 平台上作为托管部署提供。通过 Outscale 市场,您可以订阅 Mistral 服务,该服务将代表您配置虚拟机和 GPU,然后在其上部署模型。

目前,以下模型可用:

  • Mistral Small (24.09)
  • Codestral (24.05)
  • Ministral 8B (24.10)

更多详细信息,请访问模型页面。

入门

以下部分概述了在 Outscale 平台上查询 Mistral 模型的步骤。

部署模型

按照Outscale 文档中描述的步骤,使用您选择的模型部署服务。

查询模型(聊天补全)

部署的模型暴露了一个 REST API,您可以使用 Mistral 的 SDK 或纯 HTTP 调用进行查询。要运行以下示例,您需要设置以下环境变量:

  • OUTSCALE_SERVER_URL: 托管您的 Mistral 模型的虚拟机 URL
  • OUTSCALE_MODEL_NAME: 要查询的模型名称(例如 small-2409codestral-2405
echo $OUTSCALE_SERVER_URL/v1/chat/completions
echo $OUTSCALE_MODEL_NAME
curl --location $OUTSCALE_SRV_URL/v1/chat/completions \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
"model": "'"$OUTSCALE_MODEL_NAME"'",
"temperature": 0,
"messages": [
{"role": "user", "content": "Who is the best French painter? Answer in one short sentence."}
],
"stream": false
}'

查询模型(FIM 补全)

Codestral 可以使用一种称为“填充中间”(FIM) 的额外补全模式进行查询。更多信息,请参阅代码生成部分

 curl --location $OUTSCALE_SERVER_URL/v1/fim/completions \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
"model": "'"$OUTSCALE_MODEL_NAME"'",
"prompt": "def count_words_in_file(file_path: str) -> int:",
"suffix": "return n_words",
"stream": false
}'

深入了解

更多信息和示例,您可以查看: