lucianotonet/groq-php
PHP client for the Groq API. Provides a simple, lightweight way to call Groq LLM endpoints from PHP apps, with support for common chat/completions workflows and easy integration into existing projects.
This release brings significant improvements to the Files/Batches module, including expanded support for batch processing of chat completions and audio operations.
New JSONL Format Requirements (Fixes #14)
{
"custom_id": "your-tracking-id",
"method": "POST",
"url": "/v1/chat/completions",
"body": {
"model": "llama-3.1-8b-instant",
"messages": [...]
}
}
File Restrictions
.jsonl extension is now supported.json, .txt, .ndjsonUpdate your JSONL files:
custom_id fieldmethod to "POST"body objectSupported Endpoints:
/v1/chat/completions/v1/audio/transcriptions/v1/audio/translations{"custom_id": "chat-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "llama-3.1-8b-instant", "messages": [{"role": "user", "content": "Hello"}]}}
{"custom_id": "audio-1", "method": "POST", "url": "/v1/audio/transcriptions", "body": {"model": "whisper-large-v3", "language": "en", "url": "https://example.com/audio.wav"}}
Speech class with a fluent interface for easy configurationspeech() method to the Audio classplayai-tts (English) and playai-tts-arabic (Arabic)model(): Set the TTS model to useinput(): Define text to convert to speechvoice(): Set voice identifier (e.g., "Bryan-PlayAI")responseFormat(): Define output format (default: "wav")create(): Returns audio content as streamsave($filePath): Saves audio directly to a file// Save audio to file
$result = $groq->audio()->speech()
->model('playai-tts')
->input('Hello, this text will be converted to speech')
->voice('Bryan-PlayAI')
->responseFormat('wav')
->save('output.wav');
// Get as stream (e.g., to send to browser)
$audioStream = $groq->audio()->speech()
->model('playai-tts')
->input('This is another example text')
->voice('Bryan-PlayAI')
->create();
header('Content-Type: audio/wav');
header('Content-Disposition: inline; filename="speech.wav"');
echo $audioStream;
Updated README.md to include comprehensive documentation about the new TTS functionality.
examples/audio-speech.phpWe are thrilled to announce the release of GroqPHP v1.0.0! 🎉
This marks a significant milestone as we celebrate our first anniversary. The initial commit was made on March 22, 2024, and after a year of development and iteration, we are proud to have reached 16,000+ downloads. This achievement is a testament to the growing adoption of our library in the PHP community.
The 1.0.0 release represents a stable, feature-rich offering that builds upon previous versions with several significant improvements:
One of the most significant additions in this release is comprehensive support for the Groq Files and Batch Processing APIs:
File Management: Seamlessly upload, list, retrieve, download, and delete JSONL files for batch processing
Batch Processing: Process large volumes of requests asynchronously
While we have made efforts to maintain backward compatibility, there are a few breaking changes to be aware of:
We extend our heartfelt thanks to all contributors who have made this release possible:
And to all users who have provided valuable feedback and suggestions through issues, including @zachary, @EliasPereirah, @flemzord, and @mmddev87.
As we move beyond v1.0.0, we remain committed to improving GroqPHP with new features, optimizations, and expanded model support. We encourage you to report issues and contribute to the project on GitHub.
Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.1.1...v0.1.2
Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.10...v0.1.0
Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.9...v0.0.10
Add Vision functionality for image analysis and examples:
Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.8...v0.0.9
This release includes several enhancements and improvements to the Groq PHP package:
These updates aim to provide a more robust and user-friendly experience when working with the Groq API through this PHP package.
Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.7...v0.0.8
Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.6...v0.0.7
Add speech-to-text transcription and translation features
This introduces the ability to transcribe and translate spoken words from audio and video files.
Users can now:
This functionality enhances the capabilities of the library, making it more versatile and useful for processing audio and video data.
Add stream functionality
First version.
How can I help you explore Laravel packages today?