diff --git a/README.md b/README.md index 7d17d14..11c2b51 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ Check out the [Budget Manual](https://github.com/n3d1117/chatgpt-telegram-bot/di | `GROUP_TRIGGER_KEYWORD` | If set, the bot in group chats will only respond to messages that start with this keyword | - | | `IGNORE_GROUP_TRANSCRIPTIONS` | If set to true, the bot will not process transcriptions in group chats | `true` | | `BOT_LANGUAGE` | Language of general bot messages. Currently available: `en`, `de`, `ru`, `tr`, `it`, `fi`, `es`, `id`, `nl`, `zh-cn`, `zh-tw`, `vi`, `fa`, `pt-br`, `uk`. [Contribute with additional translations](https://github.com/n3d1117/chatgpt-telegram-bot/discussions/219) | `en` | +| `WHISPER_PROMPT` | To improve the accuracy of Whisper's transcription service, especially for specific names or terms, you can set up a custom message. [Speech to text - Prompting](https://platform.openai.com/docs/guides/speech-to-text/prompting) | `-` | Check out the [official API reference](https://platform.openai.com/docs/api-reference/chat) for more details. diff --git a/bot/openai_helper.py b/bot/openai_helper.py index d94ae7e..3708480 100644 --- a/bot/openai_helper.py +++ b/bot/openai_helper.py @@ -341,7 +341,8 @@ class OpenAIHelper: """ try: with open(filename, "rb") as audio: - result = await openai.Audio.atranscribe("whisper-1", audio) + prompt_text = os.environ.get('WHISPER_PROMPT', '') + result = await openai.Audio.atranscribe("whisper-1", audio, prompt=prompt_text) return result.text except Exception as e: logging.exception(e)