Skip to content

langchain_chroma.Chroma used with chromadb.AsyncHttpClient? #30704

@khteh

Description

@khteh

Checked other resources

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Example Code

self._client = chromadb.AsyncHttpClient(host=config.CHROMA_URI, port=80, headers={"X-Chroma-Token": config.CHROMA_TOKEN}, tenant=self._tenant, database=self._database)
self._vector_store = Chroma(client = self._client, collection_name = self._collection, embedding_function = self._embeddings) 

Error Message and Stack Trace (if applicable)

    self._vector_store = Chroma(client = self._client, collection_name = self._collection, embedding_function = self._embeddings)        
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.12/site-packages/langchain_chroma/vectorstores.py", line 342, in __init__
    self.__ensure_collection()
  File "/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.12/site-packages/langchain_chroma/vectorstores.py", line 349, in __ensure_collection
    self._chroma_collection = self._client.get_or_create_collection(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'coroutine' object has no attribute 'get_or_create_collection'

Description

I wan to use langchain_chroma.Chroma with chromadb.AsyncHttpClient

System Info

System Information
------------------
> OS:  Linux
> OS Version:  #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 19 16:50:40 UTC 2025
> Python Version:  3.12.7 (main, Feb  4 2025, 14:46:03) [GCC 14.2.0]

Package Information
-------------------
> langchain_core: 0.3.49
> langchain: 0.3.22
> langchain_community: 0.3.20
> langsmith: 0.3.21
> langchain_chroma: 0.2.2
> langchain_cli: 0.0.36
> langchain_google_genai: 2.1.2
> langchain_google_vertexai: 2.0.18
> langchain_neo4j: 0.4.0
> langchain_ollama: 0.3.0
> langchain_openai: 0.3.11
> langchain_text_splitters: 0.3.7
> langgraph_sdk: 0.1.60
> langserve: 0.3.1

Other Dependencies
------------------
> aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
> anthropic[vertexai]: Installed. No version info available.
> async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
> chromadb!=0.5.10,!=0.5.11,!=0.5.12,!=0.5.4,!=0.5.5,!=0.5.7,!=0.5.9,<0.7.0,>=0.4.0: Installed. No version info available.
> dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
> fastapi: 0.115.12
> filetype: 1.2.0
> gitpython<4,>=3: Installed. No version info available.
> google-ai-generativelanguage: 0.6.17
> google-cloud-aiplatform: 1.87.0
> google-cloud-storage: 2.19.0
> gritql<1.0.0,>=0.2.0: Installed. No version info available.
> httpx: 0.27.2
> httpx-sse: 0.4.0
> httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
> jsonpatch<2.0,>=1.33: Installed. No version info available.
> langchain-anthropic;: Installed. No version info available.
> langchain-aws;: Installed. No version info available.
> langchain-azure-ai;: Installed. No version info available.
> langchain-cohere;: Installed. No version info available.
> langchain-community;: Installed. No version info available.
> langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43: Installed. No version info available.
> langchain-core<1.0.0,>=0.3.45: Installed. No version info available.
> langchain-core<1.0.0,>=0.3.47: Installed. No version info available.
> langchain-core<1.0.0,>=0.3.49: Installed. No version info available.
> langchain-deepseek;: Installed. No version info available.
> langchain-fireworks;: Installed. No version info available.
> langchain-google-genai;: Installed. No version info available.
> langchain-google-vertexai;: Installed. No version info available.
> langchain-groq;: Installed. No version info available.
> langchain-huggingface;: Installed. No version info available.
> langchain-mistralai: Installed. No version info available.
> langchain-mistralai;: Installed. No version info available.
> langchain-ollama;: Installed. No version info available.
> langchain-openai;: Installed. No version info available.
> langchain-text-splitters<1.0.0,>=0.3.7: Installed. No version info available.
> langchain-together;: Installed. No version info available.
> langchain-xai;: Installed. No version info available.
> langchain<1.0.0,>=0.3.21: Installed. No version info available.
> langserve[all]>=0.0.51: Installed. No version info available.
> langsmith-pyo3: Installed. No version info available.
> langsmith<0.4,>=0.1.125: Installed. No version info available.
> langsmith<0.4,>=0.1.17: Installed. No version info available.
> neo4j: 5.28.1
> neo4j-graphrag: 1.6.1
> numpy<2.0.0,>=1.22.4;: Installed. No version info available.
> numpy<2.0.0,>=1.26.2;: Installed. No version info available.
> numpy<3,>=1.26.2: Installed. No version info available.
> ollama<1,>=0.4.4: Installed. No version info available.
> openai-agents: Installed. No version info available.
> openai<2.0.0,>=1.68.2: Installed. No version info available.
> opentelemetry-api: 1.31.1
> opentelemetry-exporter-otlp-proto-http: Installed. No version info available.
> opentelemetry-sdk: 1.31.1
> orjson: 3.10.16
> packaging: 24.2
> packaging<25,>=23.2: Installed. No version info available.
> pydantic: 2.9.2
> pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
> pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
> pydantic<3.0.0,>=2.7.4: Installed. No version info available.
> pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
> pytest: 8.3.5
> PyYAML>=5.3: Installed. No version info available.
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> requests<3,>=2: Installed. No version info available.
> rich: 14.0.0
> SQLAlchemy<3,>=1.4: Installed. No version info available.
> sse-starlette: 1.8.2
> tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
> tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
> tiktoken<1,>=0.7: Installed. No version info available.
> tomlkit>=0.12: Installed. No version info available.
> typer[all]<1.0.0,>=0.9.0: Installed. No version info available.
> typing-extensions>=4.7: Installed. No version info available.
> uvicorn<1.0,>=0.23: Installed. No version info available.
> validators: 0.34.0
> zstandard: 0.23.0
Agent Context { "tasks": [ { "id": "a9590957-b903-4948-94cd-1700bac8a6f2", "taskIndex": 0, "request": "[original issue]\n**`langchain_chroma.Chroma` used with `chromadb.AsyncHttpClient`?**\n### Checked other resources\n\n- [x] I added a very descriptive title to this issue.\n- [x] I used the GitHub search to find a similar question and didn't find it.\n- [x] I am sure that this is a bug in LangChain rather than my code.\n- [x] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).\n- [x] I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.\n\n### Example Code\n\n```\nself._client = chromadb.AsyncHttpClient(host=config.CHROMA_URI, port=80, headers={\"X-Chroma-Token\": config.CHROMA_TOKEN}, tenant=self._tenant, database=self._database)\nself._vector_store = Chroma(client = self._client, collection_name = self._collection, embedding_function = self._embeddings) \n```\n\n### Error Message and Stack Trace (if applicable)\n\n```\n self._vector_store = Chroma(client = self._client, collection_name = self._collection, embedding_function = self._embeddings) \n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.12/site-packages/langchain_chroma/vectorstores.py\", line 342, in __init__\n self.__ensure_collection()\n File \"/home/khteh/.local/share/virtualenvs/rag-agent-YeW3dxEa/lib/python3.12/site-packages/langchain_chroma/vectorstores.py\", line 349, in __ensure_collection\n self._chroma_collection = self._client.get_or_create_collection(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'coroutine' object has no attribute 'get_or_create_collection'\n```\n\n### Description\n\nI wan to use `langchain_chroma.Chroma` with `chromadb.AsyncHttpClient`\n\n### System Info\n\n```\nSystem Information\n------------------\n> OS: Linux\n> OS Version: #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 19 16:50:40 UTC 2025\n> Python Version: 3.12.7 (main, Feb 4 2025, 14:46:03) [GCC 14.2.0]\n\nPackage Information\n-------------------\n> langchain_core: 0.3.49\n> langchain: 0.3.22\n> langchain_community: 0.3.20\n> langsmith: 0.3.21\n> langchain_chroma: 0.2.2\n> langchain_cli: 0.0.36\n> langchain_google_genai: 2.1.2\n> langchain_google_vertexai: 2.0.18\n> langchain_neo4j: 0.4.0\n> langchain_ollama: 0.3.0\n> langchain_openai: 0.3.11\n> langchain_text_splitters: 0.3.7\n> langgraph_sdk: 0.1.60\n> langserve: 0.3.1\n\nOther Dependencies\n------------------\n> aiohttp<4.0.0,>=3.8.3: Installed. No version info available.\n> anthropic[vertexai]: Installed. No version info available.\n> async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.\n> chromadb!=0.5.10,!=0.5.11,!=0.5.12,!=0.5.4,!=0.5.5,!=0.5.7,!=0.5.9,<0.7.0,>=0.4.0: Installed. No version info available.\n> dataclasses-json<0.7,>=0.5.7: Installed. No version info available.\n> fastapi: 0.115.12\n> filetype: 1.2.0\n> gitpython<4,>=3: Installed. No version info available.\n> google-ai-generativelanguage: 0.6.17\n> google-cloud-aiplatform: 1.87.0\n> google-cloud-storage: 2.19.0\n> gritql<1.0.0,>=0.2.0: Installed. No version info available.\n> httpx: 0.27.2\n> httpx-sse: 0.4.0\n> httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.\n> jsonpatch<2.0,>=1.33: Installed. No version info available.\n> langchain-anthropic;: Installed. No version info available.\n> langchain-aws;: Installed. No version info available.\n> langchain-azure-ai;: Installed. No version info available.\n> langchain-cohere;: Installed. No version info available.\n> langchain-community;: Installed. No version info available.\n> langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43: Installed. No version info available.\n> langchain-core<1.0.0,>=0.3.45: Installed. No version info available.\n> langchain-core<1.0.0,>=0.3.47: Installed. No version info available.\n> langchain-core<1.0.0,>=0.3.49: Installed. No version info available.\n> langchain-deepseek;: Installed. No version info available.\n> langchain-fireworks;: Installed. No version info available.\n> langchain-google-genai;: Installed. No version info available.\n> langchain-google-vertexai;: Installed. No version info available.\n> langchain-groq;: Installed. No version info available.\n> langchain-huggingface;: Installed. No version info available.\n> langchain-mistralai: Installed. No version info available.\n> langchain-mistralai;: Installed. No version info available.\n> langchain-ollama;: Installed. No version info available.\n> langchain-openai;: Installed. No version info available.\n> langchain-text-splitters<1.0.0,>=0.3.7: Installed. No version info available.\n> langchain-together;: Installed. No version info available.\n> langchain-xai;: Installed. No version info available.\n> langchain<1.0.0,>=0.3.21: Installed. No version info available.\n> langserve[all]>=0.0.51: Installed. No version info available.\n> langsmith-pyo3: Installed. No version info available.\n> langsmith<0.4,>=0.1.125: Installed. No version info available.\n> langsmith<0.4,>=0.1.17: Installed. No version info available.\n> neo4j: 5.28.1\n> neo4j-graphrag: 1.6.1\n> numpy<2.0.0,>=1.22.4;: Installed. No version info available.\n> numpy<2.0.0,>=1.26.2;: Installed. No version info available.\n> numpy<3,>=1.26.2: Installed. No version info available.\n> ollama<1,>=0.4.4: Installed. No version info available.\n> openai-agents: Installed. No version info available.\n> openai<2.0.0,>=1.68.2: Installed. No version info available.\n> opentelemetry-api: 1.31.1\n> opentelemetry-exporter-otlp-proto-http: Installed. No version info available.\n> opentelemetry-sdk: 1.31.1\n> orjson: 3.10.16\n> packaging: 24.2\n> packaging<25,>=23.2: Installed. No version info available.\n> pydantic: 2.9.2\n> pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.\n> pydantic<3.0.0,>=2.5.2;: Installed. No version info available.\n> pydantic<3.0.0,>=2.7.4: Installed. No version info available.\n> pydantic<3.0.0,>=2.7.4;: Installed. No version info available.\n> pytest: 8.3.5\n> PyYAML>=5.3: Installed. No version info available.\n> requests: 2.32.3\n> requests-toolbelt: 1.0.0\n> requests<3,>=2: Installed. No version info available.\n> rich: 14.0.0\n> SQLAlchemy<3,>=1.4: Installed. No version info available.\n> sse-starlette: 1.8.2\n> tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.\n> tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.\n> tiktoken<1,>=0.7: Installed. No version info available.\n> tomlkit>=0.12: Installed. No version info available.\n> typer[all]<1.0.0,>=0.9.0: Installed. No version info available.\n> typing-extensions>=4.7: Installed. No version info available.\n> uvicorn<1.0,>=0.23: Installed. No version info available.\n> validators: 0.34.0\n> zstandard: 0.23.0\n```", "title": "Add async client support to langchain_chroma.Chroma vector store to enable usage with chromadb.AsyncHttpClient", "createdAt": 1757461966710, "completed": true, "planRevisions": [ { "revisionIndex": 0, "plans": [ { "index": 0, "plan": "**Modify the Chroma class in `/home/daytona/langchain/libs/partners/chroma/langchain_chroma/vectorstores.py` to support async clients:** Add an optional `async_client` parameter to the `__init__` method (similar to Qdrant's pattern), update type hints to accept both `chromadb.ClientAPI` and `chromadb.AsyncClientAPI`, modify `__ensure_collection()` to skip initialization when async_client is provided (since async operations can't be called in `__init__`), and add a new private `_async_initialized` flag to track async collection initialization state", "completed": true, "summary": "Successfully modified the Chroma class to support async clients by:\n\n1. **Added async client support to `__init__` method**:\n - Added `async_client: Optional[AsyncClientAPI] = None` parameter\n - Updated docstring to document the new parameter\n\n2. **Updated type hints**:\n - Imported `AsyncClientAPI` and `ClientAPI` from `chromadb.api` in TYPE_CHECKING block\n - Replaced all `chromadb.ClientAPI` references with `ClientAPI` type hint\n\n3. **Implemented async initialization tracking**:\n - Added `self._async_client` to store the async client\n - Added `self._async_initialized = False` flag to track async collection initialization state\n\n4. **Modified collection initialization logic**:\n - Updated logic to handle cases where only async_client is provided (sets `self._client = None`)\n - Modified collection initialization to skip sync initialization when only async_client is provided\n - Maintained backward compatibility for sync-only usage\n\n5. **Enhanced error handling**:\n - Updated `__ensure_collection()` to raise a clear ValueError when called with only an async client\n - Error message guides users to use async methods or provide a sync client\n\nThe implementation follows the established pattern from Qdrant's vector store integration and maintains full backward compatibility with existing synchronous usage while enabling async client support for the next implementation phases." }, { "index": 1, "plan": "**Implement async collection initialization and management methods in the Chroma class:** Create `_aensure_collection()` async method to handle async collection creation/retrieval, implement `_aget_collection()` async property method that ensures collection is initialized before returning it, add proper error handling for when async_client is used but collection isn't initialized", "completed": true, "summary": "Successfully implemented async collection initialization and management methods in the Chroma class:\n\n1. **Created `_aensure_collection()` async method**:\n - Handles async collection creation/retrieval using `await self._async_client.get_or_create_collection()`\n - Sets `self._async_initialized = True` after successful initialization\n - Includes proper error handling when async_client is not available\n\n2. **Implemented `_aget_collection()` async method**:\n - Ensures collection is initialized before returning it (calls `_aensure_collection()` if needed)\n - Returns the async collection stored in `self._async_chroma_collection`\n - Includes comprehensive error handling for missing async_client and uninitialized collection\n\n3. **Added proper error handling**:\n - Clear error messages when async_client is not provided\n - Validation to ensure collection is initialized before access\n - Consistent error handling pattern across all async methods\n\n4. **Bonus implementations**:\n - Added `adelete_collection()` async method for deleting collections asynchronously\n - Added `areset_collection()` async method for resetting collections asynchronously\n - Both methods include proper error handling and state management\n\nThe implementation ensures that async collection operations are properly managed with lazy initialization, appropriate error handling, and state tracking through the `_async_initialized` flag." }, { "index": 2, "plan": "**Implement core async methods for the Chroma class:** Add `aadd_texts()` method that uses async_client for adding documents, implement `asimilarity_search()` and `asimilarity_search_with_score()` methods using async_client, add `adelete()` method for async deletion operations, implement `aadd_documents()` method that calls `aadd_texts()`, ensure all async methods check for async_client availability and raise appropriate errors if not present", "completed": true, "summary": "Successfully implemented all core async methods for the Chroma class:\n\n1. **Implemented `aadd_texts()` method**:\n - Async version of `add_texts()` that uses `async_client` for adding documents\n - Handles embeddings asynchronously using `await self._embedding_function.aembed_documents()`\n - Properly manages metadata and empty metadata cases\n - Includes error handling for missing async_client\n\n2. **Implemented `asimilarity_search()` method**:\n - Async version of `similarity_search()` \n - Delegates to `asimilarity_search_with_score()` and extracts documents\n - Supports filtering by metadata\n\n3. **Implemented `asimilarity_search_with_score()` method**:\n - Async version of `similarity_search_with_score()`\n - Handles both cases: with and without embedding function\n - Uses `await self._embedding_function.aembed_query()` for async embedding\n - Returns documents with similarity scores\n\n4. **Implemented `adelete()` method**:\n - Async version of `delete()` for removing documents by IDs\n - Validates async_client availability\n - Uses async collection for deletion\n\n5. **Implemented `aadd_documents()` method**:\n - Async wrapper that extracts texts and metadata from Document objects\n - Delegates to `aadd_texts()` for actual insertion\n\n6. **Added helper method `__aquery_collection()`**:\n - Async version of `__query_collection()`\n - Handles async collection queries with proper await syntax\n\nAll async methods include:\n- Proper error handling when `async_client` is not available\n- Consistent error messages guiding users to provide an async_client\n- Full compatibility with existing sync methods\n- Type hints and Google-style docstrings\n\nThe implementation follows LangChain's async patterns and maintains backward compatibility with existing synchronous usage." }, { "index": 3, "plan": "**Create comprehensive unit tests in `/home/daytona/langchain/libs/partners/chroma/tests/unit_tests/` directory:** Write test cases for async client initialization, test async collection creation and retrieval, verify async add/search/delete operations work correctly, test error handling when mixing sync and async operations, ensure backward compatibility with existing synchronous usage", "completed": true, "summary": "Successfully created comprehensive unit tests for async functionality in the Chroma vector store:\n\n**Created `/home/daytona/langchain/libs/partners/chroma/tests/unit_tests/test_async_vectorstores.py`** with:\n\n1. **Mock implementations for testing**:\n - `AsyncFakeEmbeddings`: Extended FakeEmbeddings with async methods\n - `MockAsyncCollection`: Mock async collection with upsert, query, and delete methods\n - `MockAsyncClient`: Mock async client with collection management\n\n2. **Async client initialization tests**:\n - `test_async_client_initialization()`: Verifies Chroma can be initialized with async client only\n - `test_async_collection_initialization()`: Tests lazy collection initialization on first async operation\n\n3. **Core async operation tests**:\n - `test_aadd_texts()`: Tests async text addition with metadata\n - `test_aadd_documents()`: Tests async document addition\n - `test_asimilarity_search()`: Tests async similarity search\n - `test_asimilarity_search_with_score()`: Tests async search with scores\n - `test_adelete()`: Tests async deletion by IDs\n\n4. **Collection management tests**:\n - `test_adelete_collection()`: Tests async collection deletion\n - `test_areset_collection()`: Tests async collection reset\n\n5. **Error handling tests**:\n - `test_error_without_async_client()`: Validates all async methods raise errors without async_client\n - `test_sync_methods_error_with_only_async_client()`: Tests sync methods fail with only async_client\n\n6. **Compatibility tests**:\n - `test_both_sync_and_async_clients()`: Verifies both sync and async clients can coexist\n\n7. **Advanced functionality tests**:\n - `test_async_with_metadata_filtering()`: Tests metadata filtering in async operations\n - `test_async_empty_metadata_handling()`: Tests handling of empty metadata\n - `test_concurrent_async_operations()`: Tests concurrent async operations with asyncio.gather()\n\nAll tests use pytest's asyncio support with `@pytest.mark.asyncio` decorator and follow the project's testing patterns. The tests ensure complete coverage of async functionality while maintaining backward compatibility." }, { "index": 4, "plan": "**Create integration tests in `/home/daytona/langchain/libs/partners/chroma/tests/integration_tests/test_vectorstores.py`:** Add test cases that use actual AsyncHttpClient with a running Chroma server, test end-to-end async workflows including document addition and similarity search, verify that both sync and async clients can coexist in the same application, test error scenarios like network failures and invalid configurations", "completed": true, "summary": "Successfully created comprehensive integration tests for async functionality in `/home/daytona/langchain/libs/partners/chroma/tests/integration_tests/test_vectorstores.py`:\n\n**Added 8 new async integration tests**:\n\n1. **`test_chroma_async_http_client()`**:\n - Tests with actual AsyncHttpClient connecting to localhost:8000\n - Includes server connectivity check with proper skip conditions\n - Tests async add_texts, similarity_search, and similarity_search_with_score\n - Tests async delete operations\n - Proper cleanup with adelete_collection()\n\n2. **`test_chroma_async_add_documents()`**:\n - Tests async document addition workflow\n - Verifies documents are properly added with metadata\n - Tests search functionality after async document addition\n\n3. **`test_chroma_both_sync_and_async_clients()`**:\n - Verifies both sync and async clients can coexist\n - Tests sync operations (add_texts, similarity_search)\n - Tests async operations (aadd_texts, asimilarity_search)\n - Demonstrates mixed usage in the same application\n\n4. **`test_chroma_async_error_handling()`**:\n - Tests error scenarios when async_client is not provided\n - Verifies proper ValueError exceptions are raised\n - Tests all async methods for proper error handling\n\n5. **`test_chroma_async_collection_operations()`**:\n - Tests async collection management (areset_collection, adelete_collection)\n - Verifies collection reset functionality\n - Tests with AsyncHttpClient when available\n\n6. **`test_chroma_async_with_metadata_filter()`**:\n - Tests async search with metadata filtering\n - Verifies filter functionality works correctly in async operations\n\n7. **Enhanced existing tests**:\n - `test_chroma_async()` - Basic async similarity search\n - `test_chroma_async_with_ids()` - Async search with custom IDs\n\nAll tests include:\n- Proper pytest skip conditions for missing dependencies or server\n- Comprehensive error handling and cleanup\n- UUID-based collection names to avoid conflicts\n- Follows existing test patterns and conventions" }, { "index": 5, "plan": "**Run linting and formatting to ensure code quality:** Execute `make lint` to check for code style issues, run `make format` to auto-format the code according to project standards, ensure all new code follows Google-style docstrings and includes proper type hints", "completed": true, "summary": "Successfully completed linting and formatting to ensure code quality:\n\n**Executed `make lint` and `make format` commands**:\n- ✅ All ruff checks passed with no style issues\n- ✅ All files properly formatted (13 files)\n- ✅ All mypy type checks passed with no issues\n\n**Fixed issues during linting process**:\n\n1. **Line length violations** (E501):\n - Split long comments across multiple lines\n - Reformatted long error messages to stay within 88 character limit\n - Fixed in vectorstores.py at lines 423, 442, 794, 1063\n\n2. **Import optimizations**:\n - Added `from __future__ import annotations` to test file\n - Removed unused `chromadb` import in integration tests\n - Simplified Optional type hints with future annotations\n\n3. **Type annotations**:\n - Added missing `-> None` return type annotations to 15+ test functions\n - Fixed `__init__` method missing return type in MockAsyncClient class\n\n4. **Type checking fixes**:\n - Added `# type: ignore[assignment]` for intentional None assignments\n - Added `# type: ignore[arg-type]` for mock objects in tests\n - Fixed incompatible type assignments in vectorstores.py\n\n5. **Code formatting**:\n - Removed trailing blank lines from multiple files\n - Fixed indentation and spacing issues\n - Ensured consistent formatting across all files\n\n6. **Test improvements**:\n - Fixed B018 \"useless expression\" by assigning to underscore variable\n - Improved test code readability with proper type hints\n\nThe code now fully complies with:\n- Project's ruff configuration for style and formatting\n- Mypy strict type checking requirements\n- Google-style docstring standards\n- LangChain's coding guidelines\n\nAll new async functionality code is properly formatted, typed, and documented according to project standards." } ], "createdAt": 1757461966710, "createdBy": "agent" } ], "activeRevisionIndex": 0, "pullRequestNumber": 32874, "completedAt": 1757464154151, "summary": "I've successfully added async client support to the Chroma vector store, enabling seamless integration with chromadb.AsyncHttpClient. The implementation includes full async method support, comprehensive testing, and maintains backward compatibility with existing synchronous usage. All code follows LangChain's quality standards, with proper type hints, error handling, and docstrings." } ], "activeTaskIndex": 0 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    chroma`langchain-chroma` package issues & PRsexternalhelp wantedOpen to community contribution.investigateFlagged for investigation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions