Skip to content

[BUG] Chromadb client and sever version mismatches cause a KeyError when running vectorcode. #194

@sethamclean

Description

@sethamclean

Describe the bug
Chromadb client and sever version mismatches cause a KeyError when running vectorcode.

To Reproduce
Steps to reproduce the behavior:
Using vectorcode 0.6.10 (nixpkg) and chromadb 1.0.0 (nixpkg)

➜ vectorcode vectorise README.md
WARNING: vectorcode.cli_utils : Loading default config.
ERROR: vectorcode.main : Traceback (most recent call last):
  File "/nix/store/0vgzjdfzdbgsini71889c46b25wsmfgq-vectorcode-0.6.10/lib/python3.12/site-packages/vectorcode/main.py", line 95, in async_main
    return_val = await vectorise(final_configs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/0vgzjdfzdbgsini71889c46b25wsmfgq-vectorcode-0.6.10/lib/python3.12/site-packages/vectorcode/subcommands/vectorise.py", line 165, in vectorise
    collection = await get_collection(client, configs, True)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/0vgzjdfzdbgsini71889c46b25wsmfgq-vectorcode-0.6.10/lib/python3.12/site-packages/vectorcode/common.py", line 212, in get_collection
    collection = await client.get_or_create_collection(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/rh2mf95idi1mxhqzm9z02r7ajsmk8lq6-python3.12-chromadb_0-0.6.3/lib/python3.12/site-packages/chromadb/api/async_client.py", line 228, in get_or_create_collection
    model = await self._server.get_or_create_collection(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/rh2mf95idi1mxhqzm9z02r7ajsmk8lq6-python3.12-chromadb_0-0.6.3/lib/python3.12/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 134, in async_wrapper
    return await f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/rh2mf95idi1mxhqzm9z02r7ajsmk8lq6-python3.12-chromadb_0-0.6.3/lib/python3.12/site-packages/chromadb/api/async_fastapi.py", line 324, in get_or_create_collection
    return await self.create_collection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/rh2mf95idi1mxhqzm9z02r7ajsmk8lq6-python3.12-chromadb_0-0.6.3/lib/python3.12/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 134, in async_wrapper
    return await f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/rh2mf95idi1mxhqzm9z02r7ajsmk8lq6-python3.12-chromadb_0-0.6.3/lib/python3.12/site-packages/chromadb/api/async_fastapi.py", line 291, in create_collection
    model = CollectionModel.from_json(resp_json)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/rh2mf95idi1mxhqzm9z02r7ajsmk8lq6-python3.12-chromadb_0-0.6.3/lib/python3.12/site-packages/chromadb/types.py", line 156, in from_json
    configuration = CollectionConfigurationInternal.from_json(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/rh2mf95idi1mxhqzm9z02r7ajsmk8lq6-python3.12-chromadb_0-0.6.3/lib/python3.12/site-packages/chromadb/api/configuration.py", line 209, in from_json
    f"Trying to instantiate configuration of type {cls.__name__} from JSON with type {json_map['_type']}"
                                                                                      ~~~~~~~~^^^^^^^^^
KeyError: '_type'

Expected behavior

The README.md is added to a new collection

VectorCode Configuration
default config with a chroma server listening at the default address

Platform information:
Packages installed via nix

System Information:
Ubuntu docker image with nix package manager

Additional context
This seems to be related to chromadb needing to be updated. Older client packages do not seem to be compatible with newer versions of chromadb.

chroma-core/chroma#4386

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions