Dart Mistral API Package
This Dart package provides idiomatic access to the Mistral AI API for both Dart and Flutter applications. Mistral AI is a powerful platform for artificial intelligence and machine learning tasks, and this package simplifies integration with your Dart and Flutter projects.
The package hides the messy details of the Mistral API and lets you work with nice statically typed classes.
- MistralService
- MistralRequest
- MistralResponse
- MistralEmbeddingRequest
- MistralEmbeddingResponse
- MistralModel
- MistralEmbedding
- MistralConstants
Installation
Add the following to your pubspec.yaml
:
dependencies:
mistral_sgela_ai: ^1.1.0+2
Then, run:
$ flutter pub get
Usage
Import the package where you need to use it:
import 'package:mistral_sgela_ai/mistral_sgela_ai.dart';
Initialize the Mistral API client with your API key:
final mistral = MistralService(apiKey: 'your_api_key');
Now you can use the various methods provided by the Mistral API. For example:
Send a request to the Mistral Chat models endpoint.
final List<MistralModel> models = await mistral.listModels();
Send a request to the Mistral Chat completions endpoint.
var mistralRequest = MistralRequest();
final MistralResponse response = await mistral.sendMistralRequest(mistralRequest);
Send a request to the Mistral Chat embeddings endpoint.
var mistralEmbeddingRequest = MistralEmbeddingRequest();
final List<MistralEmbeddingResponse> response = await mistral.sendEmbeddingRequest(mistralEmbeddingRequest);
A quick way to check whether things are cool is by sending a Hello request to the Mistral Chat Completions endpoint.
final List<MistralResponse> response = await mistral.sendHello();
Authentication
You need an API key from Mistral AI to use this package. Get registered and get an API key here: Mistral AI Website
Example
You can find a simple example in the example directory of this repository.
Issues and Feedback
Please file any issues, bugs, or feature requests in the issue tracker.
License
This package is licensed under the MIT License. See the LICENSE file for details.
Libraries
- mistral_sgela_ai
- Support for access to Mistral.