diff --git a/python/packages/autogen-ext/pyproject.toml b/python/packages/autogen-ext/pyproject.toml index 0ddee520550b..47d8e9af0b52 100644 --- a/python/packages/autogen-ext/pyproject.toml +++ b/python/packages/autogen-ext/pyproject.toml @@ -41,7 +41,7 @@ llama-cpp = [ ] graphrag = ["graphrag>=1.0.1"] -chromadb = ["chromadb"] +chromadb = ["chromadb>=1.0.0"] web-surfer = [ "autogen-agentchat==0.5.1", "playwright>=1.48.0", @@ -78,7 +78,7 @@ jupyter-executor = [ "nbclient>=0.10.2", ] -task-centric-memory = ["chromadb>=0.6.3"] +task-centric-memory = ["chromadb>=1.0.0"] semantic-kernel-core = [ "semantic-kernel>=1.17.1", diff --git a/python/packages/autogen-ext/src/autogen_ext/memory/chromadb.py b/python/packages/autogen-ext/src/autogen_ext/memory/chromadb.py index 35d8564098e1..3732544fa6b1 100644 --- a/python/packages/autogen-ext/src/autogen_ext/memory/chromadb.py +++ b/python/packages/autogen-ext/src/autogen_ext/memory/chromadb.py @@ -7,9 +7,8 @@ from autogen_core.model_context import ChatCompletionContext from autogen_core.models import SystemMessage from chromadb import HttpClient, PersistentClient -from chromadb.api import ClientAPI from chromadb.api.models.Collection import Collection -from chromadb.api.types import Document, IncludeEnum, Metadata +from chromadb.api.types import Document, Metadata from pydantic import BaseModel, Field from typing_extensions import Self @@ -331,7 +330,7 @@ async def query( results = self._collection.query( query_texts=[query_text], n_results=self._config.k, - include=[IncludeEnum.documents, IncludeEnum.metadatas, IncludeEnum.distances], + include=["documents", "metadatas", "distances"], **kwargs, ) diff --git a/python/samples/gitty/src/gitty/_db.py b/python/samples/gitty/src/gitty/_db.py index 78ed1e119acd..4535ebf5b106 100644 --- a/python/samples/gitty/src/gitty/_db.py +++ b/python/samples/gitty/src/gitty/_db.py @@ -55,8 +55,6 @@ def update_chroma(gitty_dir: str, db_path: str) -> None: conn.close() sentence_transformer_ef = embedding_functions.DefaultEmbeddingFunction() - if sentence_transformer_ef is None: - raise RuntimeError("Default embedding function is not available.") for issue_number, title, content in rows: meta = {"title": title} @@ -160,10 +158,6 @@ def fetch_and_update_issues(owner: str, repo: str, db_path: Optional[str] = None # New embedding function using sentence_transformers sentence_transformer_ef = embedding_functions.DefaultEmbeddingFunction() - if sentence_transformer_ef is None: - print("Error: Default embedding function is not available.") - exit(1) - for issue_number, title, content in rows: meta = {"title": title} # metadata for each issue embedding = sentence_transformer_ef([content])[0] diff --git a/python/uv.lock b/python/uv.lock index 9ebcad5e5e6a..ec143b4cd97f 100644 --- a/python/uv.lock +++ b/python/uv.lock @@ -734,8 +734,8 @@ requires-dist = [ { name = "azure-core", marker = "extra == 'azure'" }, { name = "azure-identity", marker = "extra == 'azure'" }, { name = "azure-search-documents", marker = "extra == 'azure'", specifier = ">=11.4.0" }, - { name = "chromadb", marker = "extra == 'chromadb'" }, - { name = "chromadb", marker = "extra == 'task-centric-memory'", specifier = ">=0.6.3" }, + { name = "chromadb", marker = "extra == 'chromadb'", specifier = ">=1.0.0" }, + { name = "chromadb", marker = "extra == 'task-centric-memory'", specifier = ">=1.0.0" }, { name = "diskcache", marker = "extra == 'diskcache'", specifier = ">=5.6.3" }, { name = "docker", marker = "extra == 'docker'", specifier = "~=7.0" }, { name = "ffmpeg-python", marker = "extra == 'video-surfer'" }, @@ -1339,7 +1339,7 @@ wheels = [ [[package]] name = "chromadb" -version = "0.6.3" +version = "1.0.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "bcrypt" }, @@ -1349,6 +1349,7 @@ dependencies = [ { name = "grpcio" }, { name = "httpx" }, { name = "importlib-resources" }, + { name = "jsonschema" }, { name = "kubernetes" }, { name = "mmh3" }, { name = "numpy" }, @@ -1371,9 +1372,13 @@ dependencies = [ { name = "typing-extensions" }, { name = "uvicorn", extra = ["standard"] }, ] -sdist = { url = "https://files.pythonhosted.org/packages/39/cd/f0f2de3f466ff514fb6b58271c14f6d22198402bb5b71b8d890231265946/chromadb-0.6.3.tar.gz", hash = "sha256:c8f34c0b704b9108b04491480a36d42e894a960429f87c6516027b5481d59ed3", size = 29297929 } +sdist = { url = "https://files.pythonhosted.org/packages/30/76/34998d22f5fc05f4affce956676074aa5bf864006699878334cc95a64d84/chromadb-1.0.4.tar.gz", hash = "sha256:ee927adfe618e170320b6da25b39a01282142350de70b9b76ab98aa7af7d2f34", size = 1145874 } wheels = [ - { url = "https://files.pythonhosted.org/packages/28/8e/5c186c77bf749b6fe0528385e507e463f1667543328d76fd00a49e1a4e6a/chromadb-0.6.3-py3-none-any.whl", hash = "sha256:4851258489a3612b558488d98d09ae0fe0a28d5cad6bd1ba64b96fdc419dc0e5", size = 611129 }, + { url = "https://files.pythonhosted.org/packages/22/95/76b5a4ed9ee3e0fefb8d0676f9f4f4b622a311c3f367e3cc8491956314f6/chromadb-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:f6789b573f510815218b25027f8471b6c132acc2f2d2a53ff42e3e76d9d248ac", size = 17600592 }, + { url = "https://files.pythonhosted.org/packages/8b/68/59d9cefdbcee97755b6ba95d554366767053cfad7ff94081779f88111289/chromadb-1.0.4-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:32daa01014acf98570eeb31e966b641a4d79a2fdc1f750caa5dfc1ba24d9991c", size = 16870748 }, + { url = "https://files.pythonhosted.org/packages/12/da/339d6d7dbcc227786018c54a36d7ed4b716896e3c32bedb8e4ae94098315/chromadb-1.0.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:844a2a3bd624149093be84b9c3e2b070fa21da129c8563c790be64c4bf0d9f5f", size = 17384197 }, + { url = "https://files.pythonhosted.org/packages/b9/78/c5dcddcd0ce4ad9365a186fee36bb313656854406e37965241491b975f0a/chromadb-1.0.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c4e72dba33b6fd2da55f044498b298169724cae5113538fa18b3458427ecea8", size = 18279788 }, + { url = "https://files.pythonhosted.org/packages/22/c8/06214f13c0e83b9ffc597496491097b176d3039609497a3654b30b2ba114/chromadb-1.0.4-cp39-abi3-win_amd64.whl", hash = "sha256:37e8071e3bc40f0a67730f9483ca1d3e8a67d32a3409cd1beaacfb76336eb98c", size = 18222168 }, ] [[package]] @@ -1902,16 +1907,16 @@ wheels = [ [[package]] name = "fastapi" -version = "0.115.7" +version = "0.115.9" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydantic" }, { name = "starlette" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a2/f5/3f921e59f189e513adb9aef826e2841672d50a399fead4e69afdeb808ff4/fastapi-0.115.7.tar.gz", hash = "sha256:0f106da6c01d88a6786b3248fb4d7a940d071f6f488488898ad5d354b25ed015", size = 293177 } +sdist = { url = "https://files.pythonhosted.org/packages/ab/dd/d854f85e70f7341b29e3fda754f2833aec197bd355f805238758e3bcd8ed/fastapi-0.115.9.tar.gz", hash = "sha256:9d7da3b196c5eed049bc769f9475cd55509a112fbe031c0ef2f53768ae68d13f", size = 293774 } wheels = [ - { url = "https://files.pythonhosted.org/packages/e6/7f/bbd4dcf0faf61bc68a01939256e2ed02d681e9334c1a3cef24d5f77aba9f/fastapi-0.115.7-py3-none-any.whl", hash = "sha256:eb6a8c8bf7f26009e8147111ff15b5177a0e19bb4a45bc3486ab14804539d21e", size = 94777 }, + { url = "https://files.pythonhosted.org/packages/32/b6/7517af5234378518f27ad35a7b24af9591bc500b8c1780929c1295999eb6/fastapi-0.115.9-py3-none-any.whl", hash = "sha256:4a439d7923e4de796bcc88b64e9754340fcd1574673cbd865ba8a99fe0d28c56", size = 94919 }, ] [package.optional-dependencies]