Skip to content

Conversation

@avi-007
Copy link
Collaborator

@avi-007 avi-007 commented Jul 7, 2025

Q/A checklist

  • I have tested my UI changes on mobile and they look acceptable
  • I have tested changes to the workflows in both the API and the UI
  • I have done a code review of my changes and looked at each line of the diff + the references of each function I have changed
  • My changes have not increased the import time of the server
How to check import time?

time python -c 'import server'

You can visualize this using tuna:

python3 -X importtime -c 'import server' 2> out.log && tuna out.log

To measure import time for a specific library:

$ time python -c 'import pandas'

________________________________________________________
Executed in    1.15 secs    fish           external
   usr time    2.22 secs   86.00 micros    2.22 secs
   sys time    0.72 secs  613.00 micros    0.72 secs

To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:

def my_function():
    import pandas as pd
    ...

Legal Boilerplate

Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.

@avi-007 avi-007 requested a review from devxpy July 7, 2025 08:10
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 7, 2025

Walkthrough

The code integrates the ElevenLabs Scribe v1 ASR model into the daras_ai_v2.asr module. It adds a new constant ELEVENLABS_SUPPORTED containing 99 supported languages by their 3-letter ISO codes. The AsrModels enum gains a new member elevenlabs, and the asr_model_ids and asr_supported_languages dictionaries are updated accordingly. A new function elevenlabs_asr is introduced to perform speech-to-text transcription via the ElevenLabs API by downloading audio from a URL and sending it as a multipart POST request. The run_asr function is extended to handle the elevenlabs model, processing the API response into transcribed text and timestamped chunks.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7c3edfe and 4ed5e34.

📒 Files selected for processing (1)
  • daras_ai_v2/asr.py (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • daras_ai_v2/asr.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
  • GitHub Check: test (3.10.12, 1.8.3)
✨ 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.

Copy link
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: 0

🧹 Nitpick comments (1)
daras_ai_v2/asr.py (1)

988-1016: Remove redundant imports and consider memory usage.

The function implementation is solid with proper error handling, but has a couple of issues:

  1. Redundant imports: requests and settings are already imported at the file level (lines 12 and 18).
  2. Memory consideration: Loading the entire audio file into memory could be problematic for large files.

Apply this diff to remove redundant imports:

 def elevenlabs_asr(audio_url: str, language: str = None) -> dict:
     """
     Call ElevenLabs Speech-to-Text API
     """
-    import requests
-    from daras_ai_v2 import settings
-
     audio_r = requests.get(audio_url)

The memory usage for large files is acceptable given that other ASR functions in this file follow the same pattern.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0ffb603 and a2a0461.

📒 Files selected for processing (1)
  • daras_ai_v2/asr.py (6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
daras_ai_v2/asr.py (1)
daras_ai_v2/exceptions.py (1)
  • raise_for_status (19-49)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (actions)
  • GitHub Check: test (3.10.12, 1.8.3)
🔇 Additional comments (5)
daras_ai_v2/asr.py (5)

124-133: LGTM! Well-structured language support definition.

The ElevenLabs supported languages set follows the established pattern in the codebase, using 3-letter ISO codes in a set for efficient membership testing. The format is consistent with other language definitions in the file.


274-274: LGTM! Consistent enum member addition.

The new enum member follows the established naming convention and clearly identifies the ElevenLabs model.


344-344: LGTM! Proper model ID mapping.

The mapping follows the established pattern in the asr_model_ids dictionary and uses an appropriate identifier for the ElevenLabs model.


370-370: LGTM! Correct language mapping.

The mapping properly associates the ElevenLabs model with its supported language set, maintaining consistency with other model mappings.


1064-1080: LGTM! Well-implemented ElevenLabs integration.

The ElevenLabs branch in run_asr follows the established pattern and properly handles both text and JSON output formats. The chunk processing logic appropriately extracts timestamps, text, and speaker information with sensible defaults.

The conditional speaker assignment (if word_data["type"] == "word") suggests the API may return different data types, which is handled correctly.

@avi-007 avi-007 merged commit 1ff7940 into master Jul 8, 2025
8 checks passed
@avi-007 avi-007 deleted the elevenlabs-asr-integration branch July 8, 2025 21:33
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.

3 participants