mayooear / gpt4-pdf-chatbot-langchain

GPT4 & LangChain Chatbot for large PDF docs
https://www.youtube.com/watch?v=ih9PBGVVOO4
14.73k stars 3k forks source link

Error while ingesting documents -- Cannot find package '@pinecone-database/pinecone' #430

Closed mferri10 closed 7 months ago

mferri10 commented 7 months ago

Hi! Getting the error below while trying to ingest documents for the first time. Could not find any other issue dealing with this.

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@pinecone-database/pinecone' imported from C:\Users\marco\gpt4-pdf-chatbot-langchain\utils\pinecone-client.ts

I am running the latest node version.

dosubot[bot] commented 7 months ago

🤖

Hello @mferri10,

I'm Dosu, a friendly bot here to help out with issues, answer queries, or assist you in becoming a contributor to the gpt4-pdf-chatbot-langchain repository. While we wait for a human maintainer, I'm here to provide you with some initial support.

I'm currently reviewing your issue and will provide a more detailed response soon.

mferri10 commented 7 months ago

Solved.

dosubot[bot] commented 7 months ago

🤖

I'm glad to hear that you were able to resolve the issue. For future reference and for the benefit of others who might encounter the same problem, the error message "Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@pinecone-database/pinecone' imported from C:\Users\marco\gpt4-pdf-chatbot-langchain\utils\pinecone-client.ts" indicates that the '@pinecone-database/pinecone' package was not installed in your project.

This package is crucial for the gpt4-pdf-chatbot-langchain project as it is used to interact with the Pinecone database. It provides a client, PineconeClient, which is used to initialize and interact with the Pinecone database. The initPinecone function initializes the PineconeClient with the environment and API key, which are fetched from the environment variables PINECONE_ENVIRONMENT and PINECONE_API_KEY respectively. If these environment variables are not set, an error is thrown.

Here is the supporting code:

import { PineconeClient } from '@pinecone-database/pinecone';

async function initPinecone() {
  try {
    const pinecone = new PineconeClient();

    await pinecone.init({
      environment: process.env.PINECONE_ENVIRONMENT ?? '', //this is in the dashboard
      apiKey: process.env.PINECONE_API_KEY ?? '',
    });

    return pinecone;
  } catch (error) {
    console.log('error', error);
    throw new Error('Failed to initialize Pinecone Client');
  }
}

export const pinecone = await initPinecone();

You can find this code in the utils/pinecone-client.ts file in the repository.

If you encounter any other issues or have further questions, feel free to ask.

Sources


This response is meant to be useful and save you time. 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.

If you want to continue the conversation, start your reply with @dosu-bot.