Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions echo/server/dembrane/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,25 @@ def transcribe_audio_assemblyai(
data: dict[str, Any] = {
"audio_url": audio_file_uri,
"speech_model": "universal",
"language_detection": True,
"language_detection_options": {
"expected_languages": ["nl", "en", "fr", "es", "de", "it", "pt"],
"expected_languages": [
"nl",
"fr",
"es",
"de",
"it",
"pt",
"en",
],
},
}

if language:
if language == "auto":
data["language_detection"] = True
data["language_detection_options"]["fallback_language"] = "en"
else:
data["language_code"] = language
data["language_detection_options"]["fallback_language"] = language
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Audio Transcription Language Detection Issue

The transcribe_audio_assemblyai function now unconditionally enables language detection. This means a specified language is used only as a fallback, altering the expected behavior of directly forcing a language. Additionally, if language is None, detection is enabled without a fallback, which may cause API errors.

Fix in Cursor Fix in Web


if hotwords:
data["keyterms_prompt"] = hotwords
Expand Down Expand Up @@ -392,7 +401,7 @@ def transcribe_conversation_chunk(conversation_chunk_id: str) -> str:
return conversation_chunk_id

except Exception as e:
logger.error(f"Failed to process conversation chunk {conversation_chunk_id}: {e}")
logger.error("Failed to process conversation chunk %s: %s", conversation_chunk_id, e)
raise TranscriptionError(
f"Failed to process conversation chunk {conversation_chunk_id}: {e}"
"Failed to process conversation chunk %s: %s" % (conversation_chunk_id, e)
) from e