Skip to content

Commit

Permalink
More more mypy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamon committed Dec 16, 2024
1 parent f7413f8 commit ab1f9e8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pinecone/data/types/query_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from typing import Literal, Dict, List, Union

FieldValue = Union[str, int, float, bool]

ExactMatchFilter = Dict[str, FieldValue]

EqFilter = Dict[Literal["$eq"], FieldValue]
NeFilter = Dict[Literal["$ne"], FieldValue]

NumericFieldValue = Union[int, float]
GtFilter = Dict[Literal["$gt"], NumericFieldValue]
GteFilter = Dict[Literal["$gte"], NumericFieldValue]
LtFilter = Dict[Literal["$lt"], NumericFieldValue]
LteFilter = Dict[Literal["$lte"], NumericFieldValue]

InFilter = Dict[Literal["$in"], List[FieldValue]]
NinFilter = Dict[Literal["$nin"], List[FieldValue]]


SimpleFilter = Union[
ExactMatchFilter,
EqFilter,
NeFilter,
GtFilter,
GteFilter,
LtFilter,
LteFilter,
InFilter,
NinFilter,
]
AndFilter = Dict[Literal["$and"], List[SimpleFilter]]

FilterTypedDict = Union[SimpleFilter, AndFilter]

0 comments on commit ab1f9e8

Please sign in to comment.