Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix types for FilterTypedDict#570

Open
yyc wants to merge 1 commit intopinecone-io:mainpinecone-io/pinecone-python-client:mainfrom
yyc:yyc/fixyyc/pinecone-python-client:yyc/fixCopy head branch name to clipboard
Open

Fix types for FilterTypedDict#570
yyc wants to merge 1 commit intopinecone-io:mainpinecone-io/pinecone-python-client:mainfrom
yyc:yyc/fixyyc/pinecone-python-client:yyc/fixCopy head branch name to clipboard

Conversation

@yyc
Copy link

@yyc yyc commented Jan 5, 2026

Problem

I believe the currently-set type for FilterTypedDict is incorrect. It suggests that the correct type is, for example:

index.query(
    ...,
    filter={"$in": ["red", "blue", "green"]}, # metadata key missing
    namespace=str(company_id),
),

when the correct type from your documentation indicates that it should be

index.query(
    ...,
    filter={"colors": {"$in": ["red", "blue", "green"]}},
    namespace=str(company_id),
),

Solution

- FilterTypedDict = SimpleFilter | AndFilter | OrFilter
+ FilterTypedDict = dict[str, SimpleFilter | AndFilter | OrFilter]

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Test Plan

Was running into this when running pyright on my codebase which uses pinecone.

index.query(
    ...,
    filter={"colors": {"$in": ["red", "blue", "green"]}}, # <- error on this line
    namespace=str(company_id),
),
Argument of type "dict[str, dict[str, list[str]]]" cannot be assigned to parameter "filter" of type "FilterTypedDict | None" in function "query"
  Type "dict[str, dict[str, list[str]]]" is not assignable to type "FilterTypedDict | None"
    "dict[str, dict[str, list[str]]]" is not assignable to "Dict[str, FieldValue]"

Modifying the type as shown causes the error to go away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.