Learning resourcesReviewed · Mistral AI

Mistral: Quickstart: call your own functions

This Mistral tutorial teaches Python developers to connect an AI model to their own functions, but its small order-lookup example leaves validation and error handling to the reader. It uses the mistralai SDK and mistral-small-latest to request a function call, execute local Python and return the result for a final answer.

Researched 14 Nov 2026

In short.

This Mistral quickstart teaches Python developers to let a model request their own functions, but its demonstration omits safeguards needed when connecting real systems. Two API requests surround a local order-status lookup: the model proposes a function call, Python executes it, and the model receives its result to compose an answer. The page explains that developers retain control over execution and should check function names and arguments. It estimates about 10 minutes, but nothing was executed and completion time was not assessed. API costs, exact dependency versions and reuse terms are unspecified.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete page at [https://docs.mistral.ai/inference/quickstarts/call-your-own-functions.md], including prerequisites, setup, the full script, execution instructions, illustrative output and further-reading links. Linked pages, API-key creation instructions and uv installation documentation are excluded. No license notice appears on the page. Nothing was executed; installation success, runtime behavior, output, timing and actual charges remain unverified.

The overview

Identity

Quickstart: call your own functions is a Python tutorial in Mistral's inference documentation. Its source address is [https://docs.mistral.ai/inference/quickstarts/call-your-own-functions.md].

The tutorial introduces function calling: describing an application function to a model, receiving a request to call it, executing it in application code and returning the result to the conversation.

Assessment

The example makes the exchange easy to inspect because the function reads a small table embedded in the script. Readers can follow the tool description, requested arguments, local execution and returned message without setting up an order database.

It is useful for understanding the basic integration pattern. Its usefulness as a production implementation is limited by direct execution of model-supplied arguments, missing error handling and the absence of a continuing tool-call loop. Runtime behavior has not been assessed.

Users

The guide suits Python developers learning how to connect model conversations to application data. Beginners should be comfortable creating a Python project, setting an environment variable and reading dictionaries, functions and JSON.

Experienced developers can inspect the SDK's tool schema and conversation-message structure, particularly how an assistant's tool request is retained and how tool_call_id associates the returned result with that request. Authentication, real data access and operational controls remain application work.

Capabilities

The tutorial describes get_order_status as a function tool with a JSON Schema requiring an order_id string. It demonstrates submitting that description with a user question, reading the returned tool calls and converting arguments from JSON when necessary.

It also shows serializing a Python result into a tool message and requesting a final model answer. The demonstrated data source is a fixed table containing two orders; no live order service or database integration is included.

Using it

Requirements

The stated prerequisites are a Mistral API key, Python 3.10 or later and uv. The setup command specifically requests Python 3.12 and installs the mistralai package.

The script reads the key from MISTRAL_API_KEY, imports Mistral from mistralai.client and calls mistral-small-latest through Mistral's API. No SDK version, hardware requirement, account quota or model-access condition is specified.

Mechanism

The first chat.complete request sends the user question and tool definition. The script appends the assistant response to the conversation, then iterates over any returned tool calls and parses their arguments.

Application code calls get_order_status and appends its JSON result as a tool message containing the function name and tool_call_id. A second chat.complete request receives the accumulated conversation, and the script prints its response content.

The model requests an operation; the Python process performs it. The page explicitly says the model never runs the developer's code and instructs developers to check the requested name and arguments before execution.

Setup

The documented setup creates a project with uv init call-functions --python 3.12, enters it with cd call-functions and installs the SDK with uv add mistralai. The API key is supplied through the MISTRAL_API_KEY environment variable.

The reader saves the supplied Python example as functions.py and starts it with uv run functions.py. These are documented instructions; no commands or code were executed, and installation or execution success is unknown.

Example

The sample question asks where order A-1042 is. The embedded table assigns that order the status shipped and assigns A-1043 the status in preparation. Other identifiers produce the status unknown.

The page illustrates a requested get_order_status call followed by a natural-language answer saying A-1042 has shipped. It notes that answer wording varies between runs. This is illustrative source output, not an observed execution result.

Assessment & evidence

Limitations

Although the page advises checking function names and arguments, the sample directly calls get_order_status with the returned arguments. It does not check the requested function name or independently validate argument keys and types. The tool schema communicates expected arguments but the script supplies no application validation.

The example includes no handling for malformed JSON, function errors or API failures, and no caller authorization for order access. It processes tool calls from the first response, then prints the second response without handling further tool requests.

The table is demonstration data. Integration with real systems, reliability, latency, security and compatibility with a particular installed SDK version have not been assessed.

Why the approach is useful

The useful design choice is to keep the lookup in application code and provide its result to the model. In the example, the order status comes from a defined table, while the model turns the returned value into a conversational answer.

This separation gives developers a place to control permitted operations and returned data. Effective control depends on application checks; the demonstration's tool description does not itself implement those checks.

Related resources and alternatives

The page points readers to a fuller function-calling guide at [https://docs.mistral.ai/inference/conversations/function-calling], a structured-output quickstart at [https://docs.mistral.ai/inference/quickstarts/get-structured-output] and a connector quickstart at [https://docs.mistral.ai/studio/connectors/quickstart].

Those linked pages were not reviewed. Their requirements and capabilities were not assessed, and the selected page does not establish when structured output or a connector could replace this function-calling approach.

Evidence

The source is the complete Mistral quickstart page at [https://docs.mistral.ai/inference/quickstarts/call-your-own-functions.md]. It contains prerequisites, setup commands, the Python script, illustrative output and further-reading links.

The evidence establishes what the documentation presents; it provides no measured benchmark or independently observed execution result.

Access & freshness

Costs

The page gives no API prices, free allowances, quotas or total cost. The script contains two chat.complete invocations, but token usage and charges are not established, so the cost of following the tutorial is unknown.

The stated duration of about 10 minutes is the page's estimate. Actual completion time was not assessed.

Rights

The page includes no explicit license or reuse notice for its documentation or Python example. Permission to redistribute either is unknown from this evidence.

SDK licensing and Mistral API terms are also not established by the selected page. Public availability of the example does not establish a particular reuse license.

Freshness

This review reflects the page as retrieved on 2026-11-14 (UTC). The page text gives no publication date or last-update date, so its maintenance history is unknown.

The setup does not pin the mistralai version, and the script uses the model identifier mistral-small-latest without a fixed model revision. The exact dependency and model versions are therefore not established. Current compatibility and availability remain unknown.

Practical next steps

Use the example to trace how the tool schema, assistant request and tool result connect. When adapting it, replace the fixed table with the intended data source and explicitly validate the requested function name and arguments before execution.

Before connecting real order data, add caller authorization and handling for parsing, API and function failures. Decide how additional tool requests should be handled. Record the SDK version and model identifier used, verify the adapted script in your environment, and confirm current API pricing and applicable reuse terms.

Evidence for this report

selected-page.txtselected · checked 2026-11-14