Download the PHP package helgesverre/mistral without Composer

On this page you can find all versions of the php package helgesverre/mistral. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mistral

Laravel Client for Mistral.AI

Latest Version on Packagist Total Downloads

The Mistral.ai Laravel Client enables laravel applications to interact with the Mistral.ai API, providing straightforward access to features like chat completions and text embeddings.

Get your API key at console.mistral.ai.

Installation

You can install the package via composer:

You can publish the config file with:

This is the contents of the published config file:

Usage

Client Instantiation

Create an instance of the Mistral client to start interacting with the API. This instance will be your primary interface for sending requests to Mistral.AI.

Examples

The package includes 12 hands-on examples in the examples/ directory, each with detailed documentation, working code, and explanations. These examples are the fastest way to learn the SDK and see it in action.

Quick Start: Begin with 01-getting-started to set up your first working integration.

Example Description
01-getting-started Install the SDK, configure authentication, and make your first API call
02-basic-chat Learn chat completions, system messages, and multi-turn conversations
03-chat-parameters Master temperature, top_p, max_tokens, and other generation parameters
04-streaming-chat Implement real-time streaming responses with Server-Sent Events
05-function-calling Enable AI to call PHP functions and interact with your application
06-embeddings Generate vector embeddings for semantic search and similarity matching
07-ocr Extract and process text from images and documents using OCR
08-audio Transcribe audio files with support for multiple languages and formats
09-moderation Identify and filter inappropriate content with content moderation
10-error-handling Implement robust error handling, retry logic, and rate limit management
11-speech Generate spoken audio from text with preset or custom voices
12-voices Manage custom voices — create from a sample, list, update, delete

Each example includes:

To run an example:

Available Resources & Methods

The Mistral PHP client provides 14 resource classes. Most resources offer both Response-returning methods and typed DTO convenience methods; where omitted, you can still call ->dto() on the Response.

Chat Resource

Access via $mistral->chat()

Methods:

Example:

SimpleChat Resource

Access via $mistral->simpleChat()

Methods:

Example:

Embedding Resource

Access via $mistral->embedding()

Methods:

Example:

Models Resource

Access via $mistral->models()

Methods:

Example:

OCR Resource

Access via $mistral->ocr()

Methods:

Example:

FIM Resource (Fill-in-the-Middle)

Access via $mistral->fim()

Methods:

Example:

Agents Resource

Access via $mistral->agents()

Methods:

Conversations Resource

Access via $mistral->conversations()

Methods:

Audio Resource

Access via $mistral->audio()

Methods:

Transcription (speech-to-text):

Speech (text-to-speech):

Voices:

Example — transcription:

Example — text-to-speech:

Files Resource

Access via $mistral->files()

Methods:

FineTuning Resource

Access via $mistral->fineTuning()

Methods:

Batch Resource

Access via $mistral->batch()

Methods:

Classifications Resource

Access via $mistral->classifications()

Methods:

Example:

Libraries Resource

Access via $mistral->libraries()

Methods:

Resources

Models Resource

List available models

Embeddings Resource

Create embedding

Chat Resource

Create Chat Completion

Create Chat Completion with Function Calling

Create Streamed Chat Completions

SimpleChat Resource

For convenience, the client also provides a simple chat completion method, which returns a simpler, condensed and flattened DTO, which is useful for quick prototyping.

Create simple chat completions

Create Streamed Simple Chat Completions

List of DTOs

For convenience, here is a list of all the DTOs available in this package, organized by feature area.

Chat

SimpleChat

Embeddings

Fill-in-the-Middle (FIM)

OCR

Models

Fine-Tuning

Files

Batch

Audio

Classifications & Moderation

Agents

Conversations

Libraries

Shared/Common

List of available Mistral models

The following models are available in the Mistral API. You can use the Model enum in this package to refer to them, or use the string value directly.

Current Production Models

Enum Case String Value Type Description
Model::large->value 'mistral-large-latest' Chat Most capable model for complex reasoning and specialized tasks
Model::medium->value 'mistral-medium-latest' Chat Balanced model for intermediate tasks
Model::small->value 'mistral-small-latest' Chat Fast, efficient model for simple bulk tasks
Model::magistralMedium->value 'magistral-medium-latest' Reasoning Advanced reasoning model
Model::pixtralLarge->value 'pixtral-large-latest' Vision Advanced vision model for image understanding
Model::pixtral12b->value 'pixtral-12b-latest' Vision Efficient vision model
Model::codestral->value 'codestral-latest' Code Specialized model for code generation and understanding
Model::ministral8b->value 'ministral-8b-latest' Chat Compact 8B parameter model for edge deployment
Model::voxtralSmall->value 'voxtral-small-latest' Audio Audio transcription model
Model::embed->value 'mistral-embed' Embeddings Text embedding model for semantic search and retrieval

Open Source Models

Enum Case String Value Type Description
Model::mistral7b->value 'open-mistral-7b' Chat 7B parameter open source foundation model
Model::mixtral->value 'open-mixtral-8x7b' Chat Mixture of Experts model with 8x7B parameters

For the most up-to-date model information and capabilities, visit the Mistral AI Models Documentation.

Testing

License

The MIT License (MIT). Please see License File for more information.

Disclaimer

Mistral and the Mistral logo are trademarks of Mistral.ai. This package is not affiliated with, endorsed by, or sponsored by Mistral.ai. All trademarks and registered trademarks are the property of their respective owners.

See Mistral.AI for more information.


All versions of mistral with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
saloonphp/laravel-plugin Version ^4.0
saloonphp/saloon Version ^4.0
spatie/laravel-data Version ^3|^4
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package helgesverre/mistral contains the following files

Loading the files please wait ...