### Start Workflow Examples Source: https://github.com/mistralai/platform-docs-public/blob/main/public/studio-api/workflows/getting-started/cookbook_examples.md After setting up a project, navigate to the project directory and run this command to register workflows and start the worker. This prepares the environment for running example executions. ```bash cd my-workflow # or the name of the folder you created make start-examples ``` -------------------------------- ### Install Dependencies and Run Server Source: https://github.com/mistralai/platform-docs-public/blob/main/public/getting-started/quickstarts/vibe-code/scaffold-a-project.md After the project is scaffolded, install the necessary Python dependencies and start the Flask development server. ```bash pip install -r requirements.txt python app.py ``` -------------------------------- ### Start the CLI Source: https://github.com/mistralai/platform-docs-public/blob/main/public/vibe/code/cli/work-with-cli.md Run the CLI from your project root. You can also provide an initial prompt to guide the CLI's first action. ```bash vibe ``` ```bash vibe "Refactor the main function in cli/main.py to be more modular." ``` -------------------------------- ### Start Conversation Response Example Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/conversations/page.mdx Example of a successful response when starting a new conversation. ```APIDOC ## POST /v1/conversations/start ### Description Starts a new conversation. ### Method POST ### Endpoint /v1/conversations/start ### Response #### Success Response (200) - **conversation_id** (string) - The unique identifier for the conversation. - **outputs** (array) - A list of outputs from the conversation. - **content** (string) - The content of an output. - **usage** (object) - Information about the token usage for the conversation. #### Response Example ```json { "conversation_id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "outputs": [ { "content": "Example content." } ], "usage": {} } ``` ``` -------------------------------- ### Run Interactive CLI Setup Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/vibe/code/cli/api-keys-profiles/page.mdx Initiate the CLI setup flow to configure API keys. This is the recommended method for first-time users and saves the key to `~/.vibe/.env`. ```bash vibe ``` ```bash vibe --setup ``` -------------------------------- ### Create Project Directory and Launch Vibe CLI Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/getting-started/quickstarts/vibe-code/scaffold-a-project/page.mdx Start by creating a new, empty directory for your project and then navigate into it. Launch the Vibe CLI within this directory to begin scaffolding. ```bash mkdir my-project && cd my-project vibe ``` -------------------------------- ### Get Users API Response Example (200 OK) Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/admin/users/page.mdx This is an example of a successful response from the Get Users API endpoint. It includes lists of 'invites' and 'members', along with pagination details if provided. ```json { "invites": [ { "created_at": "2025-12-17T10:25:07.818693Z", "email": "ipsum eiusmod", "expired": false, "raw_role": "A", "raw_roles": [ "A" ], "uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088" } ], "members": [ { "created_at": "2025-12-17T10:25:07.818693Z", "email": null, "name": null, "oid_id": null, "raw_role": "A", "raw_roles": [ "A" ], "uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088" } ], "page": null, "page_size": null, "total": null } ``` -------------------------------- ### Run Vibe CLI Setup Source: https://github.com/mistralai/platform-docs-public/blob/main/public/vibe/code/cli/api-keys-profiles.md Initiate the interactive setup flow for the Vibe CLI to configure API keys. This is recommended for first-time use or to reconfigure. ```bash vibe ``` ```bash vibe --setup ``` -------------------------------- ### Response Example for Get Schedules Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/workflows/schedules/page.mdx Example JSON response when successfully retrieving workflow schedules. ```json { "schedules": [ { "input": "Example input.", "paused": false, "schedule_id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "workflow_name": "support-workflow" } ] } ``` -------------------------------- ### Manual Install Vibe CLI with uv Source: https://github.com/mistralai/platform-docs-public/blob/main/public/getting-started/quickstarts/vibe-code/install-cli.md Recommended manual installation method for macOS, Linux, and Windows using `uv`. ```bash uv tool install mistral-vibe ``` -------------------------------- ### Document Annotation Prompt Example Source: https://github.com/mistralai/platform-docs-public/blob/main/public/studio-api/document-processing/annotations.md Provides an example of a system prompt to guide the document annotation process. ```APIDOC ## Document Annotation Prompt ### Description An optional prompt that provides high-level system instructions for the annotation step, offering further context and guidance. ### Example (Python) ```python document_annotation_prompt = """ Extract the following from the provided PDF document: - Language (e.g., "English") - All chapter/section titles (e.g., ["Abstract", "1 Introduction"]) - All URLs (e.g., ["https://example.com"]) Be precise and include only exact matches. """ ``` ### Example (TypeScript) ```typescript const documentAnnotationPrompt = ` Extract the following from the provided PDF document: - Language (e.g., "English") - All chapter/section titles (e.g., ["Abstract", "1 Introduction"]) - All URLs (e.g., ["https://example.com"]) Be precise and include only exact matches. `; ``` ### Example (Curl) ```bash "document_annotation_prompt": "Extract the following from the provided PDF document:\n- Language (e.g., \"English\")\n- All chapter/section titles (e.g., [\"Abstract\", \"1 Introduction\"])\n- All URLs (e.g., [\"https://example.com\"])\nBe precise and include only exact matches." ``` ``` -------------------------------- ### Basic Semantic Cache Setup Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/studio-api/search-toolkit/retrieval/semantic-cache/page.mdx Demonstrates the core setup for a semantic cache using an in-memory backend. It involves creating a cache backend, initializing the semantic cache with a similarity threshold, and then wrapping an existing query engine with the cache. ```python from mistralai.search.toolkit.retrieval.cache import ( CachedQueryEngine, InMemoryCacheBackend, SemanticCache, EvictionPolicy, ) # 1. Create a cache backend backend = InMemoryCacheBackend( dim=1024, # Embedding dimensionality max_entries=500, # Max cached queries ttl_seconds=3600, # 1-hour expiration eviction_policy=EvictionPolicy.LRU, ) # 2. Create the semantic cache cache = SemanticCache( backend=backend, similarity_threshold=0.95, # 95% cosine similarity = cache hit ) # 3. Wrap your QueryEngine cached_engine = CachedQueryEngine( engine=query_engine, cache=cache, embedder=embedder, # Used to embed incoming queries ) # 4. Use normally. Caching is transparent. result = await cached_engine.search("What is RAG?", top_k=10) # First call: embedding + retrieval → cached # Second call with similar query: cache hit → instant ``` -------------------------------- ### Request Body Example for Conversation Stream Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/conversations/page.mdx Provides an example JSON payload for the request body when starting a conversation stream. ```json { "inputs": "Example input." } ``` -------------------------------- ### Start Development Server Source: https://github.com/mistralai/platform-docs-public/blob/main/CLAUDE.md Starts the development server. It first builds cookbooks and exports raw MDX, then runs the Next.js development server. ```bash pnpm dev ``` -------------------------------- ### Get Deployment by Name Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/workflows/deployments/page.mdx This example shows how to retrieve a deployment's details using its name via a GET request. ```APIDOC ## GET /v1/workflows/deployments/{name} ### Description Retrieves the details of a specific deployment. ### Method GET ### Endpoint /v1/workflows/deployments/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the deployment to retrieve. ### Request Example ```curl curl https://api.mistral.ai/v1/workflows/deployments/{name} \ -X GET \ -H 'Authorization: Bearer YOUR_APIKEY_HERE' ``` ### Response #### Success Response (200) - **created_at** (date-time) - Required - When the deployment was first registered - **id** (string) - Required - The unique identifier for the deployment - **is_active** (boolean) - Required - Indicates if the deployment is currently active - **name** (string) - Required - The name of the deployment - **updated_at** (date-time) - Required - When the deployment was last updated - **workers** (array) - Required - A list of workers associated with the deployment - **created_at** (date-time) - Required - When the worker was first registered - **is_active** (boolean) - Required - Indicates if the worker is currently active - **name** (string) - Required - The name of the worker - **updated_at** (date-time) - Required - When the worker was last updated #### Response Example ```json { "created_at": "2025-12-17T10:25:07.818693Z", "id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "is_active": false, "name": "My resource", "updated_at": "2025-12-17T10:41:03.469341Z", "workers": [ { "created_at": "2025-12-17T10:25:07.818693Z", "is_active": false, "name": "My resource", "updated_at": "2025-12-17T10:41:03.469341Z" } ] } ``` ``` -------------------------------- ### Launch Vibe CLI Setup Wizard Source: https://github.com/mistralai/platform-docs-public/blob/main/public/getting-started/quickstarts/vibe-code/install-cli.md Run this command to launch the Vibe CLI setup wizard, which helps in registering your API key. ```bash vibe ``` -------------------------------- ### Get Extracted Text Signed URL Response Example Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/libraries/documents/page.mdx This is an example of a successful JSON response containing a signed URL. ```json "https://example.com/signed-url" ``` -------------------------------- ### Install All Search Toolkit Extras Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/studio-api/search-toolkit/page.mdx Install the core package with all available optional extras for comprehensive functionality. This command uses uv for dependency management. ```bash uv add "mistralai-search-toolkit[all]" ``` -------------------------------- ### Install pnpm and Node on macOS Source: https://github.com/mistralai/platform-docs-public/blob/main/README.md Install Node.js and pnpm package manager on macOS using Homebrew. These are prerequisites for project setup. ```bash brew install pnpm brew install node ``` -------------------------------- ### Create Directory and Launch Vibe CLI Source: https://github.com/mistralai/platform-docs-public/blob/main/public/getting-started/quickstarts/vibe-code/scaffold-a-project.md Start in a fresh directory to ensure the CLI generates the project from scratch. If you run `vibe` in an existing project with a `.vibe/` directory, the CLI will ask for confirmation. ```bash mkdir my-project && cd my-project vibe ``` -------------------------------- ### Start Streaming Conversation with cURL Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/studio-api/agents/agents-api/streaming/_page.mdx Initiates a streaming conversation using cURL. This example shows the HTTP request structure for starting a stream. ```bash curl --location "https://api.mistral.ai/v1/conversations" \ --header 'Content-Type: application/json' \ --header 'Accept: text/event-stream' \ --header "Authorization: Bearer $MISTRAL_API_KEY" \ --data '{ "inputs": "Who is Albert Einstein?", "stream": true, "agent_id": "ag_06811008e6e07cb48000fd3f133e1771" }' ``` -------------------------------- ### Install Mistral AI Python SDK Source: https://github.com/mistralai/platform-docs-public/blob/main/public/getting-started/quickstarts/developer/first-api-request.md Install the Mistral AI Python SDK using pip. This is a prerequisite for running Python examples. ```bash pip install mistralai ``` -------------------------------- ### Example Fine-tuning Instance with Instructions Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/_guides/finetuning_sections/_02_prepare_dataset/page.mdx Shows a single data instance formatted for fine-tuning, where the user message includes instructions for extracting structured information. ```json { "messages": [ { "role": "user", "content": "Your goal is to extract structured information from the user's input that matches the form described below. When extracting information please make sure it matches the type information exactly...Input: DETAILED_MEDICAL_NOTES" }, { "role": "assistant", "content": "{'conditions': 'Proteinuria', 'interventions': 'Drug: Losartan Potassium|Other: Comparator: Placebo (Losartan)|Drug: Comparator: amlodipine besylate|Other: Comparator: Placebo (amlodipine besylate)|Other: Placebo (Losartan)|Drug: Enalapril Maleate'}" } ] } ``` -------------------------------- ### Response Example for Get User Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/admin/users/page.mdx This is an example of a successful JSON response when retrieving user details. The 'uuid' field uniquely identifies the user. ```json { "email": null, "first_name": null, "last_name": null, "uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088" } ``` -------------------------------- ### Response Example for Get Spend Limits Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/admin/billing/page.mdx This is an example of a successful response when retrieving spend limits. It includes information about monthly limits and currency. ```json { "limits": { "completion": { "monthly_limit_reached": false }, "currency": "ipsum eiusmod", "last_payment_failure": false, "last_payment_failure_protection": null } } ``` -------------------------------- ### Configuration Example Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/studio-api/connectors/confirmation/page.mdx Example of how to configure tools to require confirmation. ```APIDOC ## Configuration Add `requires_confirmation` to the `tool_configuration` of any Connector or built-in tool, and list the tool names that require approval: ```json [ { "type": "connector", "connector_id": "gmail", "tool_configuration": { "requires_confirmation": ["gmail_search"] } }, { "type": "web_search_premium", "tool_configuration": { "requires_confirmation": ["web_search", "news_search"] } } ] ``` ``` -------------------------------- ### Run Python Quickstart Script Source: https://github.com/mistralai/platform-docs-public/blob/main/public/getting-started/quickstarts/developer/first-api-request.md Execute the Python script that sends a request to the Mistral API. This assumes the script is saved as quickstart.py. ```bash python quickstart.py ``` -------------------------------- ### Response Example for Get Text Content Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/libraries/documents/page.mdx This is an example of a successful JSON response when retrieving text content from a document. It contains the extracted text. ```json { "text": "Example text." } ``` -------------------------------- ### Launch Vibe CLI Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/getting-started/quickstarts/vibe-code/install-cli/page.mdx Open a terminal in your project directory and run the 'vibe' command to launch the CLI. This will initiate a setup wizard for API key registration. ```bash vibe ``` -------------------------------- ### Get Prompt Version using cURL Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/prompts/page.mdx An example using cURL to make a GET request to the Get Prompt Version endpoint. Replace placeholders with your actual prompt ID, version, and API key. ```curl curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions/{version} \ -X GET \ -H 'Authorization: Bearer YOUR_APIKEY_HERE' ``` -------------------------------- ### Example Transcription Response with Diarization Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/studio-api/audio/speech_to_text/offline_transcription/passing_transcription_audio_url_tab/diarization_tab/_page.mdx This is an example of a transcription response that includes speaker diarization. Each segment is tagged with a speaker ID, start, and end times. ```json { "segments": [ {"text": "It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours.", "start": 165.5, "end": 174.8, "speaker_id": "speaker_1", "type": "transcription_segment"}, {"text": "Because for all our outward differences, we all share the same proud title, citizen.", "start": 175.7, "end": 181.9, "speaker_id": "speaker_1", "type": "transcription_segment"}, {"text": "It has been the honor of my life to serve you as President.", "start": 183.3, "end": 186.1, "speaker_id": "speaker_1", "type": "transcription_segment"}, {"text": "Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain.", "start": 187.1, "end": 197.5, "speaker_id": "speaker_1", "type": "transcription_segment"}, {"text": "Thanks, everybody.", "start": 198.7, "end": 199.8, "speaker_id": "speaker_1", "type": "transcription_segment"}, {"text": "God bless you, and God bless the United States of America.", "start": 200.1, "end": 203.5, "speaker_id": "speaker_1", "type": "transcription_segment"} ], "usage": { "prompt_audio_seconds": 203, "prompt_tokens": 7, "total_tokens": 938, "completion_tokens": 931, "request_count": 1, "num_cached_tokens": 0 }, "type": "transcription.done" } ``` -------------------------------- ### Start Local Development Server Source: https://github.com/mistralai/platform-docs-public/blob/main/README.md Launch a local development server for live previewing changes. The server typically runs at http://localhost:3000. ```bash pnpm dev ``` -------------------------------- ### List Deployments Output Example Source: https://github.com/mistralai/platform-docs-public/blob/main/public/studio-api/workflows/managing-workflows-in-production/deployments.md Example JSON output for listing deployments, showing deployment ID, name, active status, and creation/update timestamps. ```json { "deployments": [ { "id": "019d2585-21fc-7063-90ae-31a283c784a1", "name": "invoice-service", "is_active": true, "created_at": "2026-03-25 15:02:55.234755+00:00", "updated_at": "2026-04-02 17:42:34.960883+00:00" } ] } ``` -------------------------------- ### Response Example for Get Index Summaries Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/rag/search_indexes/page.mdx This JSON structure represents a successful response from the GET /v1/rag/indexes/summary endpoint, detailing information about each search index. ```json [ { "created_at": "2025-12-17T10:25:07.818693Z", "creator_id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "document_count": 87, "id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "index": { "k8s_cluster": "production-cluster", "k8s_namespace": "search", "schemas": [ { "document_count": null, "id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "name": "My resource" } ], "vespa_instance_name": "mistral-search" }, "modified_at": "2025-12-17T10:41:03.469341Z", "name": "My resource", "status": "online" } ] ``` -------------------------------- ### First Prompt Example Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/vibe/code/vs-code-extension/install-authenticate/page.mdx Try this simple prompt to verify that the Mistral Vibe extension is set up correctly and can access your file context. ```text Explain the currently open file. ``` -------------------------------- ### Example Response for Get Invite Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/admin/users/page.mdx This is an example of a successful response (200 OK) when retrieving pending organization invitations. It shows the structure of the invitation data returned. ```json [ { "email": null, "invite_uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088", "role": "A", "roles": [ "A" ] } ] ``` -------------------------------- ### Example Response for Get Index Schema File Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/rag/search_indexes/page.mdx This example shows a successful JSON response when retrieving a schema file. The 'content' field can be a string or null. ```json Example content. ``` -------------------------------- ### Complete Deal Analysis Workflow Example Source: https://github.com/mistralai/platform-docs-public/blob/main/public/studio-api/workflows/building-workflows/durable_agents.md A comprehensive example demonstrating a workflow with custom activities, agent coordination, and handoffs using RemoteSession. Includes agent definitions and workflow execution. ```python import asyncio import mistralai.workflows as workflows import mistralai.workflows.plugins.mistralai as workflows_mistralai from mistralai.client.models import TextChunk @workflows.activity() async def calculate_risk_score(deal_type: str, amount: float) -> dict: """Calculate financial risk score for a deal. Args: deal_type: The type of deal being analyzed amount: The monetary amount of the deal """ risk_score = min(100.0, amount / 10000.0) risk_factors = [] if amount > 100000: risk_factors.append("High value transaction") return {"risk_score": risk_score, "risk_factors": risk_factors} @workflows.workflow.define(name="deal_analysis_workflow") class DealAnalysisWorkflow: @workflows.workflow.entrypoint async def entrypoint(self, deal_request: str) -> dict: """Analyze a deal request. Args: deal_request: The deal request to analyze """ session = workflows_mistralai.RemoteSession() # Risk assessment agent risk_agent = workflows_mistralai.Agent( model="mistral-medium-latest", name="risk-agent", description="Analyzes financial risk of deals", instructions="Use the risk calculation tool to assess deal risk.", tools=[calculate_risk_score], ) # Main coordinator agent coordinator = workflows_mistralai.Agent( model="mistral-medium-latest", name="deal-coordinator", description="Coordinates deal analysis", instructions="Analyze the deal request and hand off to specialists.", handoffs=[risk_agent], ) outputs = await workflows_mistralai.Runner.run( agent=coordinator, inputs=deal_request, session=session, ) analysis = "\n".join([ output.text for output in outputs if isinstance(output, TextChunk) ]) return {"analysis": analysis} if __name__ == "__main__": asyncio.run(workflows.run_worker([DealAnalysisWorkflow])) ``` -------------------------------- ### Create a Web Search Agent in Python Source: https://github.com/mistralai/platform-docs-public/blob/main/public/llms-full.txt This example demonstrates creating an agent with the built-in web search tool. It configures the agent to use `web_search` for up-to-date information and sets a specific temperature and top_p for completions. ```python websearch_agent = client.beta.agents.create( model="mistral-medium-2505", description="Agent able to search information over the web, such as news, weather, sport results...", name="Websearch Agent", instructions="You have the ability to perform web searches with `web_search` to find up-to-date information.", tools=[{"type": "web_search"}], completion_args={ "temperature": 0.3, "top_p": 0.95, } ) ``` -------------------------------- ### Request Body Example for Starting a Conversation Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/conversations/page.mdx This JSON object shows the structure for the request body when starting a new conversation. It includes the 'inputs' field for your initial prompt. ```json { "inputs": "Example input." } ``` -------------------------------- ### Manual Install Vibe CLI with pip Source: https://github.com/mistralai/platform-docs-public/blob/main/public/getting-started/quickstarts/vibe-code/install-cli.md Alternative manual installation method using `pip`. ```bash pip install mistral-vibe ``` -------------------------------- ### Get Workflow Registrations Response Example Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/workflows/page.mdx This is an example of a successful JSON response when retrieving workflow registrations. It includes details about next cursor, workflow registrations, and workflow versions. ```json { "next_cursor": null, "workflow_registrations": [ { "definition": { "input_schema": [ null ] }, "id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "workflow_id": "019b2bd7-96e7-7219-8c0b-45a73da50088" } ], "workflow_versions": [ { "definition": { "input_schema": [ null ] }, "id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "workflow_id": "019b2bd7-96e7-7219-8c0b-45a73da50088" } ] } ``` -------------------------------- ### Check Node.js Version Source: https://github.com/mistralai/platform-docs-public/blob/main/scannability_test_report.md Command to check the installed Node.js version. Required for TypeScript examples. ```bash node --version ``` -------------------------------- ### Create Agent with Web Search Tool Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/studio-api/agents/handoffs/page.mdx Example of creating an agent that can search online for information. This agent is configured with a 'web_search' tool. ```bash curl --location "https://api.mistral.ai/v1/agents" \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header "Authorization: Bearer $MISTRAL_API_KEY" \ --data '{ \ "model": "mistral-large-latest", \ "name": "web-search-agent", \ "description": "Agent that can search online for any information if needed", \ "tools": [{"type": "web_search"}] \ }' ``` -------------------------------- ### Response Example (JSON) Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/libraries/page.mdx This is an example of a successful response when retrieving library details. It includes information such as creation date, ID, name, and size. ```json { "chunk_size": null, "created_at": "2025-12-17T10:25:07.818693Z", "id": "019b2bd7-96e7-7219-8c0b-45a73da50088", "name": "My resource", "nb_documents": "426", "owner_id": null, "owner_type": "User", "total_size": "6436546", "updated_at": "2025-12-17T10:41:03.469341Z" } ``` -------------------------------- ### Start a Conversation in Python Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/api/endpoint/beta/conversations/page.mdx This Python snippet demonstrates how to start a conversation and get the conversation ID using the Mistral AI Python SDK. Make sure the MISTRAL_API_KEY environment variable is configured. ```python import os from mistralai import Mistral client = Mistral(api_key=os.environ["MISTRAL_API_KEY"]) conversation = client.beta.conversations.start( inputs="Help me summarize this document.", stream=False, ) print(conversation.id) ``` -------------------------------- ### Initialize Mistral Client (V2 SDK) Source: https://github.com/mistralai/platform-docs-public/blob/main/public/studio-api/knowledge-rag/rag_quickstart.md Installs and imports necessary packages for RAG, then initializes the Mistral client with your API key. Use this for setting up your environment. ```python from mistralai.client import Mistral import requests import numpy as np import faiss import os from getpass import getpass api_key = getpass("Type your API key") client = Mistral(api_key=api_key) ``` -------------------------------- ### Workflow Failure Example Source: https://github.com/mistralai/platform-docs-public/blob/main/public/vibe/work/workflows.md This example shows the typical output when a Workflow fails due to access restrictions, such as an account tier limitation. The output includes a 'started' message, the error reason, and a 'failed' message. ```text Workflow started: vibe-nuage Your account tier (free) does not have access to this feature Workflow failed: vibe-nuage ``` -------------------------------- ### Direct Example in Prompt Source: https://github.com/mistralai/platform-docs-public/blob/main/public/studio-api/conversations/chat-completion/prompting.md A concise example showing the input and expected output format within a prompt. This illustrates a direct interaction pattern. ```plaintext [...] # Examples Input: Hello, how are you? Output: {"language_iso": "en"} [...] ``` -------------------------------- ### Start Conversation with Moderation Source: https://github.com/mistralai/platform-docs-public/blob/main/public/studio-api/conversations/moderation.md This example demonstrates how to start a conversation with moderation enabled by specifying guardrails directly in the request. It shows how to set custom thresholds for specific categories and define the action to take if a guardrail is violated. ```APIDOC ## POST /v1/conversations ### Description Starts a new conversation with specified inputs, model, and guardrails for content moderation. ### Method POST ### Endpoint /v1/conversations ### Parameters #### Request Body - **model** (string) - Required - The model to use for the conversation. - **inputs** (array) - Required - An array of message objects representing the conversation history. - **guardrails** (array) - Optional - An array of guardrail configurations. - **blockOnError** (boolean) - Optional - If true, the request will be blocked if a guardrail error occurs. - **moderationLlmV2** (object) - Optional - Configuration for the v2 moderation LLM. - **customCategoryThresholds** (object) - Optional - A map of category names to their threshold values. - **sexual** (number) - Optional - Threshold for sexual content. - **selfharm** (number) - Optional - Threshold for self-harm content. - **ignoreOtherCategories** (boolean) - Optional - If true, other categories will be ignored. - **action** (string) - Optional - The action to take when a guardrail is violated (e.g., "block"). ### Request Example ```json { "model": "mistral-small-latest", "inputs": [{ "role": "user", "content": "How far is the moon from Earth?" }], "guardrails": [ { "block_on_error": true, "moderation_llm_v2": { "custom_category_thresholds": { "sexual": 0.1, "selfharm": 0.1 }, "ignore_other_categories": false, "action": "block" } } ] } ``` ### Response #### Success Response (200) - **object** (string) - Type of the response object. - **conversation_id** (string) - The ID of the conversation. - **outputs** (array) - An array of message objects representing the model's response. - **usage** (object) - Token usage information. - **guardrails** (array) - Information about the applied guardrails and their results. ``` -------------------------------- ### Vibe Code Slack Task Examples Source: https://github.com/mistralai/platform-docs-public/blob/main/src/content/en/docs/vibe/code/vibe-code-web/slack-integration/page.mdx Examples of how to prompt Vibe Code in Slack for different development tasks. These prompts guide Vibe to perform specific actions like fixing bugs or updating documentation. ```text @Vibe use the customer report above to find the likely bug. Open a PR if you can reproduce or identify a clear fix. ``` ```text @Vibe investigate this alert and check whether there is a code or config fix. Start with a summary, then open a PR only if the change is low risk. ``` ```text @Vibe implement the copy/config change we agreed on above and open a PR. ``` ```text @Vibe add a regression test for the edge case described in this thread. Keep the implementation unchanged unless the test exposes a bug. ``` ```text @Vibe update the docs based on the behavior described above. Open a PR with the doc-only change. ``` ```text @Vibe refactor the helper discussed above. Keep behavior unchanged and run the relevant tests before opening a PR. ``` -------------------------------- ### Fetch and Build API Documentation Source: https://github.com/mistralai/platform-docs-public/blob/main/src/scripts/api/README.md Use this sequence of commands to pull the latest API specification, build the documentation (including MDX generation and postprocessing), and audit for changes. This is typically followed by a review step. ```bash pnpm api:fetch # pull latest spec pnpm api:build # apply + docs-md + postprocess (regenerates MDX) pnpm api:audit # parse MDX, find lorem hits, write draft ``` -------------------------------- ### Document Annotation Prompt Examples Source: https://github.com/mistralai/platform-docs-public/blob/main/public/studio-api/document-processing/annotations.md Provides examples of system prompts for document annotation in Python, TypeScript, and cURL. These prompts guide the model on extracting specific information like language, chapter titles, and URLs from documents. ```python document_annotation_prompt = """ Extract the following from the provided PDF document: - Language (e.g., "English") - All chapter/section titles (e.g., ["Abstract", "1 Introduction"]) - All URLs (e.g., ["https://example.com"]) Be precise and include only exact matches. """ ``` ```typescript const documentAnnotationPrompt = ` Extract the following from the provided PDF document: - Language (e.g., "English") - All chapter/section titles (e.g., ["Abstract", "1 Introduction"]) - All URLs (e.g., ["https://example.com"]) Be precise and include only exact matches. `; ``` ```bash "document_annotation_prompt": "Extract the following from the provided PDF document:\n- Language (e.g., \"English\")\n- All chapter/section titles (e.g., [\"Abstract\", \"1 Introduction\"])\n- All URLs (e.g., [\"https://example.com\"])\nBe precise and include only exact matches." ``` -------------------------------- ### Promote Draft Proposals Source: https://github.com/mistralai/platform-docs-public/blob/main/src/scripts/api/README.md Moves draft API examples into the versioned `api-examples.yaml` file, preparing them for promotion. ```bash pnpm api:promote ```