-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Error: Chroma getOrCreateCollection error: Error: TypeError: fetch failed #1797
Comments
Answer generated by a 🤖 AnswerThe error message "Chroma getOrCreateCollection error: Error: TypeError: fetch failed" indicates that the fetch operation in the The Here is the relevant code from the context: async ensureCollection(): Promise<Collection> {
if (!this.collection) {
if (!this.index) {
const { ChromaClient } = await Chroma.imports();
this.index = new ChromaClient({ path: this.url });
}
try {
this.collection = await this.index.getOrCreateCollection({
name: this.collectionName,
});
} catch (err) {
throw new Error(`Chroma getOrCreateCollection error: ${err}`);
}
}
return this.collection;
} To resolve this issue, you should check the following:
Sources
This response is meant to be useful, save you time, and share context. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. |
Hey @axelphunter Did you solved this? |
Hi, @axelphunter, I'm helping the langchainjs team manage their backlog and am marking this issue as stale. From what I understand, the issue you raised pertains to an error in the Chroma library when attempting to fetch a collection using the OpenAIEmbeddings and Chroma classes to create a vector store from documents. There was a detailed response from devstein suggesting potential reasons for the error and steps to resolve it, including checking the Chroma service's status, verifying the URL, and ensuring the existence of the collection. Could you please confirm if this issue is still relevant to the latest version of the langchainjs repository? If it is, please let the langchainjs team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you! |
Example code is as follows:
"langchain": "0.0.98",
`const loader = new PDFLoader("documents/328252184529235457.pdf");
const rawDocs = await loader.load();
const textSplitter = new RecursiveCharacterTextSplitter({
chunkSize: 1000,
chunkOverlap: 200,
});
const docs = await textSplitter.splitDocuments(rawDocs);
// console.log("split docs", docs);
console.log("creating vector store...");
const embeddings = new OpenAIEmbeddings();
const COLLECTION_NAME = "12312424112e12e1e";
let chroma = new Chroma(embeddings, { collectionName: COLLECTION_NAME });
await chroma.index?.reset();
const vectorStore = await Chroma.fromDocuments(docs, new OpenAIEmbeddings(), {
collectionName: chroma.collectionName,
});`
node_modules/langchain/dist/vectorstores/chroma.cjs:96
throw new Error(
Chroma getOrCreateCollection error: ${err}
);^
Error: Chroma getOrCreateCollection error: Error: TypeError: fetch failed
at Chroma.ensureCollection (/Users/axelhunter/Development/WeDoAi/server/node_modules/langchain/dist/vectorstores/chroma.cjs:96:23)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Chroma.addVectors (/Users/axelhunter/Development/WeDoAi/server/node_modules/langchain/dist/vectorstores/chroma.cjs:114:28)
at async Chroma.addDocuments (/Users/axelhunter/Development/WeDoAi/server/node_modules/langchain/dist/vectorstores/chroma.cjs:82:9)
at async Function.fromDocuments (/Users/axelhunter/Development/WeDoAi/server/node_modules/langchain/dist/vectorstores/chroma.cjs:171:9)
at async run (/Users/axelhunter/Development/WeDoAi/server/src/app.ts:35:23)
The text was updated successfully, but these errors were encountered: