Closed (fixed)
Project:
Mistral Provider
Version:
1.1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Dec 2024 at 17:47 UTC
Updated:
22 Jan 2026 at 15:39 UTC
Jump to comment: Most recent
Comments
Comment #2
marcus_johansson commentedComment #3
marcus_johansson commentedComment #4
fagoComment #5
fagoOther proposed solutions from #3460283: Build custom client for Mistral or switch to HelgeSverre lib
* Build our own Guzzle Client for Mistral that can forward errors to an exception.
* (or) try this out: https://github.com/HelgeSverre/mistral
Comment #6
fagoComparing https://github.com/HelgeSverre/mistral and https://github.com/partITech/php-mistral
php-mistral:
HelgeSverre/mistral
Then, I've used claude code to help me comparing the libraries, here the result:
Mistral API Client Comparison
| Aspect | HelgeSverre/mistral | partITech/php-mistral |
| --- | --- | --- |
| Package Name | helgesverre/mistral | partitech/php-mistral |
| Version | v2.0.0 (Oct 2025) | v0.1+ (Dec 2025 - actively maintained) |
| GitHub Stars | 49 ⭐ | 25 ⭐ |
| Last Updated | Oct 21, 2025 | Dec 3, 2025 (more recent) |
| License | MIT | MIT |
Dependencies & Compatibility
| Aspect | HelgeSverre/mistral | partITech/php-mistral |
| --- | --- | --- |
| PHP Version | ^8.2 ⚠️ | \>=8.2 ⚠️ |
| Framework | Laravel-specific 🔴 | Framework-agnostic ✅ |
| Core Dependencies | • saloonphp/laravel-plugin• spatie/laravel-data• spatie/laravel-package-tools | • PSR-18 HTTP client (any)• PSR-7 (nyholm/psr7)• Symfony/mime ^6.3 |
| HTTP Client | Saloon (Laravel) | Any PSR-18 client (Guzzle, Symfony, cURL) ✅ |
| Your Project Compatibility | ❌ INCOMPATIBLE(Requires Laravel, you use Drupal) | ✅ COMPATIBLE(Framework-agnostic, works with Symfony) |
| PHP Version Issue | Your project: \>=8.1Package needs: ^8.2 | Your project: \>=8.1Package needs: \>=8.2 |
Features
| Feature | HelgeSverre/mistral | partITech/php-mistral |
| --- | --- | --- |
| Chat Completions | ✅ Streaming & non-streaming | ✅ Streaming & non-streaming |
| Tool/Function Calling | ✅ Standard tool calling | ✅ Advanced MCP support 🌟 |
| MCP (Model Context Protocol) | ❌ | ✅ Full MCP integration 🌟 |
| Tool Recursion Safety | ❌ | ✅ setMcpMaxRecursion() |
| Embeddings | ✅ Dense only | ✅ Dense + Sparse (Splade) |
| Reranking | ❌ | ✅ |
| Guided JSON | ❌ | ✅ |
| Audio/Transcription | ✅ | ✅ (via supported backends) |
| OCR | ✅ | ✅ (via supported backends) |
| Fine-tuning | ✅ | ✅ |
| Files API | ✅ | ✅ |
| Batch Jobs | ✅ | ✅ |
| Agents | ✅ | ✅ |
| Conversations | ✅ | ✅ |
| Moderation | ✅ | ✅ |
| Multi-backend Support | Mistral only | Mistral, OpenAI, HF TGI, vLLM, Ollama, llama.cpp, xAI ✅ |
| Hugging Face Datasets | ❌ | ✅ Full dataset management |
| Document Generation | ❌ | ✅ |
Code Quality & Testing
| Aspect | HelgeSverre/mistral | partITech/php-mistral |
| --- | --- | --- |
| Testing Framework | Pest PHP | PHPUnit |
| Test Structure | • ArchTest• 15 Resource tests• Connector tests | • Functional tests• Unit tests• Client-specific tests |
| Test Coverage | ✅ Good (15+ test files) | ✅ Good (Functional + Unit) |
| Static Analysis | ✅ PHPStan + Larastan | ✅ PHPStan |
| Code Style | ✅ Laravel Pint | Not specified |
| Examples | ✅ 10 detailed examples with docs | ✅ Multiple examples by client type |
| Documentation | ✅ Excellent (744-line README, comprehensive API reference) | ✅ Good (links to external docs site) |
| Typed DTOs | ✅ Full DTO support with \*Dto() methods | Partial |
Tool Calling Support (Critical for Your Needs)
| Feature | HelgeSverre/mistral | partITech/php-mistral |
| --- | --- | --- |
| Basic Tool Calling | ✅ Yes | ✅ Yes |
| Tool Definition | Standard JSON schema | Standard JSON schema + MCP |
| Tool Response Handling | Manual processing | Manual + MCP auto-execution |
| MCP Protocol | ❌ Not supported | ✅ Full MCP support |
| External Tool Servers | ❌ | ✅ Docker/exec MCP runners |
| Recursion Protection | ❌ | ✅ setMcpMaxRecursion() |
| Tool Call Examples | ✅ Detailed in examples/05-function-calling | ✅ Via MCP integration |
Architecture
| Aspect | HelgeSverre/mistral | partITech/php-mistral |
| --- | --- | --- |
| Design Pattern | Resource-based API wrapper | Multi-client abstraction |
| Service Provider | Laravel only | None (framework-agnostic) |
| HTTP Abstraction | Saloon PHP | PSR-18 (any client) |
| Extensibility | Laravel ecosystem | PSR standards |
---
Recommendation for Your Drupal Project
🏆 Winner: partITech/php-mistral
Reasons:
1. ✅ Framework Compatibility: Works with Drupal (you have Symfony components already)
2. ✅ PSR-18 Support: Can use Symfony HttpClient or Guzzle (both common in Drupal)
3. ✅ MCP Support: Advanced tool calling with Model Context Protocol - superior for complex tool interactions
4. ✅ Multi-backend: Works with multiple AI providers, not just Mistral
5. ✅ More Features: Reranking, sparse embeddings, guided JSON, HF datasets
Concerns:
* Both require PHP 8.2, your project specifies \>=8.1 (minor upgrade needed)
* Less GitHub stars (but more recently maintained)
* Slightly less polished documentation than HelgeSverre's
Why NOT HelgeSverre/mistral:
* ❌ Laravel-specific dependencies - Won't work in Drupal without Laravel
* ❌ Requires Laravel service container and packages
* ❌ Not suitable for framework-agnostic use
Action Items:
1. Upgrade project PHP requirement to ^8.2 in composer.json
2. Install partitech/php-mistral
3. Choose HTTP client (recommend Symfony HttpClient since you already use Symfony components)
4. Leverage MCP support for advanced tool calling needs
\-----------------------------
The laravel dependencies rule out HelgeSverre/mistral. But also otherwise, partITech/php-mistral is the winner. Even it turns out becoming un-maintained, it seems to be a solid to base we could continue with. I'd propose to go with php-mistral!
Comment #7
marcus_johansson commentedI would agree with partitech/php-mistral - it has been continued being supported since you suggested it.
Its worth keeping an eye on https://github.com/symfony/ai/tree/main/src/platform/src/Bridge/Mistral, I don't think they will split it out, but by AI module 3.0 release hopefully Symfony AI will have a tagged 1.0 release.
Comment #10
petar_basic commentedSo in the MR I've adapted the code to use the https://github.com/partITech/php-mistral
And also fixed some cspell and phpcs errors.
From what I could test, it works well, but it needs more in-depth testing, especially for cases where there are failures
Also, we have a failing "composer (previous major)" gitlab-ci due to php version - partITech/php-mistral requires php >=8.2
So we would have to drop support for drupal 10, or have a new release with php-mistral, and keep the old release for the drupal 10 compatibilty.
Comment #11
marcus_johansson commentedWe try to have everything that is dependent on the Drupal AI to have the same requirements, but I think we will have to do an exception in this case.
I think we can however support Drupal 10, but just with the requirement of PHP 8.2+? I did a push to fix this and now all tests passes.
If its ready for review based on that, let me know and I'll review ASAP.
Comment #12
petar_basic commentedI would agree with bumping php requirement here. I've added an explicit requirement for a minimum of PHP 8.2 in composer.json.
As far as I'm concerned, it is ready for review.
Comment #13
marcus_johansson commentedComment #14
marcus_johansson commentedTwo minor things and one fix for the vision models.
Comment #15
petar_basic commentedThanks, I've applied the suggestions.
Comment #16
marcus_johansson commentedLooks good to me now, will merge it. Thanks everyone and we will do follow up issues for handling function calling and structured output.
Comment #18
marcus_johansson commented