chroma-core / chroma

the AI-native open-source embedding database
https://www.trychroma.com/
Apache License 2.0
15.63k stars 1.31k forks source link

[Bug]: Error occurs when upgrading embedchain to the 0.1.125 version #3188

Open Rainismer opened 6 days ago

Rainismer commented 6 days ago

What happened?

TypeError: SegmentAPI.get_or_create_collection() got an unexpected keyword argument 'embedding_function'

image

Versions

Chroma 0.5.20,Python 3.11, OS Windows10

Relevant log output

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1232, in _handle_fromlist
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\AIGC\idataai_py\services_router\query2sql_service.py", line 12, in <module>
    from services.s2sql.run import text2sql_agent_router
  File "D:\AIGC\idataai_py\services\s2sql\run.py", line 48, in <module>
    text2sql_agent.reload_setting(sql_ids, sql_exemplars, TEXT2DSL_EXAMPLE_NUM, TEXT2DSL_FEWSHOTS_NUM, TEXT2DSL_SELF_CONSISTENCY_NUM)
  File "D:\AIGC\idataai_py\services\s2sql\sql_agent.py", line 478, in reload_setting
    self.sql_example_prompter.reload_few_shot_example(sql_example_ids, sql_example_units)
  File "D:\AIGC\idataai_py\services\s2sql\constructor.py", line 51, in reload_few_shot_example
    self.few_shot_retriever.empty_query_collection()
  File "D:\AIGC\idataai_py\services\query_retrieval\retriever.py", line 70, in empty_query_collection
    self.collection = empty_chroma_collection_2(self.collection)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AIGC\idataai_py\utils\chromadb_utils.py", line 25, in empty_chroma_collection_2
    new_collection = client.get_or_create_collection(name=collection_name,
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AIGC\idataai_py\venv\Lib\site-packages\chromadb\telemetry\opentelemetry\__init__.py", line 150, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "D:\AIGC\idataai_py\venv\Lib\site-packages\chromadb\api\segment.py", line 103, in wrapper
    return self._rate_limit_enforcer.rate_limit(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AIGC\idataai_py\venv\Lib\site-packages\chromadb\rate_limit\simple_rate_limit\__init__.py", line 23, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
TypeError: SegmentAPI.get_or_create_collection() got an unexpected keyword argument 'embedding_function'
python-BaseException
tazarov commented 5 days ago

hey @Rainismer, is this the project you are referring to https://github.com/mem0ai/mem0? Overall the error seems to be related to a tight coupling with Chroma internal APIs (aka SegmentAPI). Can you share the code for empty_query_collection or empty_chroma_collection_2 from chromadb_utils

Rainismer commented 4 days ago

@tazarov Yes, this is the project I mentioned. Please check the attachment:chromadb_utils.txt.

chromadb_utils.txt