# Mistral 3 Small (24B AWQ)

**Mistral 3 Small** é um modelo de linguagem que, embora sendo compacto, oferece capacidades comparáveis às de modelos maiores. Ele é ideal para agentes conversacionais, chamada de função, ajuste fino e inferência local com dados sensíveis.

## Detalhes do modelo

| Categoria | Detalhes |
|----------|-------|
| **Nome do modelo** | Mistral 3 Small |
| **Versão** | 24B AWQ |
| **Categoria do modelo** | Large Language Model (LLM) |
| **Tamanho** | 24B parâmetros |
| **Modelo HuggingFace** | [casperhansen/mistral-small-24b-instruct-2501-awq](https://huggingface.co/casperhansen/mistral-small-24b-instruct-2501-awq) |
| **Endpoint compatível com a OpenAI** | [Chat API Overview](https://developers.openai.com/api/reference/overview) |
| **Licença** | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) |

## Capacidades

| Recurso | Detalhes |
|---------|--------|
| Tool Calling | ✅ |
| Tamanho do contexto | 32k tokens |
| Suporta LoRA | ❌ |
| Dados de entrada | Texto |

## Uso

### Chat completion básico

Este é um exemplo de uma requisição básica de chat completion usando este modelo:

```ts
const modelResponse = await Azion.AI.run("casperhansen-mistral-small-24b-instruct-2501-awq", {
  "stream": true,
  "max_tokens": 1024,
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Name the european capitals"
    }
  ]
})
```

| Propriedade | Tipo | Descrição |
|------------|------|-------------|
| `stream` | boolean | Indica se a resposta deve ser transmitida via stream. |
| `max_tokens` | number | O número máximo de tokens na resposta. |
| `messages` | array | Um array de objetos de mensagem contendo o papel e o conteúdo da mensagem. |
| `messages[].role` | string | O papel do remetente da mensagem. |
| `messages[].content` | string | O conteúdo da mensagem. |

Exemplo de resposta:

```json
{
  "id": "chatcmpl-e27716424abf4b3f891ff4850470cb09",
  "object": "chat.completion",
  "created": 1746821581,
  "model": "casperhansen-mistral-small-24b-instruct-2501-awq",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "reasoning_content": null,
        "content": "Sure! Here is a list of some European capitals...",
        "tool_calls": []
      },
      "logprobs": null,
      "finish_reason": "stop",
      "stop_reason": null
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "total_tokens": 527,
    "completion_tokens": 518,
    "prompt_tokens_details": null
  },
  "prompt_logprobs": null
}
```

| Propriedade | Tipo | Descrição |
|------------|------|-------------|
| `id` | string | Identificador único para a resposta. |
| `object` | string | O tipo de objeto retornado na resposta. |
| `created` | number | Timestamp de quando a resposta foi criada. |
| `model` | string | O nome do modelo usado para a requisição. |
| `choices` | array | Array de objetos contendo as escolhas de resposta. |
| `usage` | object | Objeto contendo métricas de uso para a requisição. |
| `prompt_logprobs` | number | Probabilidades logarítmicas do prompt. |
| `choices[].index` | number | Índice da escolha no array. |
| `choices[].message` | object | Objeto contendo os detalhes da mensagem. |
| `choices[].message.role` | string | O papel do remetente da mensagem. |
| `choices[].message.reasoning_content` | string | O conteúdo de raciocínio da mensagem. |
| `choices[].message.content` | string | O conteúdo da mensagem. |
| `choices[].message.tool_calls` | array | Array de objetos de chamada de ferramenta. |
| `choices[].logprobs` | number | Probabilidades logarítmicas da escolha. |
| `choices[].finish_reason.` | string | O motivo pelo qual a escolha foi finalizada. |
| `choices[].stop_reason` | string | O motivo pelo qual a escolha foi interrompida. |
| `usage.prompt_tokens` | number | O número de tokens no prompt de entrada. |
| `usage.total_tokens` | number | O total de tokens processados. |
| `usage.completion_tokens` | number | O número de tokens na conclusão. |
| `usage.prompt_tokens_details` | string | Detalhes adicionais sobre os tokens do prompt. |

### Exemplo de Tool Calling

Este é um exemplo de uma requisição de Tool Calling usando este modelo:

```ts
const modelResponse = await Azion.AI.run("casperhansen-mistral-small-24b-instruct-2501-awq", {
  "stream": true,
  "max_tokens": 1024,
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant with access to tools."
    },
    {
      "role": "user",
      "content": "What is the weather in London?"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the current weather for a location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state"
            }
          },
          "required": [
            "location"
          ]
        }
      }
    }
  ]
})
```

| Propriedade                          | Tipo       | Descrição                                                                 |
|-----------------------------------|------------|-----------------------------------------------------------------------------|
| stream                            | boolean    | Indica se a resposta deve ser transmitida via stream.                                  |
| max_tokens                        | number     | O número máximo de tokens a serem gerados na resposta.                  |
| messages                          | array      | Lista de mensagens na conversa.                                      |
| messages[].role                   | string     | O papel do remetente da mensagem.                   |
| messages[].content                | string     | O conteúdo da mensagem.                                                |
| tools                             | array      | Uma lista de ferramentas ou funções que o modelo pode chamar.                           |
| tools[].type                      | string     | O tipo da ferramenta.                                   |
| tools[].function                  | object     | Metadados sobre a função sendo definida.                                 |
| tools[].function.name             | string     | Nome da função.                                |
| tools[].function.description      | string     | Descrição do que a função faz.                                     |
| tools[].function.parameters       | object     | Esquema JSON descrevendo os parâmetros da função.                          |

Exemplo de resposta:

```json
{
  "id": "chatcmpl-88affc4730cf4219a06d2b15aad9ad44",
  "object": "chat.completion",
  "created": 1746821866,
  "model": "qwen-qwen25-vl-3b-instruct-awq",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "reasoning_content": null,
        "content": null,
        "tool_calls": [
          {
            "id": "chatcmpl-tool-fd3311e75aed4cbfbeb7244ced77379f",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"location\": \"London\"}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls",
      "stop_reason": null
    }
  ],
  "usage": {
    "prompt_tokens": 293,
    "total_tokens": 313,
    "completion_tokens": 20,
    "prompt_tokens_details": null
  },
  "prompt_logprobs": null
}
```

| Propriedade | Tipo | Descrição |
|------------|------|-------------|
| `id` | string | Identificador único para a resposta. |
| `object` | string | O tipo de objeto retornado na resposta. |
| `created` | number | Timestamp de quando a resposta foi criada. |
| `model` | string | O nome do modelo usado para a requisição. |
| `choices` | array | Array de objetos contendo as escolhas de resposta. |
| `usage` | object | Objeto contendo métricas de uso para a requisição. |
| `choices[index]` | number | Índice da escolha no array. |
| `choices[].message` | object | Objeto contendo os detalhes da mensagem. |
| `choices[].message.role` | string | O papel do remetente da mensagem. |
| `choices[].message.reasoning_content` | string | O conteúdo de raciocínio da mensagem. |
| `choices[].message.content` | string | O conteúdo da mensagem. |
| `choices[].message.tool_calls[]` | array | Array de objetos de chamada de ferramenta. |
| `choices[].message.tool_calls[].id` | string | Identificador único para a chamada de ferramenta. |
| `choices[].message.tool_calls[].type` | string | O tipo de chamada de ferramenta. |
| `choices[].message.tool_calls[].function` | object | Objeto contendo os detalhes da função. |
| `choices[].message.tool_calls[].function.name` | string | O nome da função. |
| `choices[].message.tool_calls[].function.arguments` | string | Os argumentos passados para a função. |
| `usage.prompt_tokens` | number | O número de tokens no prompt de entrada. |
| `usage.total_tokens` | number | O total de tokens processados. |
| `usage.completion_tokens` | number | O número de tokens na conclusão. |
| `usage.prompt_tokens_details` | string | Detalhes adicionais sobre os tokens do prompt. |

## Schema JSON

```json
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "required": [
        "messages"
    ],
    "properties": {
        "messages": {
            "type": "array",
            "items": {
                "$ref": "#/components/schemas/Message"
            }
        },
        "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
        },
        "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 1
        },
        "n": {
            "type": "integer",
            "minimum": 1,
            "default": 1
        },
        "stream": {
            "type": "boolean",
            "default": false
        },
        "max_tokens": {
            "type": "integer",
            "minimum": 1
        },
        "presence_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "default": 0
        },
        "frequency_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "default": 0
        },
        "tools": {
            "type": "array",
            "items": {
                "$ref": "#/components/schemas/ToolDefinition"
            }
        }
    },
    "components": {
        "schemas": {
            "Message": {
                "oneOf": [
                    {
                        "$ref": "#/components/schemas/SystemMessage"
                    },
                    {
                        "$ref": "#/components/schemas/UserMessage"
                    },
                    {
                        "$ref": "#/components/schemas/AssistantMessage"
                    },
                    {
                        "$ref": "#/components/schemas/ToolMessage"
                    }
                ]
            },
            "SystemMessage": {
                "type": "object",
                "required": [
                    "role",
                    "content"
                ],
                "properties": {
                    "role": {
                        "type": "string",
                        "enum": [
                            "system"
                        ]
                    },
                    "content": {
                        "$ref": "#/components/schemas/TextContent"
                    }
                }
            },
            "UserMessage": {
                "type": "object",
                "required": [
                    "role",
                    "content"
                ],
                "properties": {
                    "role": {
                        "type": "string",
                        "enum": [
                            "user"
                        ]
                    },
                    "content": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "array",
                                "items": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/TextContentItem"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            },
            "AssistantMessage": {
                "oneOf": [
                    {
                        "$ref": "#/components/schemas/AssistantMessageWithoutToolCalls"
                    },
                    {
                        "$ref": "#/components/schemas/AssistantMessageWithToolCalls"
                    }
                ]
            },
            "ToolMessage": {
                "type": "object",
                "required": [
                    "role",
                    "content",
                    "tool_call_id"
                ],
                "properties": {
                    "role": {
                        "enum": [
                            "tool"
                        ]
                    },
                    "content": {
                        "type": "string"
                    },
                    "tool_call_id": {
                        "type": "string"
                    }
                }
            },
            "AssistantMessageWithoutToolCalls": {
                "type": "object",
                "required": [
                    "role",
                    "content"
                ],
                "properties": {
                    "role": {
                        "type": "string",
                        "enum": [
                            "assistant"
                        ]
                    },
                    "content": {
                        "$ref": "#/components/schemas/TextContent"
                    }
                },
                "not": {
                    "required": [
                        "tool_calls"
                    ]
                }
            },
            "AssistantMessageWithToolCalls": {
                "type": "object",
                "required": [
                    "role",
                    "tool_calls"
                ],
                "properties": {
                    "role": {
                        "type": "string",
                        "enum": [
                            "assistant"
                        ]
                    },
                    "tool_calls": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ToolCalls"
                        }
                    }
                }
            },
            "TextContent": {
                "oneOf": [
                    {
                        "type": "string"
                    },
                    {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TextContentItem"
                        }
                    }
                ],
                "description": "Text content that can be provided either as a simple string or as an array of TextContentItem objects"
            },
            "TextContentItem": {
                "type": "object",
                "required": [
                    "type",
                    "text"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "text"
                        ]
                    },
                    "text": {
                        "type": "string"
                    }
                }
            },
            "ToolCalls": {
                "type": "object",
                "required": [
                    "function",
                    "id",
                    "type"
                ],
                "properties": {
                    "function": {
                        "type": "object",
                        "required": [
                            "name",
                            "arguments"
                        ],
                        "properties": {
                            "name": {
                                "type": "string"
                            },
                            "arguments": {
                                "type": "string"
                            }
                        }
                    },
                    "id": {
                        "type": "string"
                    },
                    "type": {
                        "enum": [
                            "function"
                        ]
                    }
                },
                "description":"The name and arguments of a function that should be called, as generated by the model."
            },
            "ToolDefinition": {
                "type": "object",
                "required": [
                    "type",
                    "function"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "function"
                        ]
                    },
                    "function": {
                        "type": "object",
                        "required": [
                            "name"
                        ],
                        "properties": {
                            "name": {
                                "type": "string"
                            },
                            "description": {
                                "type": "string"
                            },
                            "parameters": {
                                "type": "object",
                                "additionalProperties": true
                            },
                            "strict": {
                                "type": "boolean",
                                "default": false
                            }
                        }
                    }
                },
                "description": "Definition of a tool that can be used by the model"
            }
        }
    }
}
```