Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from dotenv import load_dotenv
from deepgram import DeepgramClient

load_dotenv()


client = DeepgramClient()

try:
print("Request sent")
response = client.listen.v1.media.transcribe_url(
model="nova-3",
url="https://dpgr.am/spacewalk.wav",
request_options={
"additional_query_parameters": {
"detect_language": ["en", "es"],
}
}
Comment on lines +14 to +18
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Deepgram API detect_language parameter format documentation

💡 Result:

  • Parameter name and type: detect_language — boolean query parameter (use detect_language=true to enable). [1]

  • URL usage example: https://api.deepgram.com/v1/listen?detect_language=true (can be combined with other params like punctuate=true). [2]

  • Restrict detectable languages: pass detect_language multiple times with language codes, e.g. detect_language=en&detect_language=es to limit detection to English or Spanish. [1]

  • Interaction: if you set both language and detect_language=true, language detection overrides the explicit language parameter. [1]

Sources:
[1] Deepgram Language Detection docs.
[2] Deepgram changelog / blog announcement showing example URL.


🏁 Script executed:

# Search for other uses of detect_language in the codebase
rg "detect_language" -A 2 -B 2

Repository: deepgram/deepgram-python-sdk

Length of output: 24051


🏁 Script executed:

# Search for Deepgram API documentation files or type definitions
fd -e "py" -e "md" | head -20 | xargs rg -l "detect_language|transcribe" | head -10

Repository: deepgram/deepgram-python-sdk

Length of output: 529


🏁 Script executed:

# Check how additional_query_parameters is processed in the SDK
rg "additional_query_parameters" -A 5 -B 5 src/deepgram/listen/v1/media/ | head -50

Repository: deepgram/deepgram-python-sdk

Length of output: 54


🏁 Script executed:

# Look for query parameter handling or serialization logic
fd -e "py" -path "*/src/*" | xargs rg -l "query.*parameter|serialize|format.*query" | head -5

Repository: deepgram/deepgram-python-sdk

Length of output: 439


🏁 Script executed:

# Check the example file to understand context
cat -n examples/listen/v1/media/transcribe_url/with_additional_query_parameters.py

Repository: deepgram/deepgram-python-sdk

Length of output: 769


Remove the list format from detect_language — use individual query parameters instead.

The Deepgram API requires detect_language to be passed as separate query parameters (e.g., detect_language=en&detect_language=es), not as a list. Change "detect_language": ["en", "es"] to pass the language codes as individual parameters through additional_query_parameters.

🤖 Prompt for AI Agents
In examples/listen/v1/media/transcribe_url/with_additional_query_parameters.py
around lines 14 to 18, change the additional_query_parameters so detect_language
is passed as separate query parameters rather than a single list; replace the
current mapping "detect_language": ["en", "es"] with a structure that encodes
duplicate query keys (e.g., a list of ("detect_language", value) pairs or
equivalent supported format) so the final query becomes
detect_language=en&detect_language=es.

)
print("Response received")
print(response)
except Exception as e:
print(f"Caught: {e}")