How to store embeddings of pdf content in Pinecone using langchain and google generative ai (gemini pro)

442 views Asked by At

I am using gemini pro model to create chat with pdf application. I am also using langchain and pinecone. Now the problem is GoogleGenerativeAIEmbeddings is not wordking with PineconeStore.fromDocuments .

const loader = new PDFLoader(blob)
const pageLevelDocs = await loader.load()
const pdfContent = pageLevelDocs.map((doc) => doc.pageContent).join(" ");
const pinecone = await getPineconeClient()
const pineconeIndex = pinecone.Index('docwhisperer')
const embeddings = new GoogleGenerativeAIEmbeddings({
      modelName: "embedding-001", // 768 dimensions
      taskType: TaskType.RETRIEVAL_DOCUMENT,
});
          
const res = await embeddings.embedQuery(pdfContent);
await PineconeStore.fromDocuments(
      pageLevelDocs,
      res,
      {
          pineconeIndex,
          namespace: createdFile.id,
      }
)

Please provide a possible fix for this. So, that I can store the embeddings in chromadb.

0

There are 0 answers