Mistral API provider

AI providers ::: aiprovider_mistral
Maintained by Pierre Duverneix
A Moodle AI provider plugin that integrates Mistral AI into Moodle's AI subsystem, enabling text generation, text summarisation, text explanation, and image generation.
Latest release:
3 sites
22 downloads
Current versions available: 1

Mistral AI Provider for Moodle

A Moodle AI provider plugin that integrates Mistral AI into Moodle's AI subsystem, enabling text generation, text summarisation, text explanation, and image generation.

Features

  • Text generation
  • Text summarisation
  • Text explanation
  • Image generation

Requirements

Configuration

Provider settings
Setting Description
API key Your Mistral API key from console.mistral.ai
Organisation ID Your Mistral organisation ID (optional)

Action settings

Each action (generate text, summarise text, explain text, generate image) can be configured independently with:

Setting Description
Model The Mistral model to use, fetched from the API
Endpoint The Mistral API endpoint (pre-filled with the correct default)
System instruction Custom system prompt (text actions only)
Extra parameters Additional model parameters in JSON format (see bellow)

Supported extra parameters
{
  "temperature": 0.7,
  "max_tokens": 500,
  "top_p": 0.95,
  "safe_prompt": false
}
 

Refer to the Mistral API documentation for all supported parameters.

Architecture

Text actions

Text generation, summarisation, and explanation all use the Mistral chat completions API (/v1/chat/completions).

Image generation

Image generation uses Mistral's agent API, which internally uses Black Forest Labs' Flux model. The flow is:

The image generation agent is created once and its ID is cached in Moodle's plugin config via set_config() to avoid hitting API rate limits. If the cached agent is deleted from Mistral Studio, it is automatically recreated on the next request.

Image resolutions

Images are generated using Black Forest Labs' Flux aspect ratio:

Moodle ratio Size Aspect
Square 1024×1024 1:1
Landscape 1792×1024 7:4
Portrait 1024×1792 4:7

Developed by Fondation UNIT.

Screenshots

Screenshot #0

Contributors

Pierre Duverneix (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments

Show comments
Please login to post comments