Add Support for OpenAI Whisper API as an Additional Transcription Backend (Issue #137) #141
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 OpenAI's Whisper API as an alternative transcription service alongside the existing AWS Whisper functionality in our Telegram bot. This enhancement aims to provide users with more flexibility, performance options, and potentially lower costs depending on their specific needs.
Changes Made:
OpenAI Whisper API Support:
OpenAITranscriber
, located inservices.py
. This class encapsulates the logic for audio transcription using the OpenAI Whisper API.AudioTranscriber
class to accommodate both AWS Transcribe and OpenAI Whisper, allowing selection based on configuration.Configuration Updates:
config.py
to introduce new settings for the OpenAI API key.TRANSCRIPTION_SERVICE
, enabling users to specify their desired transcription service (either 'aws' or 'openai').Bot Handlers Modification:
bot_handlers.py
to utilize the new configurable transcription service. This change allows the bot to dynamically select between AWS and OpenAI for voice message transcription based on user preferences.Dependency Management:
pyproject.toml
file to include OpenAI as a dependency. Resolved initial installation challenges via Poetry due to permission issues by opting to install OpenAI using pip.Documentation Enhancements:
README.md
file to incorporate detailed instructions on the new features and configuration options, specifically guiding users on setting up and using the OpenAI Whisper API.Conclusion:
With this update, users of the grouplang-secretary-bot can easily switch between the AWS Transcribe service and the OpenAI Whisper API. This is done by adjusting the
TRANSCRIPTION_SERVICE
environment variable to either 'aws' or 'openai', along with providing the necessary credentials for the selected service.We believe this integration will significantly enhance the user experience by allowing more tailored voice transcription solutions.
If there are any questions or further clarifications needed, please don't hesitate to reach out!
Thank you for considering this pull request!