milvus.py: pymilvus.exceptions.MilvusException:

  Kiến thức lập trình

I query a collection in a zilliz milvus db like this:

documents = vector_store.similarity_search_with_score(query)

The query is successful but in line 777 of milvus.py the value result.full_length is retrieved, which is not available:

for result in res[0]:
            data = {x: result.entity.get(x) for x in output_fields}
            doc = self._parse_document(data)
            pair = (doc, result.full_length)
            ret.append(pair)

which then leads to this exception

File "/Users/tilman/LangchainCorsera/venv/lib/python3.9/site-packages/langchain_community/vectorstores/milvus.py", line 644, in similarity_search
    res = self.similarity_search_with_score(
  File "/Users/tilman/LangchainCorsera/venv/lib/python3.9/site-packages/langchain_community/vectorstores/milvus.py", line 717, in similarity_search_with_score
    res = self.similarity_search_with_score_by_vector(
  File "/Users/tilman/LangchainCorsera/venv/lib/python3.9/site-packages/langchain_community/vectorstores/milvus.py", line 777, in similarity_search_with_score_by_vector
    pair = (doc, result.full_length)
  File "/Users/tilman/LangchainCorsera/venv/lib/python3.9/site-packages/pymilvus/client/abstract.py", line 588, in __getattr__
    raise MilvusException(message=f"Field {item} is not in the hit entity")
pymilvus.exceptions.MilvusException: <MilvusException: (code=1, message=Field full_length is not in the hit entity)>

Any clues?

LEAVE A COMMENT