mistralai_dart 1.2.1
mistralai_dart: ^1.2.1 copied to clipboard
Dart client for the Mistral AI API - chat, embeddings, fine-tuning, agents, and more.
1.2.1 #
1.2.0 #
1.1.0 #
Added withApiKey convenience constructor and replaced Object? stop with a type-safe StopSequence sealed class for improved API safety.
1.0.0 #
Note: This release has breaking changes.
TL;DR: Complete reimplementation with a new architecture, minimal dependencies, resource-based API, and improved developer experience. Hand-crafted models (no code generation), interceptor-driven architecture, comprehensive error handling, and full Mistral AI API coverage including stable and beta endpoints.
What's new #
- Resource-based API organization:
client.chat— Chat completions (streaming, tool calling, multimodal, JSON mode)client.embeddings— Text embeddings for semantic search and clusteringclient.models— Model listing and retrievalclient.fim— Fill-in-the-Middle code completions (Codestral)client.files— File upload and managementclient.fineTuning— Fine-tuning jobs and model managementclient.batch— Asynchronous large-scale batch processingclient.moderations— Content moderation for safetyclient.classifications— Text classification (spam, topic, sentiment)client.ocr— OCR for documents and imagesclient.audio— Speech-to-text transcription with streamingclient.agents— Pre-configured AI assistants (beta)client.conversations— Stateful multi-turn conversations (beta)client.libraries— Document storage and retrieval for RAG (beta)
- Architecture:
- Interceptor chain (Auth → Logging → Error → Transport with Retry wrapper).
- Authentication: API key or custom via
AuthProviderinterface. - Retry with exponential backoff + jitter (only for idempotent methods on 429, 5xx, timeouts).
- Abortable requests via
abortTriggerparameter. - SSE streaming parser for real-time responses with
[DONE]marker handling. - Central
MistralConfig(timeouts, retry policy, log level, baseUrl, auth).
- Hand-crafted models:
- No code generation dependencies (no freezed, json_serializable).
- Minimal runtime dependencies (
http,loggingonly). - Immutable models with
copyWithusing sentinel pattern for nullable fields. - Full type safety with sealed exception hierarchy.
- Sealed classes for polymorphic types (
ChatMessage,ContentPart,ToolChoice,ResponseFormat,Tool,OcrDocument).
- Improved DX:
- Named constructors for common patterns (e.g.,
ChatMessage.user(),ChatMessage.system(),Tool.function(),Tool.webSearch()). - Explicit streaming methods (
createStream()vscreate()). - Extension methods for convenient response access (
response.text,response.toolCalls,response.hasToolCalls). - Rich logging with field redaction for sensitive data.
- Pagination utilities (
Paginator) and job polling helpers (FineTuningJobPoller,BatchJobPoller).
- Named constructors for common patterns (e.g.,
- Full API coverage:
- Chat completions with tool calling, multimodal inputs, and JSON schema validation.
- Fill-in-the-Middle (FIM) code completions with streaming.
- Text embeddings with dimension control and quantization options.
- File management (upload, download, signed URLs).
- Fine-tuning with hyperparameter control and W&B integration.
- Batch processing for large-scale async operations.
- Content moderation and text classification.
- OCR for PDFs and images with markdown output.
- Audio transcription with word-level timestamps.
- Agents with built-in tools (web search, code interpreter, image generation).
- Stateful conversations with context management.
- Document libraries for RAG workflows.
See MIGRATION.md for step-by-step examples and mapping tables.
Commits #
- BREAKING FEAT: Complete v1.0.0 reimplementation (#8). (e18581e5)
- FEAT: Update README and add classification/moderation examples (#15). (88b2064c)
- FIX: Pre-release documentation and code fixes (#44). (93c78871)
- REFACTOR: Align client package architecture across SDK packages (#37). (cf741ee1)
- REFACTOR: Align API surface across all SDK packages (#36). (ed969cc7)
- DOCS: Refactors repository URLs to new location. (76835268)
0.1.1 #
0.1.0 #
Note: This release has breaking changes.
0.0.4 #
0.0.3+4 #
0.0.3 #
0.0.2 #
- Update a dependency to the latest release.
0.0.1-dev.1 #
- Bootstrap project.