MistralClient.Models (mistralex_ai v0.1.0)

View Source

Core data structures for the Mistral AI client.

This module defines structs and types that represent the various data structures used throughout the Mistral API, providing type safety and clear documentation of expected data formats.

Message Types

  • Message - Chat message with role and content
  • ToolCall - Function/tool call within a message
  • ToolCallFunction - Function details for a tool call

Response Types

  • ChatCompletion - Complete chat response
  • ChatCompletionChoice - Individual choice in chat response
  • ChatCompletionMessage - Message in chat completion
  • Usage - Token usage information
  • EmbeddingResponse - Embedding generation response
  • Embedding - Individual embedding data

Model Types

  • Model - Model information
  • ModelPermission - Model access permissions

File Types

  • File - File metadata
  • FileUpload - File upload response

Usage

# Create a message
message = %MistralClient.Models.Message{
  role: "user",
  content: "Hello, world!"
}

# Parse a chat completion response
{:ok, completion} = MistralClient.Models.ChatCompletion.from_map(response_data)