Skip to content

ECHO-261-route-english-transcription-through-litellm#171

Merged
ArindamRoy23 merged 2 commits intomainfrom
feature/echo-261-route-english-transcription-through-litellm
Jun 2, 2025
Merged

ECHO-261-route-english-transcription-through-litellm#171
ArindamRoy23 merged 2 commits intomainfrom
feature/echo-261-route-english-transcription-through-litellm

Conversation

@ArindamRoy23
Copy link
Copy Markdown
Contributor

@ArindamRoy23 ArindamRoy23 commented Jun 2, 2025

Enhance transcription configuration and error handling

  • Added ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM environment variable to control English transcription behavior.
  • Updated transcribe_conversation_chunk function to conditionally use RunPod transcription based on non en language and configuration.
  • Improved error handling for RunPod job status checks, including logging for unexpected responses and exceptions.
  • Return whisper prompt to the old prompts

Summary by CodeRabbit

  • New Features

    • Added an optional configuration flag to enable English transcription with LiteLLM.
    • Enhanced transcription logic to prefer LiteLLM for English when enabled.
  • Bug Fixes

    • Improved error handling and logging for RunPod transcription status checks.
  • Documentation

    • Updated prompt templates in English, Dutch, German, Spanish, and French with brief, informal introductions replacing previous technical content.

- Added ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM environment variable to control English transcription behavior.
- Updated transcribe_conversation_chunk function to conditionally use RunPod transcription based on non en language and configuration.
- Improved error handling for RunPod job status checks, including logging for unexpected responses and exceptions.
- Return whisper prompt to the old prompts
@linear
Copy link
Copy Markdown

linear bot commented Jun 2, 2025

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 2, 2025

Walkthrough

A new environment variable flag is introduced to control routing of English transcription through LiteLLM. The transcription logic is updated to use LiteLLM for English when the flag is enabled, bypassing RunPod. Prompt templates for multiple languages are replaced with concise, informal introductions.

Changes

Files/Paths Change Summary
echo/server/dembrane/config.py Added ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM env var with debug logging, no assertion enforcement.
echo/server/dembrane/transcribe.py Updated logic to route English transcription via LiteLLM based on new flag; enhanced RunPod status error handling and logging.
echo/server/prompt_templates/default_whisper_prompt.{de,en,es,fr,nl}.jinja Replaced detailed technical prompt templates with brief, informal introductions in respective languages.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TranscribeModule
    participant LiteLLM
    participant RunPod

    User->>TranscribeModule: Request transcription (with language)
    alt ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM is true and language is English
        TranscribeModule->>LiteLLM: Transcribe audio (English)
        LiteLLM-->>TranscribeModule: Return transcription
    else
        TranscribeModule->>RunPod: Transcribe audio (non-English or flag disabled)
        RunPod-->>TranscribeModule: Return transcription
    end
    TranscribeModule-->>User: Return result
Loading

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Route English transcription through LiteLLM (ECHO-261)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes detected.

Possibly related PRs

Suggested reviewers

  • ussaama
  • spashii
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot requested review from spashii and ussaama June 2, 2025 10:11
@ArindamRoy23 ArindamRoy23 enabled auto-merge June 2, 2025 10:11
@coderabbitai coderabbitai bot added the Feature label Jun 2, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1159f86 and 9d30c5d.

📒 Files selected for processing (7)
  • echo/server/dembrane/config.py (1 hunks)
  • echo/server/dembrane/transcribe.py (4 hunks)
  • echo/server/prompt_templates/default_whisper_prompt.de.jinja (1 hunks)
  • echo/server/prompt_templates/default_whisper_prompt.en.jinja (1 hunks)
  • echo/server/prompt_templates/default_whisper_prompt.es.jinja (1 hunks)
  • echo/server/prompt_templates/default_whisper_prompt.fr.jinja (1 hunks)
  • echo/server/prompt_templates/default_whisper_prompt.nl.jinja (1 hunks)
🧰 Additional context used
🪛 Pylint (3.3.7)
echo/server/dembrane/transcribe.py

[convention] 205-205: Line too long (116/100)

(C0301)


[refactor] 205-303: Unnecessary "elif" after "return", remove the leading "el" from "elif"

(R1705)


[convention] 232-232: Trailing whitespace

(C0303)


[convention] 235-235: Trailing whitespace

(C0303)


[convention] 238-238: Line too long (121/100)

(C0301)


[convention] 245-245: Trailing whitespace

(C0303)


[convention] 250-250: Line too long (112/100)

(C0301)


[convention] 253-253: Line too long (106/100)

(C0301)


[warning] 252-252: Catching too general exception Exception

(W0718)


[warning] 230-230: Missing timeout argument for method 'requests.get' can cause your program to hang indefinitely

(W3101)


[warning] 234-234: Use lazy % formatting in logging functions

(W1203)


[warning] 238-238: Use lazy % formatting in logging functions

(W1203)


[warning] 241-241: Use lazy % formatting in logging functions

(W1203)


[warning] 243-243: Use lazy % formatting in logging functions

(W1203)


[warning] 247-247: Use lazy % formatting in logging functions

(W1203)


[warning] 250-250: Use lazy % formatting in logging functions

(W1203)


[warning] 253-253: Use lazy % formatting in logging functions

(W1203)

echo/server/dembrane/config.py

[convention] 165-165: Line too long (137/100)

(C0301)


[convention] 166-166: Line too long (125/100)

(C0301)


[convention] 167-167: Trailing whitespace

(C0303)


[convention] 167-167: Line too long (103/100)

(C0301)


[warning] 167-167: Use lazy % formatting in logging functions

(W1203)

🔇 Additional comments (5)
echo/server/prompt_templates/default_whisper_prompt.fr.jinja (1)

1-1: LGTM! Clean French, très 100x.

Perfect French prompt - "tour de table" is the idiomatic way to say it. The simplified approach is chef's kiss for transcription clarity.

echo/server/prompt_templates/default_whisper_prompt.de.jinja (1)

1-1: LGTM! Solid German, sehr gut engineering.

Clean German prompt with proper grammar and natural flow. The simplified conversational approach is definitely the 100x move for transcription prompts.

echo/server/dembrane/transcribe.py (2)

205-206: LGTM! Clean conditional routing logic.

The transcription routing logic correctly bypasses RunPod for English when the LiteLLM flag is enabled. This provides the flexibility mentioned in the PR objectives.

However, fix the line length:

-    if ENABLE_RUNPOD_WHISPER_TRANSCRIPTION and not (language == "en" and ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM):
+    if (ENABLE_RUNPOD_WHISPER_TRANSCRIPTION and 
+        not (language == "en" and ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM)):
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 205-205: Line too long (116/100)

(C0301)


[refactor] 205-303: Unnecessary "elif" after "return", remove the leading "el" from "elif"

(R1705)


284-285: LGTM! Clear debug logging for transcription path.

The debug logging helps with troubleshooting transcription routing decisions.

echo/server/prompt_templates/default_whisper_prompt.en.jinja (1)

1-1: Verify this prompt change aligns with transcription quality expectations.

You've completely replaced what was likely a detailed technical transcription prompt with a casual meeting introduction. This could significantly impact transcription quality and context understanding.

Please confirm that this simplified prompt still provides the transcription quality needed for your use case, especially given that this now routes through LiteLLM for English transcription.

- Made ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM optional, defaulting to false, and updated related logging.
- Enhanced formatting in the queue_transcribe_audio_runpod function for better readability.
@@ -33,7 +34,10 @@ class TranscriptionError(Exception):


def queue_transcribe_audio_runpod(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seperation of concerns:

this does more than "queue_transcribe_audio_runpod"

please use the higher level "transcribe_audio" fn and switch the underlying implementation when necessary?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also maybe have a transcribe_audio_litellm fn to complement this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

queue_transcribe_audio_runpod: It just does that. It posts a request to runpod. Thats all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transcribe_audio_litellm: There already is a function which we are using in this case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server/dembrane/transcribe.py/transcribe_audio_litellm

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d30c5d and 9af3ec9.

📒 Files selected for processing (2)
  • echo/server/dembrane/config.py (1 hunks)
  • echo/server/dembrane/transcribe.py (6 hunks)
🧰 Additional context used
🪛 Pylint (3.3.7)
echo/server/dembrane/config.py

[convention] 169-169: Line too long (104/100)

(C0301)

echo/server/dembrane/transcribe.py

[convention] 245-245: Line too long (109/100)

(C0301)


[convention] 259-259: Line too long (102/100)

(C0301)


[refactor] 205-318: Unnecessary "elif" after "return", remove the leading "el" from "elif"

(R1705)


[warning] 220-220: Use lazy % formatting in logging functions

(W1203)


[warning] 262-262: Catching too general exception Exception

(W0718)


[warning] 240-240: Use lazy % formatting in logging functions

(W1203)


[warning] 244-246: Use lazy % formatting in logging functions

(W1203)


[warning] 249-249: Use lazy % formatting in logging functions

(W1203)


[warning] 251-251: Use lazy % formatting in logging functions

(W1203)


[warning] 255-255: Use lazy % formatting in logging functions

(W1203)


[warning] 258-260: Use lazy % formatting in logging functions

(W1203)


[warning] 263-265: Use lazy % formatting in logging functions

(W1203)


[refactor] 269-272: The if statement can be replaced with 'var = bool(test)'

(R1703)

🔇 Additional comments (3)
echo/server/dembrane/transcribe.py (3)

22-22: LGTM! Import added correctly.

Clean addition of the new configuration flag import that integrates perfectly with the existing config imports.


205-208: LGTM! Solid conditional logic for English transcription routing.

The conditional logic correctly implements the intended behavior - English transcription will bypass RunPod and use LiteLLM when the flag is enabled, while non-English languages continue using RunPod. The debug logging clearly indicates which transcription path is being taken.

This is a clean implementation that maintains backward compatibility while adding the new routing capability.

🧰 Tools
🪛 Pylint (3.3.7)

[refactor] 205-318: Unnecessary "elif" after "return", remove the leading "el" from "elif"

(R1705)


300-300: LGTM! Clean debug logging for LiteLLM path.

Perfect addition of debug logging to clearly indicate when the LiteLLM transcription path is being used. This will be super helpful for debugging and monitoring the routing behavior.

@spashii spashii self-requested a review June 2, 2025 14:44
@ArindamRoy23 ArindamRoy23 added this pull request to the merge queue Jun 2, 2025
Merged via the queue into main with commit 6a16e3c Jun 2, 2025
7 checks passed
This was referenced Sep 16, 2025
spashii pushed a commit that referenced this pull request Nov 18, 2025
* Enhance transcription configuration and error handling

- Added ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM environment variable to control English transcription behavior.
- Updated transcribe_conversation_chunk function to conditionally use RunPod transcription based on non en language and configuration.
- Improved error handling for RunPod job status checks, including logging for unexpected responses and exceptions.
- Return whisper prompt to the old prompts

* Refactor transcription configuration and improve logging

- Made ENABLE_ENGLISH_TRANSCRIPTION_WITH_LITELLM optional, defaulting to false, and updated related logging.
- Enhanced formatting in the queue_transcribe_audio_runpod function for better readability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants