feat: add multi-provider audio generation support#135
Draft
feat: add multi-provider audio generation support#135
Conversation
Add _get_default_tts_model() function to auto-select appropriate TTS model based on provider. Supports: - OpenAI, Azure: tts-1 - Google, Gemini: gemini-2.5-flash-preview-tts - ElevenLabs: eleven_multilingual_v2 - AWS: polly - MiniMax: speech-01 Enables automatic model selection for optimal TTS results per provider.
Add handle_generate_audio() function for text-to-speech conversion using LiteLLM's speech() API. Features: - Multi-provider support (OpenAI, Gemini, ElevenLabs, Azure, AWS, etc.) - Auto-detects TTS model based on provider if not specified - Supports voice, speed, and format parameters - Creates Agent Message with kind="Audio" and generated_audio field - Saves audio files to Frappe File Manager - Emits WebSocket events for real-time updates - Returns comprehensive metadata (url, file_id, message_id, voice, format) Follows same pattern as image generation handler for consistency.
Add support for audio messages in Agent Message DocType: - Add "Audio" to kind options - Add generated_audio field (Attach type) for storing generated audio files - Field is conditionally displayed when kind="Audio" Enables storing and displaying audio generation results in chat messages.
Add create_generate_audio_tool() function to register the generate_audio tool in Agent Tool Function DocType. Features: - Creates/updates generate_audio tool with proper parameters - Registers tool type "Audio Generation" if not exists - Defines parameters: input, voice, model, speed, response_format - Idempotent: can be called multiple times safely - Integrated into after_install() and after_migrate() hooks Enables AI agents to use text-to-speech functionality.
aaf4144 to
408fdfd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add text-to-speech functionality using LiteLLM's speech() API for multi-provider audio generation support.
Features:
Technical Details: