Download the PHP package softcreatr/php-mistral-ai-sdk without Composer
On this page you can find all versions of the php package softcreatr/php-mistral-ai-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download softcreatr/php-mistral-ai-sdk
More information about softcreatr/php-mistral-ai-sdk
Files in softcreatr/php-mistral-ai-sdk
Package php-mistral-ai-sdk
Short Description A powerful and easy-to-use PHP SDK for the Mistral AI API, allowing seamless integration of advanced AI-powered features into your PHP projects.
License ISC
Informations about the package php-mistral-ai-sdk
Mistral API Wrapper for PHP
This PHP library provides a simple wrapper for the Mistral API, allowing you to easily integrate the Mistral API into your PHP projects.
Features
- Easy integration with Mistral API
- Supports all Mistral API endpoints
- Streaming support for real-time responses in chat completions
- Utilizes PSR-17 and PSR-18 compliant HTTP clients and factories for making API requests
Requirements
- PHP 8.1 or higher
- A PSR-17 HTTP Factory implementation (e.g., guzzle/psr7 or nyholm/psr7)
- A PSR-18 HTTP Client implementation (e.g., guzzlehttp/guzzle or symfony/http-client)
Installation
You can install the library via Composer:
Usage
First, include the library in your project:
Then, create an instance of the MistralAI
class with your API key, organization (optional), an HTTP client, an HTTP request factory, and an HTTP stream factory:
Now you can call any supported MistralAI API endpoint using the magic method __call
:
Streaming Example
You can enable real-time streaming for chat completions:
For more details on how to use each endpoint, refer to the Mistral API documentation, and the examples provided in the repository.
Supported Methods
Chat Completions
- Create Chat Completion - Example
createChatCompletion(array $options = [], callable $streamCallback = null)
Embeddings
- Create Embedding - Example
createEmbedding(array $options = [])
Models
- List Models - Example
listModels()
- Retrieve Model - Example
retrieveModel(array $parameters = [])
- Delete Model - Example
deleteModel(array $parameters = [])
- Update Fine-Tuned Model - Example
updateFineTunedModel(array $parameters = [])
- Archive Model - Example
archiveModel(array $parameters = [])
- Unarchive Model - Example
unarchiveModel(array $parameters = [])
Files
- Upload File - Example
uploadFile(array $options = [])
- List Files - Example
listFiles()
- Retrieve File - Example
retrieveFile(array $parameters = [])
- Delete File - Example
deleteFile(array $parameters = [])
Fine-Tuning Jobs
- List Fine-Tuning Jobs - Example
listFineTuningJobs()
- Retrieve Fine-Tuning Job - Example
retrieveFineTuningJob(array $parameters = [])
- Cancel Fine-Tuning Job - Example
cancelFineTuningJob(array $parameters = [])
- Start Fine-Tuning Job - Example
startFineTuningJob(array $parameters = [])
- Create Fine-Tuning Job - Example
createFineTuningJob(array $options = [])
FIM Completion
- Create FIM Completion - Example
createFimCompletion(array $options = [])
Agents Completion
- Create Agents Completion - Example
createAgentsCompletion(array $options = [])
Changelog
For a detailed list of changes and updates, please refer to the CHANGELOG.md file. We adhere to Semantic Versioning and document notable changes for each release.
Known Problems and Limitations
Streaming Support
Streaming is now supported for real-time token generation in chat completions. Please make sure you are handling streams correctly using a callback, as demonstrated in the examples.
License
This library is licensed under the ISC License. See the LICENSE file for more information.
Maintainers 🛠️
Sascha Greuel |
Contributors ✨
All versions of php-mistral-ai-sdk with dependencies
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.1
psr/http-message Version ^2.0