Add Support for OpenAI Whisper API as Additional Transcription Backend #153
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: Support for OpenAI Whisper API Integration
Summary
This pull request addresses Issue #137 by integrating the OpenAI Whisper API into our Telegram bot for audio transcription. This enhancement aims to provide users with more flexibility in choosing their transcription services based on performance, cost, and individual needs.
Key Changes
The following modifications have been made to incorporate the OpenAI Whisper API:
New Transcription Service:
OpenAITranscriber
class has been implemented. This class works in conjunction with the existingAWSTranscriber
class, enabling the bot to support transcriptions through OpenAI's Whisper API.Configuration Updates:
config.py
) has been updated to include:OPENAI_API_KEY
: Required for accessing the OpenAI Whisper API.TRANSCRIPTION_SERVICE
: A new setting that allows users to switch between AWS and OpenAI transcription services.Bot Handlers Update:
bot_handlers.py
file to support the selection of the transcription service specified in the configuration, ensuring that the appropriate transcriber is utilized based on user settings.Dependency Management:
pyproject.toml
file, ensuring that users can install the necessary libraries for the OpenAI API integration.Documentation:
README
file has been updated to include details on configuring the bot for either AWS or OpenAI transcription services. This includes a detailed guide on setting up API keys and the prerequisites for both services.Usage
Users can now easily switch between the AWS Transcribe and OpenAI Whisper API services by:
TRANSCRIPTION_SERVICE
environment variable to either "aws" or "openai".Conclusion
This integration enhances the bot's transcription capabilities, offering users a choice that can better adapt to their specific needs. Please review the changes and let me know if you have any questions or require further modifications.
Thank you for your consideration!