Initial Checks
Description
I'm encountering an issue when attempting to define an index of type QdrantDocumentIndex for documents that include fields with non-class types (e.g., lists). The error message I'm receiving is as follows:
TypeError: issubclass() arg 1 must be a class
It seems that this error is related to the interaction between the document's fields and the index definition. The error happens in:
|
if any(issubclass(python_type, vt) for vt in QDRANT_PY_VECTOR_TYPES): |
I suggest the following:
if any(safe_issubclass(python_type, vt) for vt in QDRANT_PY_VECTOR_TYPES):
Steps to Reproduce:
- Create a Document with a field of non-class type (e.g., a list).
- Attempt to define an index of type QdrantDocumentIndex for the created Document.
- Observe the TypeError mentioned above.
Example Code
from docarray import DocVec, BaseDoc
from docarray.index import QdrantDocumentIndex
class DocPaper(BaseDoc):
id: str
title: str
abstract: str
authors: List[str]
host = "localhost"
port = 6333
collection_name = "papers"
qdrant_config = QdrantDocumentIndex.DBConfig(
host=host, port=port, collection_name=collection_name
)
doc_index = QdrantDocumentIndex[DocPaper](qdrant_config)
Python, Pydantic & OS Version
0.37.0, ubuntu system, Python 3.9.16
Affected Components
Initial Checks
Description
I'm encountering an issue when attempting to define an index of type QdrantDocumentIndex for documents that include fields with non-class types (e.g., lists). The error message I'm receiving is as follows:
It seems that this error is related to the interaction between the document's fields and the index definition. The error happens in:
docarray/docarray/index/backends/qdrant.py
Line 272 in adb0d01
I suggest the following:
if any(safe_issubclass(python_type, vt) for vt in QDRANT_PY_VECTOR_TYPES):Steps to Reproduce:
Example Code
Python, Pydantic & OS Version
Affected Components