Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for OpenAI Whisper API as Additional Transcription Backend #153

Conversation

agentmarketbot
Copy link
Contributor

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:

  1. New Transcription Service:

    • A new OpenAITranscriber class has been implemented. This class works in conjunction with the existing AWSTranscriber class, enabling the bot to support transcriptions through OpenAI's Whisper API.
  2. Configuration Updates:

    • The configuration file (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.
  3. Bot Handlers Update:

    • Modifications have been made to the 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.
  4. Dependency Management:

    • The OpenAI package has been added to the project's dependencies in the pyproject.toml file, ensuring that users can install the necessary libraries for the OpenAI API integration.
  5. Documentation:

    • The 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:

  • Setting the TRANSCRIPTION_SERVICE environment variable to either "aws" or "openai".
  • Providing the necessary credentials for the selected transcription service.

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!

Implement a flexible transcription service system that allows users to
choose between AWS Transcribe and OpenAI Whisper API. Changes include:

- Add BaseTranscriber abstract class for transcription service interface
- Implement OpenAITranscriber class for Whisper API integration
- Update configuration to support service selection via TRANSCRIPTION_SERVICE
- Add new environment variables for OpenAI API key
- Update README with new configuration options and documentation links
- Add openai package dependency to pyproject.toml

This change allows users to select their preferred transcription service
while maintaining the existing AWS Transcribe functionality as default.
@vadanrod14 vadanrod14 closed this Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants