Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community[patch]: Instantiate Chroma client properly #4918

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

Doug-Bowen
Copy link
Contributor

@Doug-Bowen Doug-Bowen commented Mar 28, 2024

Fixes: Properly instantiate Chroma client based on chromadb v1.8.1.

Context:

  • In LangChainAI, it is possible to pass in a ChromaClient when working with chromadb.
  • In LangChainJS, this is not listed in our documentation.
  • Once I instantiated the client and passed it in, it worked.
  • This change corrects the issues that LangChainJS has when instantiating a ChromaClient

Mainly, Chroma would throw when executing getOrCreateCollection()

throw new Error(`Chroma getOrCreateCollection error: ${err}`);

This was my workaround:

        const chromaClient = new (await Chroma.imports()).ChromaClient;
        const vectorStore = new Chroma(embeddings, { 
            collectionName: "code_base",
            url: process.env.VECTOR_STORE_URL,
            index: chromaClient
        });

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 28, 2024
Copy link

vercel bot commented Mar 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs 🛑 Canceled (Inspect) Apr 3, 2024 5:33am
langchainjs-docs 🛑 Canceled (Inspect) Apr 3, 2024 5:33am

@jeffchuber
Copy link
Contributor

@Doug-Bowen thank you! I will take a look deeper this afternoon <3

@jacoblee93
Copy link
Collaborator

Thank you!

@jacoblee93 jacoblee93 added the lgtm PRs that are ready to be merged as-is label Apr 3, 2024
@vercel vercel bot temporarily deployed to Preview – langchainjs-api-refs April 3, 2024 05:32 Inactive
@vercel vercel bot temporarily deployed to Preview – langchainjs-docs April 3, 2024 05:33 Inactive
@jacoblee93 jacoblee93 changed the title Instantiate Chroma client properly community[patch]: Instantiate Chroma client properly Apr 3, 2024
@jacoblee93 jacoblee93 merged commit e5f84f3 into langchain-ai:main Apr 3, 2024
14 of 16 checks passed
@jeffchuber
Copy link
Contributor

@Doug-Bowen thank you Doug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature lgtm PRs that are ready to be merged as-is size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants