While consuming the pinecone with following code -
static async consumeToPinecone(namespace: string, text: string, opts?: {
chunkSize?: number;
chunkOverlap?: number;
openAIApiKey?: string;
}) {
const { chunkSize = 1200, chunkOverlap = 20 } = opts || {};
const { RecursiveCharacterTextSplitter } = await import('langchain/text_splitter');
const { OpenAIEmbeddings } = await import('langchain/embeddings/openai');
const { PineconeStore } = await import('langchain/vectorstores/pinecone');
const pinecone = await this.initPinecone(
pineconeConfig.apiKey,
pineconeConfig.environment
);
const index = pinecone.Index(pineconeConfig.index);
try {
await index._delete({
deleteRequest: {
namespace,
deleteAll: true,
}
});
} catch (e) {
console.error(`Failed to delete namespace ${namespace}`, e);
}
console.info(`Deleting namespace 2 ${namespace}`);
const textSplitter = new RecursiveCharacterTextSplitter({
chunkSize,
chunkOverlap,
});
textKey: 'text',
}
);**
} const texts = await textSplitter.splitText(text);
const embeddings = new OpenAIEmbeddings({
openAIApiKey: opts?.openAIApiKey || openAI.apiKey,
});
//Following piece of code is cause of bug.-----------
** await PineconeStore.fromTexts(
texts,
{},
embeddings,
{
pineconeIndex: index,
namespace,
textKey: 'text',
}
);**
}
I got an error in bold part in function PineconeStore.fromTexts. [enter image description here](https://i.stack.imgur.com/gFd9Y.png)
I tried with creating new Pinecone credentials but it did not worked.