

# Mistral 7B Instruct


## ![\[alt text not found\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/models/mistralai.png) Mistral AI — Mistral 7B Instruct


## Model Details


Mistral 7B Instruct is Mistral AI's 7-billion parameter instruction-tuned model with grouped-query attention and sliding window attention for efficient long-context inference. For more information about model development and performance, see the [model/service card](https://docs.mistral.ai/getting-started/models).
+ **Model launch date:** Sep 28, 2023
+ **Model EOL date:** No sooner than 3/1/2025
+ **End User License Agreements and Terms of Use:** [View](https://aws.amazon.com/legal/bedrock/third-party-models/)
+ **Model lifecycle:** Active
+ **Context window:** 32K tokens
+ **Max output tokens:** 4K


| **Input Modalities** | **Output Modalities** | **[APIs supported](https://docs.aws.amazon.com/bedrock/latest/userguide/apis.html)** | **[Endpoints supported](https://docs.aws.amazon.com/bedrock/latest/userguide/endpoints.html)** | 
| --- | --- | --- | --- | 
| ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Audio | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Embedding | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Responses | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) bedrock-runtime | 
| ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Image | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Image | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Chat Completions | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) bedrock-mantle | 
| ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Speech | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Speech | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) Invoke |  | 
| ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) Text | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) Text | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) Converse |  | 
| ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Video | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) Video |  |  | 

## Pricing


For pricing, please refer to the [Amazon Bedrock Pricing](https://aws.amazon.com/bedrock/pricing/) page.

## Programmatic Access


Use the following model IDs and endpoint URLs to access this model programmatically. For more information about the available APIs and endpoints, see [APIs supported](https://docs.aws.amazon.com/bedrock/latest/userguide/apis.html) and [Endpoints supported](https://docs.aws.amazon.com/bedrock/latest/userguide/endpoints.html).


| **Endpoint** | **Model ID** | **In-Region endpoint URL** | **Geo inference ID** | **Global inference ID** | 
| --- | --- | --- | --- | --- | 
| bedrock-runtime | mistral.mistral-7b-instruct-v0:2 | https://bedrock-runtime.\$1region\$1.amazonaws.com | Not supported | Not supported | 

*For example, if region is us-east-1 (N. Virginia), then the bedrock-runtime endpoint URL will be "https://bedrock-runtime.us-east-1.amazonaws.com" and for bedrock-mantle will be "https://bedrock-mantle.us-east-1.api.aws/v1".*

## Service Tiers


Amazon Bedrock offers multiple service tiers to match your workload requirements. **Standard** provides pay-per-token access with no commitment. **Priority** offers higher throughput with a time-based commitment. **Flex** provides lower-cost access for flexible, non-time-sensitive workloads. **Reserved** provides dedicated throughput with a term commitment for predictable workloads. For more information, see [service tiers](https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html).


| **Standard** | **Priority** | **Flex** | **Reserved** | 
| --- | --- | --- | --- | 
| ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 

## Regional Availability


***Regional availability at a glance***

Bedrock offers three inference options: **In-Region** keeps requests within a single Region for strict compliance, **Geo Cross-Region** routes across Regions within a geography (US, EU, etc.) for higher throughput while respecting data residency, and **Global Cross-Region** routes anywhere worldwide for maximum throughput when there are no residency constraints. Refer to the [Regional availability](models-region-compatibility.md) page for more details.


| **Region** | **In-Region** | **Geo** | **Global** | 
| --- | --- | --- | --- | 
| us-east-1 (N. Virginia) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 
| us-west-2 (Oregon) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 
| ca-central-1 (Canada) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 
| eu-west-1 (Ireland) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 
| eu-west-2 (London) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 
| eu-west-3 (Paris) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 
| ap-south-1 (Mumbai) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 
| ap-southeast-2 (Sydney) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 
| sa-east-1 (São Paulo) | ![\[Yes\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-yes.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | ![\[No\]](http://docs.aws.amazon.com/bedrock/latest/userguide/images/icons/icon-no.png) | 

## Quotas and Limits


Your AWS account has default quotas to maintain the performance of the service and to ensure appropriate usage of Amazon Bedrock. The default quotas assigned to an account might be updated depending on regional factors, payment history, fraudulent usage, and/or approval of a quota [increase request](https://docs.aws.amazon.com/bedrock/latest/userguide/quotas-increase.html). For more details, please refer to [Quotas for Amazon Bedrock](quotas.md) documentation and see the [limits](https://docs.aws.amazon.com/general/latest/gr/bedrock.html#limits_bedrock) for the model.

## Sample Code


**Step 1 - AWS Account:** If you have an AWS account already, skip this step. If you are new to AWS, sign up for an [AWS account](https://portal.aws.amazon.com/billing/signup).

**Step 2 - API key:** Go to the [Amazon Bedrock console](https://console.aws.amazon.com/bedrock/home#/api-keys/long-term/create) and generate a long-term API key.

**Step 3 - Get the SDK:** To use this getting started guide, you must have Python already installed. Then install the relevant software depending on the APIs you are using.

```
pip install boto3
```

**Step 4 - Set environment variables:** Configure your environment to use the API key for authentication.

```
AWS_BEARER_TOKEN_BEDROCK="<provide your Bedrock API key>"
```

**Step 5 - Run your first inference request:** Save the file as `bedrock-first-request.py`

------
#### [ Invoke API ]

```
import json
import boto3

client = boto3.client('bedrock-runtime', region_name='us-east-1')
response = client.invoke_model(
    modelId='mistral.mistral-7b-instruct-v0:2',
    body=json.dumps({
            'messages': [{ 'role': 'user', 'content': 'Can you explain the features of Amazon Bedrock?'}],
            'max_tokens': 1024
    })
 )
 print(json.loads(response['body'].read()))
```

------
#### [ Converse API ]

```
import boto3

client = boto3.client('bedrock-runtime', region_name='us-east-1')
response = client.converse(
    modelId='mistral.mistral-7b-instruct-v0:2',
    messages=[
        {
            'role': 'user',
            'content': [{'text': 'Can you explain the features of Amazon Bedrock?'}]
        }
    ]
)
print(response)
```

------