langchain-ai/langchain

`langchain_chroma.Chroma` used with `chromadb.AsyncHttpClient`?

Chiusa

#30.704 aperta il 7 apr 2025

 (9 commenti) (2 reazioni) (0 assegnatari)Python (22.617 fork)batch import
chromaexternalhelp wantedinvestigate

Metriche repository

Star
 (136.758 stelle)
Metriche merge PR
 (Merge medio 10g 2h) (288 PR mergiate in 30 g)

Descrizione

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

Guida contributor