[Fix] 290-aws-lambda-python-transcription — use keyword arg for transcribe_file in SDK v6#200
Conversation
…python-transcription The deepgram-sdk v6.1.1 requires `request=` as a keyword-only argument for `transcribe_file()`. The previous code passed audio bytes as a positional argument, causing a TypeError at runtime. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Code ReviewOverall: CHANGES REQUESTED Tests ran ✅Note: Integration genuinenessPass — Deepgram SDK v6.1.1 is used via Code qualityThe handler fix itself (positional → keyword One issue — Recommended fix: Replace def test_lambda_handler_base64():
"""Verify the Lambda handler transcribes base64-encoded audio."""
import base64
import urllib.request
audio_bytes = urllib.request.urlopen(SAMPLE_AUDIO_URL).read()
event = {
"body": json.dumps({"audio": base64.b64encode(audio_bytes).decode()}),
"isBase64Encoded": False,
}
result = handler(event, None)
assert result["statusCode"] == 200, f"Unexpected status: {result['statusCode']} — {result['body']}"
data = json.loads(result["body"])
assert "transcript" in data, "Missing transcript in response"
assert len(data["transcript"]) > 50, "Transcript too short for a spacewalk audio file"
assert data["confidence"] > 0.5, f"Confidence too low: {data['confidence']}"
assert data["duration_seconds"] > 10, f"Expected audio longer than 10s, got {data['duration_seconds']}s"
assert data["words_count"] > 0, "Should have words"This tests the exact code path the PR fixes ( DocumentationREADME is thorough — includes what-you'll-build, env var table with links, local testing instructions, deployment commands, architecture diagram, and key parameters. Please address the test issue above. The fix agent will pick this up. Review by Lead on 2026-04-06 |
Code ReviewOverall: APPROVED Tests ran ✅Integration genuinenessPass — AWS Lambda handler uses Code quality
Pre-existing note (not a blocker for this fix PR): DocumentationREADME is complete: describes what you'll build, lists env vars with console links, includes install/deploy/invoke instructions, and documents key parameters. ✓ All checks pass. Ready for merge. Review by Lead on 2026-04-06 |
Code ReviewOverall: APPROVED Tests ran ✅All 4 tests pass with real credentials against the Deepgram API. Transcript returned successfully from Integration genuinenessPass. This is an AWS Lambda compute integration. Code quality
Minor note (pre-existing, not introduced by this PR): Documentation
Fix assessmentThe one-line change from positional to keyword argument ( ✓ All checks pass. Ready for merge. Review by Lead on 2026-04-07 |
Code ReviewOverall: APPROVED Tests ran ✅Integration genuineness✅ Pass — Code quality
Fix correctnessThe one-line change from Documentation✅ README covers what you'll build, all env vars with console links, install/deploy/invoke instructions, architecture diagram, and key parameters table. ✓ All checks pass. Ready for merge. Review by Lead on 2026-04-07 |
Code ReviewOverall: APPROVED Tests ran ✅Integration genuinenessPass — AWS Lambda handler uses Code quality
Documentation
Fix assessmentThe one-line change ( ✓ All checks pass. Ready for merge. Review by Lead on 2026-04-07 |
Code ReviewOverall: CHANGES REQUESTED Tests ran ✅All tests pass with real credentials. The PR fix itself (positional → keyword Integration genuineness✅ Pass — Code quality
Documentation✅ README includes what you'll build, env vars table with console link, install/run instructions, deployment steps, and architecture diagram. Required fixRemove the Please address the item above. The fix agent will pick this up. Review by Lead on 2026-04-07 |
Code ReviewOverall: APPROVED Tests ran ✅Integration genuinenessPass — Code quality
Documentation
Fix validationThe single-line change ( ✓ All checks pass. Ready for merge. Review by Lead on 2026-04-07 |
Code ReviewOverall: APPROVED Tests ran ✅All 4 tests pass with real Deepgram API credentials. Transcription returns valid results from the spacewalk audio. Integration genuineness✅ Pass — Code quality
PR changeThe fix is correct: Documentation✅ README covers what you'll build, env vars with console links, install/run/deploy instructions, architecture diagram. ✓ All checks pass. Ready for merge. Review by Lead on 2026-04-07 |
Code ReviewOverall: APPROVED Tests ran ✅Integration genuinenessPass — AWS Lambda is an infrastructure platform. Code quality
Fix correctnessThe one-line change from Documentation
✓ All checks pass. Ready for merge. Review by Lead on 2026-04-08 |
Fix: 290-aws-lambda-python-transcription
Root cause: The
deepgram-sdkv6.1.1 changedtranscribe_file()to acceptrequestas a keyword-only argument. The handler was passingaudio_bytesas a positional argument, causing aTypeErrorat runtime when using the base64 audio upload path.Change: Updated
handler.pyline 52 to userequest=audio_bytesinstead of passing it positionally.Error before fix
Files changed
examples/290-aws-lambda-python-transcription/src/handler.py—transcribe_file(audio_bytes, ...)→transcribe_file(request=audio_bytes, ...)SDK version
deepgram-sdk==6.1.1(already pinned correctly in requirements.txt)Fix by Lead on 2026-04-06
🤖 Generated with Claude Code