Skip to content

Commit

Permalink
Update version to v0.0.91
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Oct 16, 2024
1 parent 45143ae commit a01f7b2
Show file tree
Hide file tree
Showing 8 changed files with 7,187 additions and 5,424 deletions.
135 changes: 135 additions & 0 deletions docs/deployment/cloud/ibm-watsonx.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
id: ibm-watsonx
title: IBM watsonx.ai
sidebar_position: 3.25
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Introduction

Mistral AI's Large model is available on the IBM watsonx.ai platform as a fully managed
solution, as well as an on-premise deployment.

## Getting started

The following solutions outline the steps to query Mistral Large on the SaaS version of
IBM watsonx.ai.

### Pre-requisites

The following items are required:

- An IBM watsonx project (`IBM_CLOUD_PROJECT_ID`)
- A Service ID with an access policy enabling the use of the Watson Lachine Learning service.

To enable access to the API, you must make sure that:
- Your Service ID has been added to the project as `EDITOR`,
- You have generated an API key (`IBM_CLOUD_API_KEY`) for your Service ID.

### Querying the model (chat completion)

You can query Mistral Large using either IBM's SDK or plain HTTP calls.

:::warning

The examples below leverage the `mistral-common` Python package to properly format
the user messages with special tokens. It is **strongly recommended to avoid passing
raw strings and handle special tokens manually**: this might result in silent
tokenization errors that would highly degrade the quality of the model output.

:::

<Tabs>
<TabItem value="python" label="Python">
You will need to run your code from a virtual environment with the following
packages:

- `httpx` (tested with `0.27.2`)
- `ibm-watsonx-ai` (tested with `1.1.11`)
- `mistral-common` (tested with `1.4.4`)

In the following snippet, your API key will be used to generate an IAM token,
then the call to the model is performed using this token for authentication.

```python
from ibm_watsonx_ai import Credentials
from ibm_watsonx_ai.foundation_models import ModelInference
from ibm_watsonx_ai.metanames import GenTextParamsMetaNames as GenParams
from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
from mistral_common.protocol.instruct.request import ChatCompletionRequest
from mistral_common.protocol.instruct.messages import UserMessage

import os
import httpx

IBM_CLOUD_REGIONS = {
"dallas": "us-south",
"london": "eu-gb",
"frankfurt": "eu-de",
"tokyo": "jp-tok"
}

IBM_CLOUD_PROJECT_ID = "xxx-xxx-xxx" # Replace with your project id


def get_iam_token(api_key: str) -> str:
"""
Return an IAM access token generated from an API key.
"""

headers = {"Content-Type": "application/x-www-form-urlencoded"}
data = f"apikey={api_key}&grant_type=urn:ibm:params:oauth:grant-type:apikey"
resp = httpx.post(
url="https://iam.cloud.ibm.com/identity/token",
headers=headers,
data=data,
)
token = resp.json().get("access_token")
return token


def format_user_message(raw_user_msg: str) -> str:
"""
Return a formatted prompt using the official Mistral tokenizer.
"""

tokenizer = MistralTokenizer.v3() # Use v3 for Mistral Large
tokenized = tokenizer.encode_chat_completion(
ChatCompletionRequest(
messages=[UserMessage(content=raw_user_msg)], model="mistral-large"
)
)
return tokenized.text


region = "frankfurt" # Define the region of your choice here
api_key = os.environ["IBM_API_KEY"]
access_token = get_iam_token(api_key=api_key)
credentials = Credentials(url=f"https://{IBM_CLOUD_REGIONS[region]}.ml.cloud.ibm.com",
token=access_token)

params = {GenParams.MAX_NEW_TOKENS: 256, GenParams.TEMPERATURE: 0.0}
model_inference = ModelInference(
project_id=IBM_CLOUD_PROJECT_ID,
model_id="mistralai/mistral-large",
params=params,
credentials=credentials,
)
user_msg_content = "Who is the best French painter? Answer in one short sentence."
resp = model_inference.generate_text(prompt=format_user_message(user_msg_content))
print(resp)

```

</TabItem>
</Tabs>

## Going further

For more information and examples, you can check:

- The [IBM watsonx.ai Python SDK documentation](https://ibm.github.io/watsonx-ai-python-sdk/index.html)
- This [IBM Developer tutorial](https://developer.ibm.com/tutorials/awb-using-mistral-ai-llms-in-watsonx-ai-flows-engine/)
on how to use Mistral Large with IBM watsonx.ai flows engine.
1 change: 1 addition & 0 deletions docs/deployment/cloud/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ In particular, Mistral's optimized commercial models are available on:
- [AWS Bedrock](../aws)
- [Google Cloud Vertex AI Model Garden](../vertex)
- [Snowflake Cortex](../sfcortex)
- [IBM watsonx](../ibm-watsonx)

3 changes: 3 additions & 0 deletions docs/getting-started/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ sidebar_position: 1.8

This is the list of changes to the Mistral API.

October 9, 2024
- We released Ministral 3B (`ministral-3b-2410`) and Ministral 8B (`ministral-8b-2410`).

September 17, 2024
- We released Pixtral (`pixtral-12b-2409`) and Mistral Small v24.09 (`mistral-small-2409`).
- We reduced price on our flagship model, Mistral Large 2.
Expand Down
23 changes: 13 additions & 10 deletions docs/getting-started/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,25 @@ Mistral AI is a research lab building the best open source models in the world.

## Mistral AI Large Language Models (LLMs)

We release state-of-the-art generalist models, specialized models, and research models, driving innovation and convenience for our developer community. Our models are state-of-the-art for their multilingual, code generation, maths, and advanced reasoning capabilities.
We release both premier models and free models, driving innovation and convenience for our developer community. Our models are state-of-the-art for their multilingual, code generation, maths, and advanced reasoning capabilities.

### State-of-the-art generalist models
### Premier models

- Ministral 3B, world’s best edge model released [October 2024](https://mistral.ai/news/ministraux/).
- Ministral 8B, powerful edge model with extremely high performance/price ratio released [October 2024](https://mistral.ai/news/ministraux/).
- Mistral Small, our latest enterprise-grade small model with the lastest version v2 released [September 2024](https://mistral.ai/news/september-24-release/).
- Mistral Large, our top-tier reasoning model for high-complexity tasks with the lastest version v2 released [July 2024](https://mistral.ai/news/mistral-large-2407/)
- Mistral NeMo, our best multilingual open source model released [July 2024](https://mistral.ai/news/mistral-nemo/)

### Specialized models
- Codestral, our cutting-edge language model for coding released [May 2024](https://mistral.ai/news/codestral/)
- Mistral Embed, our state-of-the-art semantic for extracting representation of text extracts

### Research models
- Mistral 7b, our first dense model released [September 2023](https://mistral.ai/news/announcing-mistral-7b/)
- Mixtral 8x7b, our first sparse mixture-of-experts released [December 2023](https://mistral.ai/news/mixtral-of-experts/)
- Mixtral 8x22b, our best open source model to date released [April 2024](https://mistral.ai/news/mixtral-8x22b/)
- Mathstral 7b, our first math open source model released [July 2024](https://mistral.ai/news/mathstral/)
### Free models
- Pixtral, a 12B model with image understanding capabilities in addition to text released [September 2024](https://mistral.ai/news/pixtral-12b/)
- Mistral NeMo, our best multilingual open source model released [July 2024](https://mistral.ai/news/mistral-nemo/)
- Codestral Mamba, our first mamba 2 open source model released [July 2024](https://mistral.ai/news/codestral-mamba/)
- Mathstral 7b, our first math open source model released [July 2024](https://mistral.ai/news/mathstral/)
- Mixtral 8x22b, our best open source model to date released [April 2024](https://mistral.ai/news/mixtral-8x22b/)
- Mixtral 8x7b, our first sparse mixture-of-experts released [December 2023](https://mistral.ai/news/mixtral-of-experts/)
- Mistral 7b, our first dense model released [September 2023](https://mistral.ai/news/announcing-mistral-7b/)

Learn more about our models [here](/getting-started/models/models_overview).

Expand All @@ -35,6 +37,7 @@ Learn more about our models [here](/getting-started/models/models_overview).
The [Mistral AI APIs](https://console.mistral.ai/) empower LLM applications via:

- [Text generation](/capabilities/completion), enables streaming and provides the ability to display partial model results in real-time
- [Vision](/capabilities/vision), enables the analysis of images and provides insights based on visual content in addition to text.
- [Code generation](/capabilities/code_generation), enpowers code generation tasks, including fill-in-the-middle and code completion
- [Embeddings](/capabilities/embeddings), useful for RAG where it represents the meaning of text as a list of numbers
- [Function calling](/capabilities/function_calling), enables Mistral models to connect to external tools
Expand Down
4 changes: 4 additions & 0 deletions docs/getting-started/models/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Mistral provides two types of models: free models and premier models.

| Model | Weight availability|Available via API| Description | Max Tokens| API Endpoints|Version|
|--------------------|:--------------------:|:--------------------:|:--------------------:|:--------------------:|:--------------------:|:--------------------:|
| Ministral 3B | | :heavy_check_mark: | World’s best edge model. Learn more on our [blog post](https://mistral.ai/news/ministraux/) | 128k | `ministral-3b-latest` | 24.10|
| Ministral 8B | :heavy_check_mark: <br/> [Mistral Research License](https://mistral.ai/licenses/MRL-0.1.md)| :heavy_check_mark: |Powerful edge model with extremely high performance/price ratio. Learn more on our [blog post](https://mistral.ai/news/ministraux/) | 128k | `ministral-8b-latest` | 24.10|
| Mistral Large |:heavy_check_mark: <br/> [Mistral Research License](https://mistral.ai/licenses/MRL-0.1.md)| :heavy_check_mark: |Our top-tier reasoning model for high-complexity tasks with the lastest version v2 released July 2024. Learn more on our [blog post](https://mistral.ai/news/mistral-large-2407/)| 128k | `mistral-large-latest`| 24.07|
| Mistral Small | :heavy_check_mark: <br/> [Mistral Research License](https://mistral.ai/licenses/MRL-0.1.md) | :heavy_check_mark: | Our latest enterprise-grade small model with the lastest version v2 released September 2024. Learn more on our [blog post](https://mistral.ai/news/september-24-release/) | 32k | `mistral-small-latest` | 24.09|
| Codestral |:heavy_check_mark: <br/> [Mistral Non-Production License](https://mistral.ai/licenses/MNPL-0.1.md) | :heavy_check_mark: | Our cutting-edge language model for coding released May 2024 | 32k | `codestral-latest` | 24.05|
Expand Down Expand Up @@ -56,6 +58,8 @@ it is recommended to use the dated versions of the Mistral AI API.
Additionally, be prepared for the deprecation of certain endpoints in the coming months.

Here are the details of the available versions:
- `ministral-3b-latest`: currently points to `ministral-3b-2410`.
- `ministral-8b-latest`: currently points to `ministral-8b-2410`.
- `open-mistral-nemo`: currently points to `open-mistral-nemo-2407`.
- `mistral-small-latest`: currently points to `mistral-small-2409`. `mistral-small-2402` is deprecated.
- `mistral-medium-latest`: currently points to `mistral-medium-2312`.
Expand Down
12 changes: 7 additions & 5 deletions docs/getting-started/models/weights.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ We open-source both pre-trained models and instruction-tuned models. These model
## License
- Mistral 7B, Mixtral 8x7B, Mixtral 8x22B, Codestral Mamba, Mathstral, Mistral Nemo, and Pixtral are under [Apache 2 License](https://choosealicense.com/licenses/apache-2.0/), which permits their use without any constraints.
- Codestral is under [Mistral AI Non-Production (MNPL) License](https://mistral.ai/licences/MNPL-0.1.md).
- Mistral Large and Mistral Small are under [Mistral Research License](https://mistral.ai/licenses/MRL-0.1.md).
- Ministral 8B, Mistral Large and Mistral Small are under [Mistral Research License](https://mistral.ai/licenses/MRL-0.1.md).

:::note[ ]
If you are interested in purchasing a commercial license for our models, please [contact our team](https://mistral.ai/contact/)
Expand All @@ -33,11 +33,12 @@ If you are interested in purchasing a commercial license for our models, please
| Codestral-22B-v0.1 | [Hugging Face](https://huggingface.co/mistralai/Codestral-22B-v0.1) <br/> [raw_weights](https://models.mistralcdn.com/codestral-22b-v0-1/codestral-22B-v0.1.tar) (md5sum: `1ea95d474a1d374b1d1b20a8e0159de3`) | - 32768 vocabulary size <br/> - Supports v3 Tokenizer |
| Codestral-Mamba-7B-v0.1 | [Hugging Face](https://huggingface.co/mistralai/mamba-codestral-7B-v0.1) <br/> [raw_weights](https://models.mistralcdn.com/codestral-mamba-7b-v0-1/codestral-mamba-7B-v0.1.tar) (md5sum: `d3993e4024d1395910c55db0d11db163`) | - 32768 vocabulary size <br/> - Supports v3 Tokenizer |
| Mathstral-7B-v0.1 | [Hugging Face](https://huggingface.co/mistralai/mathstral-7B-v0.1) <br/> [raw_weights](https://models.mistralcdn.com/mathstral-7b-v0-1/mathstral-7B-v0.1.tar) (md5sum: `5f05443e94489c261462794b1016f10b`) | - 32768 vocabulary size <br/> - Supports v3 Tokenizer |
| Mistral-Nemo-Base-2407 | [Hugging Face](https://huggingface.co/mistralai/Mistral-Nemo-Base-2407) <br/> [raw_weights](https://models.mistralcdn.com/mistral-nemo-2407/mistral-nemo-base-2407.tar) (md5sum: `c5d079ac4b55fc1ae35f51f0a3c0eb83`) | - 131k vocabulary size <br/> - Supports tekken.json tokenizer |
| Mistral-Nemo-Instruct-2407 | [Hugging Face](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407) <br/> [raw_weights](https://models.mistralcdn.com/mistral-nemo-2407/mistral-nemo-instruct-2407.tar) (md5sum: `296fbdf911cb88e6f0be74cd04827fe7`) | - 131k vocabulary size <br/> - Supports tekken.json tokenizer <br/> - Supports function calling |
| Mistral-Nemo-Base-2407 | [Hugging Face](https://huggingface.co/mistralai/Mistral-Nemo-Base-2407) <br/> [raw_weights](https://models.mistralcdn.com/mistral-nemo-2407/mistral-nemo-base-2407.tar) (md5sum: `c5d079ac4b55fc1ae35f51f0a3c0eb83`) | - 131k vocabulary size <br/> - Supports v3 tekken.json tokenizer |
| Mistral-Nemo-Instruct-2407 | [Hugging Face](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407) <br/> [raw_weights](https://models.mistralcdn.com/mistral-nemo-2407/mistral-nemo-instruct-2407.tar) (md5sum: `296fbdf911cb88e6f0be74cd04827fe7`) | - 131k vocabulary size <br/> - Supports v3 tekken.json tokenizer <br/> - Supports function calling |
| Mistral-Large-Instruct-2407 | [Hugging Face](https://huggingface.co/mistralai/Mistral-Large-Instruct-2407) <br/> [raw_weights](https://models.mistralcdn.com/mistral-large-2407/mistral-large-instruct-2407.tar) (md5sum: `fc602155f9e39151fba81fcaab2fa7c4`)| - 32768 vocabulary size <br/> - Supports v3 Tokenizer <br/> - Supports function calling |
| Pixtral-2409 | [Hugging Face](https://huggingface.co/mistralai/Pixtral-12B-2409) | - 131k vocabulary size <br/> - Supports tekken.json tokenizer <br/> - Supports function calling |
| Mistral-Small-2409 | [Hugging Face](https://huggingface.co/mistralai/Mistral-Small-Instruct-2409) | - 32768 vocabulary size <br/> - Supports v3 Tokenizer <br/> - Supports function calling |
| Pixtral-2409 | [Hugging Face](https://huggingface.co/mistralai/Pixtral-12B-2409) | - 131k vocabulary size <br/> - Supports v3 tekken.json tokenizer <br/> - Supports function calling |
| Mistral-Small-Instruct-2409 | [Hugging Face](https://huggingface.co/mistralai/Mistral-Small-Instruct-2409) | - 32768 vocabulary size <br/> - Supports v3 Tokenizer <br/> - Supports function calling |
| Ministral-8B-Instruct-2410 | [Hugging Face](https://huggingface.co/mistralai/Ministral-8B-Instruct-2410) | - 131k vocabulary size <br/> - Supports v3 tekken.json tokenizer <br/> - Supports function calling |

## Sizes

Expand All @@ -53,6 +54,7 @@ If you are interested in purchasing a commercial license for our models, please
| Mistral-Large-Instruct-2407 | 123B | 123B | 228 |
| Pixtral-2409 | 12B | 12B | 28 - bf16 <br/> 16 - fp8 |
| Mistral-Small-2409 | 22B | 22B | 60 |
| Ministral-8B-2410 | 8B | 8B | 24 |

## How to run?
Check out [mistral-inference](https://github.com/mistralai/mistral-inference/), a Python package for running our models. You can install `mistral-inference` by
Expand Down
Loading

0 comments on commit a01f7b2

Please sign in to comment.