qdrant / qdrant-haystack

An integration of Qdrant ANN vector database backend with Haystack
Apache License 2.0
43 stars 12 forks source link

'NoneType' object does not support item assignment #29

Closed HaveF closed 11 months ago

HaveF commented 1 year ago

Hi, there,

qdrant-haystack 1.0.7

I just use this package with your cloud, but without luck

document_store = QdrantDocumentStore(
    "https://xxxxxxxx.aws.cloud.qdrant.io",
    index="Document",
    api_key="xxxxxxxx",    
    embedding_dim=1536,
    recreate_index=True,
)

here is the error:

[/usr/local/lib/python3.10/dist-packages/haystack/nodes/base.py](https://localhost:8080/#) in wrapper_exportable_to_yaml(self, *args, **kwargs)
     44 
     45         # Call the actuall __init__ function with all the arguments
---> 46         init_func(self, *args, **kwargs)
     47 
     48     return wrapper_exportable_to_yaml

[/usr/local/lib/python3.10/dist-packages/qdrant_haystack/document_stores/qdrant.py](https://localhost:8080/#) in __init__(self, location, url, port, grpc_port, prefer_grpc, https, api_key, prefix, timeout, host, path, index, embedding_dim, content_field, name_field, embedding_field, similarity, return_embedding, progress_bar, duplicate_documents, recreate_index, shard_number, replication_factor, write_consistency_factor, on_disk_payload, hnsw_config, optimizers_config, wal_config, quantization_config, init_from, wait_result_from_api, metadata)
     78         super().__init__()
     79 
---> 80         self.client = qdrant_client.QdrantClient(
     81             location=location,
     82             url=url,

[/usr/local/lib/python3.10/dist-packages/qdrant_client/qdrant_client.py](https://localhost:8080/#) in __init__(self, location, url, port, grpc_port, prefer_grpc, https, api_key, prefix, timeout, host, path, **kwargs)
     83                 if location is not None and url is None:
     84                     url = location
---> 85                 self._client = QdrantRemote(
     86                     url=url,
     87                     port=port,

[/usr/local/lib/python3.10/dist-packages/qdrant_client/qdrant_remote.py](https://localhost:8080/#) in __init__(self, url, port, grpc_port, prefer_grpc, https, api_key, prefix, timeout, host, **kwargs)
    117             http2 = True
    118 
--> 119             self._rest_headers["api-key"] = api_key
    120             self._grpc_headers.append(("api-key", api_key))
    121 

TypeError: 'NoneType' object does not support item assignment

What am I missing?

Thanks!

Forbu commented 1 year ago

version : haystack==1.19.0 qdrant-haystack 1.0.7

I have an error very close to this :

document_store = QdrantDocumentStore(path="/home/qdrant",
index="Document",
embedding_dim=d_embedding,
recreate_index=True,
hnsw_config={"m": 16, "ef_construct": 64})

document_store.write_documents(documents)

The documents write themself in the DB but at the very end I have this error :

210000it [39:55, 87.67it/s]                                                                                                                                                                                                     
Exception ignored in: <function QdrantClient.__del__ at 0x7ffa56045160>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/qdrant_client/qdrant_client.py", line 99, in __del__
  File "/usr/local/lib/python3.8/dist-packages/qdrant_client/qdrant_client.py", line 106, in close
  File "/usr/local/lib/python3.8/dist-packages/qdrant_client/local/qdrant_local.py", line 55, in close
TypeError: 'NoneType' object is not callable
kacperlukawski commented 1 year ago

@Forbu Could you please also check the version of qdrant-client?

Forbu commented 1 year ago

@kacperlukawski

My version of qdrant-client is 1.4.0

Requirement already satisfied: qdrant-client in /usr/local/lib/python3.8/dist-packages (1.4.0)
kacperlukawski commented 1 year ago

@HaveF @Forbu Version 1.0.8 has been just released. Could you please try to reproduce it with the latest version?

Forbu commented 1 year ago

@HaveF @Forbu Version 1.0.8 has been just released. Could you please try to reproduce it with the latest version?

I will try today :)

HaveF commented 1 year ago

@kacperlukawski do I need to update the qdrant-client version? https://github.com/qdrant/qdrant-haystack/blob/3fd8f2346b42fa37ff5bf206fda427fc5d0a2fde/pyproject.toml#L14

But qdrant-client has version 1.5.2 already

HaveF commented 1 year ago

for qdrant-haystack 1.0.7 -> 1.0.8, I did not find any change except a test case added... fix: fix passing metadata

kacperlukawski commented 1 year ago

@HaveF Version 1.0.8 restricts qdrant-client<1.5.0 as we have a small issue with the client itself. It'll be fixed soon and followed up by another release of qdrant-haystack.

I really can't reproduce the error, I'll extend the testing suite to run against different versions of Haystack and Qdrant.

HaveF commented 1 year ago

@kacperlukawski drop me a mail (iamaplayer at gmail), I'll give you sample code with api_key

Forbu commented 1 year ago

I still have the same error :(

kacperlukawski commented 1 year ago

@HaveF I've just made a hotfix for that. Version 1.0.9 should be working fine in that scenario.

@Forbu It seems it has to be fixed in qdrant-client. I'll have a look at that.

HaveF commented 1 year ago

@kacperlukawski it works now. thanks ❤️

kacperlukawski commented 1 year ago

@Forbu Could you please try with 1.0.10? Please make sure you have the latest qdrant-client (1.5.4)