Add Support for OpenAI Whisper API Integration as Transcription Backend #151
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.
Pull Request Description
Title: Support Additional Whisper Services: Integration of OpenAI Whisper API
Related Issue: #137
Summary:
This pull request introduces support for the OpenAI Whisper API as an additional transcription service in the grouplang-secretary-bot. The implementation enhances flexibility and performance, allowing users to choose between AWS Transcribe and OpenAI Whisper based on their individual needs and preferences.
Changes Made:
Integration of OpenAI Whisper API:
OpenAITranscriber
class has been added to handle voice message transcriptions using the OpenAI Whisper API.TranscriberFactory
that manages the selection between AWS and OpenAI transcription services.Configuration Updates:
config.py
to include new environment variables:OPENAI_API_KEY
: Required for authentication with the OpenAI service.TRANSCRIPTION_SERVICE
: A new variable to specify the desired transcription service, with options for'aws'
(default) and'openai'
.Code Adjustments:
bot_handlers.py
file has been modified to utilize theTranscriberFactory
, enabling dynamic selection of the transcription service based on the current configuration.Documentation Enhancements:
README.md
file has been updated with:User Instructions:
To enable the OpenAI Whisper API, set the environment variable:
Ensure you also provide your OpenAI API key by setting the variable:
For AWS Transcribe, maintain the following settings:
Provide the necessary AWS credentials as before.
This update significantly enhances the bot's capability by allowing users to choose their preferred transcription service, thereby catering to a broader range of needs while keeping backward compatibility intact.
Testing:
Next Steps: