0

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.

1 Answers1

0

An error with status code 429 means that you have surpassed your request limit for that API. I guess new Pinecone credentials haven't worked for you because your account from where you are signed in for that APi is the same. You should change an account to a new one and make credentials or upgrade your old account to be able to send more requests.

Lilly
  • 90
  • 8
  • You can also check your email notifications, I think there will be a letter from your API provider about exceeded limit of calls to API. – Lilly Jul 31 '23 at 14:05