fix(listen/v2): restore subscript access on typed responses - #769
Merged
Conversation
GregHolmes
requested review from
deepgram-kiley and
dg-coreylweathers
as code owners
August 21, 2026 15:15
Contributor
|
dg-edcharbeneau
self-requested a review
August 21, 2026 15:43
dg-edcharbeneau
previously approved these changes
Aug 21, 2026
dg-edcharbeneau
left a comment
There was a problem hiding this comment.
Greg's fix addresses the removes the TypeError. #1130 should now be closed, not merged
dg-edcharbeneau
approved these changes
Aug 21, 2026
deepgram-kiley
approved these changes
Aug 21, 2026
deepgram-kiley
left a comment
Contributor
There was a problem hiding this comment.
Approving based on @dg-edcharbeneau's previous review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
response["field"]access only on the seven Listen V2 response and nested-response model classes affected by the 7.7.0 retypeKeyErrorfor omitted fieldsWhy
SDK 7.7.0 removed the
typing.Anymember fromV2SocketClientResponse, correctly restoring typed Listen V2 responses. Through 7.6, that member caused every Listen V2 response to be returned as a raw dictionary, so callers usingresponse["field"]broke when upgrading.This surfaced while reviewing deepgram-docs#1130. The docs should continue teaching typed attribute access; this narrow shim protects the previously working subscript syntax.
Both styles now work:
This PR intentionally does not turn Pydantic models into full dictionaries or
Mappingobjects. It restores only the subscript access that triggered the customer-facing regression. Models remain immutable and attribute access remains canonical.Verification
pytest: 985 passed, 1 skippedmypy src/: cleanmypy tests/typecheck: cleanruff check src/deepgram tests/custom/test_model_dict_compat.py: cleanmainwithTypeError: ListenV2TurnInfo object is not subscriptable