generated from deepgram/oss-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 109
fix: keyterm and keywords support for multiple values #614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify httpx.QueryParams.add() handles sequences correctly.
The type signature update looks good and enables multi-value support. However, ensure that
httpx.QueryParams.add()at lines 102-103 correctly serializes a sequence into multiple query parameters with the same key (e.g.,?keyterm=val1&keyterm=val2).Run the following script to verify httpx behavior:
🏁 Script executed:
Length of output: 142
🏁 Script executed:
Length of output: 870
🏁 Script executed:
Length of output: 84
💡 Result:
Use a dict whose value is a list (httpx does not accept a list-of-tuples for params). Example:
Simple GET with repeated key:
import httpx
r = httpx.get("https://example.com/search", params={"tag": ["red", "blue"]})
-> https://example.com/search?tag=red&tag=blue
Using QueryParams explicitly:
from httpx import QueryParams
params = QueryParams({"tag": ["red", "blue"]})
r = httpx.get("https://example.com/search", params=params)
If you need advanced merging/serialization (custom list formats, preserving order, etc.) consider httpx-qs. [1][2]
Sources:
[1] HTTPX compatibility / Query Parameters (requests -> httpx differences). [3search2]
[2] httpx-qs (extra query-string control). [0search6]
Fix httpx.QueryParams.add() to properly handle keyterm sequences.
The type signature at line 46 allows
Union[str, Sequence[str]], but the implementation at line 102 uses.add("keyterm", keyterm)which incorrectly stringifies sequences instead of expanding them into multiple query parameters.When
keyterm=["val1", "val2"]is passed, httpx produceskeyterm=%5B%27val1%27%2C+%27val2%27%5Dinstead of the correctkeyterm=val1&keyterm=val2.Solution: Check if
keytermis a sequence and add multiple parameters, or iterate through the sequence:🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukeocodes might be worth looking at.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not only is it right, this file should have been updated by Fern.
Shit, i'll need to look into this