Skip to content
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

Python client type hint error with column-oriented upsert #784

Open
affanshahid opened this issue Sep 24, 2024 · 4 comments
Open

Python client type hint error with column-oriented upsert #784

affanshahid opened this issue Sep 24, 2024 · 4 comments

Comments

@affanshahid
Copy link

affanshahid commented Sep 24, 2024

I'm trying to do an upsert without hard-coded data and I get some type hint errors. Everything works fine so I'm assuming its just a typing issue.

image

The error on ids is:

Pyright: Argument of type "list[int]" cannot be assigned to parameter "ids" of type "List[ExtendedPointId]" in function "__init__"
  "list[int]" is not assignable to "List[ExtendedPointId]"
    Type parameter "_T@list" is invariant, but "int" is not the same as "ExtendedPointId"
    Consider switching from "list" to "Sequence" which is covariant

I can fix this one by typing the ids declaration as ids: list[ExtendedPointId]. This may be just a pyright issue since ExtendedPointId is defined as int | str.

The error on vectors is:

Pyright: Argument of type "Iterable[ndarray[Unknown, Unknown]]" cannot be assigned to parameter "vectors" of type "BatchVectorStruct" in function "__init__"
  Type "Iterable[ndarray[Unknown, Unknown]]" is not assignable to type "BatchVectorStruct"
    "Iterable[ndarray[Unknown, Unknown]]" is not assignable to "List[List[StrictFloat]]"
    "Iterable[ndarray[Unknown, Unknown]]" is not assignable to "List[List[List[StrictFloat]]]"
    "Iterable[ndarray[Unknown, Unknown]]" is not assignable to "Dict[StrictStr, List[Vector]]"

Can't seem to get around this one without a cast. Like I said, everything works but the type errors hamper the DX.

@joein
Copy link
Member

joein commented Sep 24, 2024

Hi @affanshahid
Thanks for reporting this, we'll look into it
Could you please tell us qdrant-client version you're using along with the version of pyright?

@affanshahid
Copy link
Author

affanshahid commented Sep 24, 2024

  • qdrant-client 1.11.2
  • pyright language server 1.1.381

@joein
Copy link
Member

joein commented Oct 11, 2024

Hey @affanshahid
We took a look at the issue, we might need more time to fix the problem with ids
However, embeddings type hint issue seems to be correct, since it does not expect numpy arrays

@affanshahid
Copy link
Author

I see, i imported TextEmbedding from fastembed in the example, what would be the correct way of doing this? Cast to regular list?

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

No branches or pull requests

2 participants