Skip to content

fix(elevenlabs_asr): __main__ block passes a language_code kwarg that does not exist - #595

Open
Anai-Guo wants to merge 1 commit into
Huanshere:mainfrom
Anai-Guo:fix-elevenlabs-main-block
Open

fix(elevenlabs_asr): __main__ block passes a language_code kwarg that does not exist#595
Anai-Guo wants to merge 1 commit into
Huanshere:mainfrom
Anai-Guo:fix-elevenlabs-main-block

Conversation

@Anai-Guo

Copy link
Copy Markdown

Problem

Running core/asr_backend/elevenlabs_asr.py directly fails immediately — its __main__
block calls the function with arguments that do not match its signature:

def transcribe_audio_elevenlabs(raw_audio_path, vocal_audio_path, start=None, end=None):  # L67
...
if __name__ == "__main__":
    file_path = input("Enter local audio file path (mp3 format): ")
    language = input("Enter language code for transcription (en or zh or other...): ")
    result = transcribe_audio_elevenlabs(file_path, language_code=language)   # L141

Two independent errors:

  1. language_code is not a parameter →
    TypeError: transcribe_audio_elevenlabs() got an unexpected keyword argument 'language_code'
  2. vocal_audio_path is required and never passed → missing a required argument

There is also a third, quieter problem: the script prompts the user for a language that
the function never consults. The request body sources it from config instead:

data = {
    "model_id": "scribe_v1",
    "timestamps_granularity": "word",
    "language_code": load_key("whisper.language"),   # <-- from config.yaml, not the argument

So the prompt collects a value that has no effect on the result.

The intended call shape

The real caller in core/_2_asr.py:41 passes all four positionally:

result = ts(_RAW_AUDIO_FILE, vocal_audio, start, end)

The __main__ block is the only call site that disagrees, which is why this has gone
unnoticed — the normal pipeline path works fine.

Fix

Mirror the real caller and drop the prompt that had no effect:

if __name__ == "__main__":
    file_path = input("Enter local audio file path (mp3 format): ")
    # Language is not a parameter: the request body reads whisper.language from config.
    result = transcribe_audio_elevenlabs(file_path, file_path)

Passing file_path for both raw_audio_path and vocal_audio_path matches the
standalone use case, where there is no separated vocal track — only vocal_audio_path
is actually loaded, and raw_audio_path is unused in the body.

Only the __main__ block changes; transcribe_audio_elevenlabs and the pipeline path
are untouched.


🤖 Generated with Claude Code

The __main__ block called transcribe_audio_elevenlabs with a
language_code keyword that is not a parameter, and omitted the required
vocal_audio_path. Match the real caller in core/_2_asr.py. The language
prompt is dropped because the request body reads whisper.language from
config, so the entered value was never used.
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.

1 participant