- Can I use this package directly in Laravel, or is it strictly for Symfony?
- This package is designed for Symfony 6.3+ and relies on Symfony’s HttpClient and AI components. For Laravel, you’ll need to integrate it via Symfony’s HTTP client (e.g., using `symfony/http-client` with Laravel’s Guzzle facade) or adapt it to Laravel’s service container manually. There’s no native Laravel event or service provider support yet.
- Does this support real-time speech-to-text (STT) with WebSockets, or only HTTP?
- Currently, the package only supports HTTP-based STT/TTS via Deepgram’s API, which means no real-time WebSocket streaming. If WebSockets are critical (e.g., for low-latency transcription), you’ll need to implement a custom solution or use Deepgram’s native WebSocket API directly. HTTP is suitable for batch or pre-recorded audio.
- What Laravel versions and dependencies are required to use this package?
- The package itself requires Symfony 6.3+, but Laravel can integrate it indirectly. Ensure your Laravel app uses `symfony/http-client` (v6.3+) or `guzzlehttp/guzzle` (for standalone HTTP calls). No Laravel-specific version constraints exist, but compatibility depends on how you bridge Symfony’s components into Laravel’s ecosystem.
- How do I authenticate with Deepgram’s API using this package?
- Authentication is handled via Symfony’s HttpClient options, typically passing your Deepgram API key as a header or query parameter. The package doesn’t natively support OAuth2 or JWT, so you’ll need to extend the client or use middleware if those are required. Example: Configure the API key in your Symfony HTTP client or Laravel’s Guzzle client.
- Are there performance concerns for real-time applications (e.g., latency in STT)?
- HTTP-based STT/TTS may introduce higher latency compared to WebSocket streaming, especially for real-time use cases. Benchmark your specific workload, as Deepgram’s API response times depend on factors like audio length, model complexity, and network conditions. For sub-200ms SLAs, consider caching or pre-processing audio.
- What happens if Deepgram’s API rate limits or throttles requests?
- The package relies on Symfony’s HttpClient exceptions, which you’ll need to catch and handle (e.g., retry logic or exponential backoff). Deepgram’s API has [documented rate limits](https://developers.deepgram.com/docs/rate-limits), so implement client-side retries or fallback mechanisms if throttling is a risk. Laravel’s queue system could help manage retries.
- Can I extend this package to support custom Deepgram features (e.g., punctuation models)?
- Yes, the package provides a high-level abstraction, but you may need to extend it for Deepgram-specific features not exposed by default. For example, you could subclass `DeepgramClient` to add custom headers, query parameters, or error mappings. Check Deepgram’s [model catalog](https://developers.deepgram.com/reference/manage/models/list) for unsupported features.
- How do I test audio fidelity (e.g., TTS quality) or STT accuracy in Laravel?
- Test TTS quality by comparing generated audio files to reference samples (e.g., using FFmpeg or audio libraries like `php-audio`). For STT accuracy, compare transcriptions against ground truth text (e.g., Word Error Rate calculations). Use Laravel’s testing tools (e.g., HTTP tests with mock responses) or Deepgram’s test fixtures for validation.
- Are there alternatives to this package for Laravel if I need WebSocket support?
- For WebSocket-based STT in Laravel, consider using Deepgram’s native [WebSocket API](https://developers.deepgram.com/docs/assembly-api/real-time) with a Laravel WebSocket client like `beyondcode/laravel-websockets` or `ratchetphp/Ratchet`. Alternatively, explore Laravel packages like `spatie/laravel-ai` (if it adds WebSocket support) or build a custom wrapper around Deepgram’s SDK.
- How stable is this package for production use, given it’s early-stage?
- The package is hosted under Symfony’s umbrella but lacks adoption (0 stars, no dependents), so breaking changes are possible if `symfony/ai` evolves. For production, thoroughly test edge cases (e.g., error handling, rate limits) and consider implementing fallback providers (e.g., alternative STT services). Monitor the [Symfony AI repo](https://github.com/symfony/ai) for updates.