Mistral AI Python Client SDK

repository·main·Indexed 20 days ago

https://github.com/mistralai/client-python

Official Python SDK for accessing Mistral AI's Chat Completion, Embeddings, and Agents APIs. Version 2.8.0 supports multiple cloud providers, including Azure and Google Cloud (Vertex AI), and provides tools for managing agent entities, versioning, and library access levels.

Tokens
310K
Snippets
826
Records
1K
Agent score
68%

What's inside mistralai

  1. Overview of Workflows.Runs operations

    main

    The Workflows.Runs module provides operations to manage and inspect execution runs within Mistral workflows. The available operations are:

    • list_runs: Retrieve a list of runs.
    • get_run: Retrieve details for a specific run.
    • get_run_history: Retrieve the history associated with a run.
  2. Overview of Mistral Python SDK available methods

    main

    The Mistral Python SDK provides access to a wide range of resources and operations, including core AI capabilities, beta features, and observability tools.

    Core AI & Media

    • Chat: complete, stream for chat completions.
    • Agents: complete, stream for agentic workflows.
    • Audio: Speech (complete), Transcriptions (complete, stream), and Voice management (list, create, delete, update, get, get_sample_audio).
    • Embeddings: create embeddings.
    • Classifiers: Moderation (moderate, moderate_chat) and Classification (classify, classify_chat).
    • OCR: process documents.
    • Fim: Fill-in-the-middle completions (complete, stream).

    Data & File Management

    • Files: upload, list, retrieve, delete, download, get_signed_url.
    • Models: Manage fine-tuned models (list, retrieve, delete, update, archive, unarchive).
    • Batch Jobs: Manage batch processing (list, create, get, delete, cancel).

    Beta Features

    • Conversations: Manage chat histories (start, list, get, delete, append, get_history, get_messages, restart, and streaming variants).
    • Connectors: Manage tool connectors (create, list, get_auth_url, call_tool, etc.).
    • Libraries & Documents: Manage RAG libraries and their documents (list, create, upload, get_signed_url, etc.).
    • Prompts: Manage prompt templates (list, create, get, delete, update_metadata, etc.).
    • Skills: Manage agent skills (list, create, get, delete, etc.).

    Observability & Workflows

    • Observability: Search traces, spans, logs, campaigns, and datasets to monitor and evaluate model performance.
    • Workflows: Orchestrate complex tasks using execute_workflow, manage deployments, handle executions, and schedule workflows.
  3. Overview of MistralAzure SDK

    main
    The mistralazure SDK is the Python client for accessing Mistral AI services hosted on Azure. It provides programmatic access to Mistral AI's Chat Completion and Embeddings APIs through the Azure infrastructure. To use these services, you must create an account on La Plateforme to obtain credentials and follow the official Mistral documentation for API specifications.
  4. Overview of the Connectors API

    main
    The Connectors API (currently in Beta) allows you to manage connectors within your Mistral environment. Connectors enable integration with external data sources or services, providing tools that can be called by models. The API supports lifecycle management (create, update, delete, get), activation/deactivation across different scopes (organization, workspace, user), and credential management.
  5. What remains unchanged in v2.x

    main

    The following aspects of the SDK are unaffected by the v2.x migration:

    • Method Names: All method names (e.g., chat.complete, chat.stream, embeddings.create, fim.complete, files.upload, models.list, fine_tuning.jobs.create) remain the same.
    • Endpoints: Zero endpoints were added or removed, and no paths changed.
    • Python Version: Minimum requirement remains >=3.10.
    • Installation: Use pip install mistralai.
  6. Available Operations in the Beta Agents API

    main

    The Beta Agents API provides the following operations for managing agent entities and their versions:

    • create: Create a new agent.
    • list_pages: List agent entities using cursor pagination (Recommended).
    • get: Retrieve a specific agent entity.
    • update: Update an existing agent entity.
    • delete: Delete an agent entity.
    • update_version: Update an agent version.
    • list_versions: List all versions of an agent.
    • get_version: Retrieve a specific version of an agent.
    • create_version_alias: Create or update an agent version alias.
    • list_version_aliases: List all aliases for an agent.
    • delete_version_alias: Delete an agent version alias.
  7. Use the Chat Completion API

    main

    The Chat Completion API allows you to interact with Mistral's chat models. It supports two primary modes of operation:

    1. complete: A standard request that returns the full chat completion response at once.
    2. stream: A streaming request that returns the completion in chunks, allowing for real-time text generation.

    Refer to the specific operation documentation for detailed parameter requirements and usage examples.

  8. Manage documents in a library with the Beta Libraries API

    main

    The mistral.beta.libraries.documents namespace provides a set of operations to manage documents within a specific library. This includes listing documents, uploading new ones, retrieving metadata, updating metadata, deleting documents, and accessing content via signed URLs or text extraction.

    Note: This is a beta feature and the API surface may change.