Replies: 1 comment 1 reply
-
🤖 Hey there, @haihaowu! Great to see you back. Hope you're ready to tackle another puzzle together. 🛠😊 Thank you for providing the detailed information. The error message you're seeing is indicating that In your code, you're passing await PineconeStore.fromDocuments(doc, embeddings, {
pcIndex,
}); However, according to the LangChainJS codebase, the Here's how you should structure your call to await PineconeStore.fromDocuments(doc, embeddings, {
pineconeIndex: pcIndex,
}); By making this change, you're correctly passing the Please give this a try and let me know if it resolves your issue. If you're still encountering problems, don't hesitate to provide more details so I can further assist you. Sources
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I got an error when trying to use Pinecone and GPT to create embeddings. The error message pointed to @langchain/pinecone/dist/vectorstores.cjs:149:
const namespace = this.pineconeIndex.namespace(""); ^ TypeError: Cannot read properties of undefined (reading 'namespace')
in vectorstores.cjs., both vectors and documents are valid objects right before the statement
const namespace = this.pineconeIndex.namespace(optionsNamespace ?? "");
Here is the express.js code:
`
const { Pinecone } = require('@pinecone-database/pinecone');
const { PineconeStore } = require('@langchain/pinecone');
const { OpenAIEmbeddings } = require('@langchain/openai');
const pc = new Pinecone({
apiKey: process.env.PINECONE_API_KEY,
});
const pcIndex = pc.Index(process.env.PINECONE_INDEX_NAME);
const embeddings = new OpenAIEmbeddings({
openAIApiKey: process.env.OPENAI_API_KEY,
modelName: 'text-embedding-ada-002',
});
const namespace = pcIndex.namespace('');
console.log('Namespace: ', namespace);
await PineconeStore.fromDocuments(doc, embeddings, {
pcIndex,
});`
Note that the const namespace = pcIndex.namespace(''); in this was executed properly. Appreciate any help to resolve this issue.
langchain: 0.1.18
pinecone: 2.0.1
@langchain/pinecone: 0.0.3
Beta Was this translation helpful? Give feedback.
All reactions