qdrant-client
qdrant-client copied to clipboard
pycharm complains on np.ndarray.tolist
import qdrant_client as qc
import numpy as np
cl = qc.QdrantClient()
cl.search("collection", query_vector=np.random.rand(5, 10).tolist())
pycharm complains on query_vector
due to tolist()
return type
complaint:
Expected type 'Union[ndarray, ndarray[Any, dtype[Union[bool_, int8, short, intc, long, uint8, ushort, uintc, uintp, half, single, float_, longfloat]]], Sequence[float], tuple[str, list[float]], NamedVector]', got 'object' instead
Hi, I would like to look up on this issue.
Could you give me the steps to replicate this error(Like the data being stored in collection).
Hi
Data is not required, just create a new python file, copy-paste the code above and open it via PyCharm, it should highlight query_vector=np.random.rand(5, 10).tolist()
Adding the following line above the search method call makes the error go away
# noinspection PyTypeChecker
cl.search("collection", query_vector=np.random.rand(5, 10).tolist())
My best guess is that pycharm tries to assign it a data type at run time, but guesses it wrongly
cl.search(...)
is a sample of code which might be used in users' applications
We don't want to tell each user to write this comment to ignore the problem, instead we want to try to solve it inside the library