microsoft / autogen

A programming framework for agentic AI. Discord: https://aka.ms/autogen-dc. Roadmap: https://aka.ms/autogen-roadmap
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
28.04k stars 4.09k forks source link

[Bug]: qdrant-client version>=1.9.2 is not supported in RAG agents #2985

Closed thinkall closed 18 hours ago

thinkall commented 1 week ago

Describe the bug

Qdrant test/agentchat/contrib/retrievechat/test_qdrant_retrievechat.py::test_qdrant_filter started failing as qdrant-client released a new version 1.9.2.

Steps to reproduce

No response

Model Used

No response

Expected Behavior

No response

Screenshots and logs

No response

Additional Information

______________________________ test_qdrant_filter ______________________________
    @pytest.mark.skipif(not QDRANT_INSTALLED, reason="qdrant_client is not installed")
    def test_qdrant_filter():
        client = QdrantClient(":memory:")
>       create_qdrant_from_dir(dir_path="./website/docs", client=client, collection_name="autogen-docs")
test/agentchat/contrib/retrievechat/test_qdrant_retrievechat.py:86: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
autogen/agentchat/contrib/qdrant_retrieve_user_proxy_agent.py:2[32](https://github.com/microsoft/autogen/actions/runs/9609759183/job/26505996587?pr=2942#step:11:33): in create_qdrant_from_dir
    client.add(
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/qdrant_client/qdrant_fastembed.py:525: in add
    self.upload_points(
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/qdrant_client/qdrant_client.py:19[33](https://github.com/microsoft/autogen/actions/runs/9609759183/job/26505996587?pr=2942#step:11:34): in upload_points
    return self._client.upload_points(
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/qdrant_client/local/qdrant_local.py:722: in upload_points
    self._upload_points(collection_name, points)
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/qdrant_client/local/qdrant_local.py:737: in _upload_points
    [
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/qdrant_client/local/qdrant_local.py:737: in <listcomp>
    [
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/qdrant_client/qdrant_fastembed.py:[35](https://github.com/microsoft/autogen/actions/runs/9609759183/job/26505996587?pr=2942#step:11:36)0: in _points_iterator
    for idx, meta, (doc, vector), sparse_vector in zip(
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/qdrant_client/qdrant_fastembed.py:254: in _embed_documents
    for vector, doc in zip(vectors_iter, documents_b):
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/text/text_embedding_base.py:43: in passage_embed
    yield from self.embed(texts, **kwargs)
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/text/text_embedding.py:93: in embed
    yield from self.model.embed(documents, batch_size, parallel, **kwargs)
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/text/onnx_embedding.py:266: in embed
    yield from self._embed_documents(
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/common/onnx_model.py:1[36](https://github.com/microsoft/autogen/actions/runs/9609759183/job/26505996587?pr=2942#step:11:37): in _embed_documents
    for batch in pool.ordered_map(iter_batch(documents, batch_size), **params):
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/parallel_processor.py:125: in ordered_map
    for idx, item in self.semi_ordered_map(stream, *args, **kwargs):

...

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/parallel_processor.py", line 52, in _worker
    worker = worker_class.start(**kwargs)
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/common/onnx_model.py", line 157, in start
    return cls(
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/common/onnx_model.py", line 153, in __init__
    self.model = self.init_embedding(model_name, cache_dir)
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/text/onnx_embedding.py", line 298, in init_embedding
    return OnnxTextEmbedding(model_name=model_name, cache_dir=cache_dir, threads=1)
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/text/onnx_embedding.py", line 237, in __init__
    self.load_onnx_model(
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/common/onnx_model.py", line 79, in load_onnx_model
    self.tokenizer = load_tokenizer(model_dir=model_dir)
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/fastembed/common/models.py", line 34, in load_tokenizer
    tokenizer = Tokenizer.from_file(str(tokenizer_path))
Exception: EOF while parsing a value at line 8166 column 14
ERROR:root:[Errno 2] No such file or directory: 'None/fast-bge-small-en.tar.gz'
thinkall commented 1 week ago

@Anush008 would you like to fix this?

Anush008 commented 1 week ago

Hi @thinkall. I will look into this. Thank you.

Anush008 commented 1 week ago

Hi @thinkall. The test seems to work fine for me with

pytest test/agentchat/contrib/retrievechat/test_qdrant_retrievechat.py --skip-openai -s

Could you please retry?

thinkall commented 1 week ago

Hi @thinkall. The test seems to work fine for me with


pytest test/agentchat/contrib/retrievechat/test_qdrant_retrievechat.py --skip-openai -s

Could you please retry?

Hi @Anush008 , I pinned the version to 1.9.1 to bypass the error. But we need to support latest version 1.9.2, could you help on that? Thanks.

Anush008 commented 1 week ago

Will do.

Anush008 commented 1 week ago

Hi @thinkall. Could you please run

pip install -U fastembed qdrant-client

qdrant-client uses fastembed to generate embeddings. It recently had a fix which could be related to this. The test works fine with the latest versions for me.

thinkall commented 20 hours ago

Hi @thinkall. Could you please run

pip install -U fastembed qdrant-client

qdrant-client uses fastembed to generate embeddings. It recently had a fix which could be related to this. The test works fine with the latest versions for me.

Thank you @Anush008 , I've tested that fastembed==0.2.7 has the issue. Updated the dependency of retrievechat-qdrant accordingly in #3064 .