realhood/assemblyai-realtime
Composer 安装命令:
composer require realhood/assemblyai-realtime
包简介
PHP package for AssemblyAI real-time streaming with Lemur support
README 文档
README
A comprehensive PHP package for real-time transcription and Lemur integration with AssemblyAI. This package provides a robust implementation for real-time audio transcription and AI-powered analysis using AssemblyAI's WebSocket API and Lemur capabilities.
Features
- 🎙️ Real-time audio transcription
- 🤖 Lemur AI integration for advanced analysis
- 📝 Support for multiple Lemur tasks (summarization, Q&A, action items)
- 🔄 WebSocket-based streaming with automatic reconnection
- ⚡ Efficient audio processing and chunking
- 🛠️ Comprehensive error handling
- 🧪 Full test coverage
Requirements
- PHP 7.4 or higher
- Composer
- AssemblyAI API key
Installation
composer require realhood/assemblyai-realtime
Quick Start
use AssemblyAIRealtime\Client\AssemblyAIClient; use AssemblyAIRealtime\Config\Configuration; // Initialize client with Lemur $config = new Configuration([ 'lemur' => [ 'enabled' => true, 'task' => 'summarize', 'prompt' => 'Provide a brief summary' ] ]); $client = new AssemblyAIClient('your-api-key', $config); // Handle transcription results $messageHandler = function($result) { switch ($result['type']) { case 'partial': echo "Partial: {$result['text']}\n"; break; case 'final': echo "Final: {$result['text']}\n"; break; case 'lemur': echo "Lemur: {$result['response']}\n"; break; } }; // Start transcription $client->startRealTimeTranscription($messageHandler); // Send audio data $client->sendAudioChunk($audioData); // Stop when done $client->stop();
Advanced Usage
Audio Processing
use AssemblyAIRealtime\Utils\AudioUtils; // Validate audio format if (AudioUtils::validateAudioFormat($audioPath)) { // Get audio duration $duration = AudioUtils::getAudioDuration($audioPath); // Convert and process audio $chunks = AudioUtils::convertAudioToFormat($audioPath); foreach ($chunks as $chunk) { $client->sendAudioChunk($chunk); usleep(20000); // 20ms delay } }
Lemur Integration
use AssemblyAIRealtime\Utils\LemurUtils; // Create Lemur configuration $lemurConfig = LemurUtils::createLemurConfig( 'summarize', 'Provide a detailed summary' ); // Available Lemur tasks $tasks = [ 'summarize', 'question_answer', 'action_items', 'key_points' ];
Error Handling
try { $client->startRealTimeTranscription($handler); } catch (AssemblyAIException $e) { echo "AssemblyAI Error: " . $e->getMessage(); } catch (TranscriptionException $e) { echo "Transcription Error: " . $e->getMessage(); } catch (LemurException $e) { echo "Lemur Error: " . $e->getMessage(); }
Testing
Run the test suite:
./vendor/bin/phpunit
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
Credits
Created and maintained by Reza Aleyasin.
realhood/assemblyai-realtime 适用场景与选型建议
realhood/assemblyai-realtime 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「websocket」 「real-time」 「Transcription」 「ai」 「lemur」 「assemblyai」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 realhood/assemblyai-realtime 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 realhood/assemblyai-realtime 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 realhood/assemblyai-realtime 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Talk is a Laravel based realtime messaging, chatting and conversation system. It helps to develop users messaging, chatting and conversations in easy way.
Boxalino Real Time User Experience (RTUX) Magento2 plugin
Laravel package for generating Agora.io tokens (RTC, RTM, Chat) with support for both V1 and V2 token formats
PHP library for Broadcastt HTTP API
A Laravel package providing transcription feature for audio file
NO LIBRARIES socket per page bridge for your Laravel application.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-15