PineconeArgumentError: The argument to upsert had type errors: argument must be array.
Labels: name: area: embeddings, name: area: vector store, name: auto:bug, name: area: models, name: integration: pinecone

### System Info

Hello everyone,

I am encountering an issue while trying to use Pinecone store  in my Node.js environment. 

When i try to store the vector in an existing index, I am receiving the following error:

PineconeArgumentError: The argument to upsert had type errors: argument must be array.

here is my code :

  async function training(bot, documents) {
    if (!bot || !bot.name) {
      throw new Error('Invalid bot or bot name is missing.');
    }
    if (!documents || !Array.isArray(documents) || documents.length === 0) {
      throw new Error('Invalid documents array.');
    }
  
    try {
      const botName = bot.name;
   
      console.log('Bot Name:', botName);
  
      const keys = documents.map(url => path.basename(url));
      console.log('Document keys:', keys);
  
      const rawDocs = await chargerDocumentsDeS3(keys);
      console.log('Raw documents retrieved:', rawDocs.length);
  
      /* Split text into chunks */
      const textSplitter = new RecursiveCharacterTextSplitter({
        chunkSize: 1000,
        chunkOverlap: 200,
      });
      let docs = await textSplitter.splitDocuments(rawDocs);
      console.log('Number of split documents:', docs.length);
      //console.log(docs)
      const index = pinecone.Index( botName);
      await PineconeStore.fromDocuments(docs, new OpenAIEmbeddings(), {
        pineconeIndex:index,
        maxConcurrency: 5, // Maximum number of batch requests to allow at once. Each batch is 1000 vectors.
      });
  
      console.log('Upload and processing complete.');
      return { message: 'Upload and processing complete.' };
    } catch (error) {
      console.error('Error during upload and processing:', error);
      throw new Error('Something went wrong during upload and processing.');
    }
  }



### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [X] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

  async function training(bot, documents) {
    if (!bot || !bot.name) {
      throw new Error('Invalid bot or bot name is missing.');
    }
    if (!documents || !Array.isArray(documents) || documents.length === 0) {
      throw new Error('Invalid documents array.');
    }
  
    try {
      const botName = bot.name;
   
      console.log('Bot Name:', botName);
  
      const keys = documents.map(url => path.basename(url));
      console.log('Document keys:', keys);
  
      const rawDocs = await chargerDocumentsDeS3(keys);
      console.log('Raw documents retrieved:', rawDocs.length);
  
      /* Split text into chunks */
      const textSplitter = new RecursiveCharacterTextSplitter({
        chunkSize: 1000,
        chunkOverlap: 200,
      });
      let docs = await textSplitter.splitDocuments(rawDocs);
      console.log('Number of split documents:', docs.length);
      //console.log(docs)
      const index = pinecone.Index( botName);
      await PineconeStore.fromDocuments(docs, new OpenAIEmbeddings(), {
        pineconeIndex:index,
        maxConcurrency: 5, // Maximum number of batch requests to allow at once. Each batch is 1000 vectors.
      });
  
      console.log('Upload and processing complete.');
      return { message: 'Upload and processing complete.' };
    } catch (error) {
      console.error('Error during upload and processing:', error);
      throw new Error('Something went wrong during upload and processing.');
    }
  }

### Expected behavior

I want a solution