modelflow-ai/mistral-adapter

Integrates the mistral into modelflow-ai.

0.1.0 2024-04-07 20:39 UTC

This package is auto-updated.

Last update: 2024-04-25 18:38:54 UTC


README


Mistral Adapter Logo

Modelflow AI
Mistral Adapter


The adapter integrates Mistral AI models into Modelflow AI.

Note: This is part of the modelflow-ai project create issues in the main repository.

Note: This project is heavily under development and any feedback is greatly appreciated.


Installation

To install the Mistral Adapter package, you need to have PHP 8.2 or higher and Composer installed on your machine. Then, you can add the package to your project by running the following command:

composer require modelflow-ai/mistral-adapter

Examples

Here are some examples of how you can use the Mistral package in your PHP applications. You can find more detailed examples in the examples directory.

Usage

First, initialize the client:

use ModelflowAi\Mistral\Mistral;

$client = Mistral::client('your-api-key');

Then, you can use the ModelAdapter:

use ModelflowAi\Mistral\Model;
use ModelflowAi\MistralAdapter\Model\MistralChatModelAdapter;

$modelAdapter = new MistralChatModelAdapter($client);
$response = $modelAdapter->create([
    'model' => Model::TINY->value,
    'messages' => [
        [
            'role' => 'system',
            'content' => 'your-content',
        ],
    ],
]);

And the EmbeddingsAdapter:

use ModelflowAi\MistralAdapter\Embeddings\MistralEmbeddingAdapter;

$embeddingsAdapter = new MistralEmbeddingAdapter($client);
$response = $embeddingsAdapter->create([
    'input' => ['your-input'],
]);

Remember to replace 'your-content', and 'your-input' with the actual values you want to use.

Contributing

Contributions are welcome. Please open an issue or submit a pull request in the main repository at https://github.com/modelflow-ai/modelflow-ai.

License

This project is licensed under the MIT License. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.