Create a vectorstore out of all namespaces

Hello Pinecone Community!

Currently, I am ingesting one namespace per document for a software I’m developing using Next.js. This approach allows me to identify documents via their namespace.

However, I am exploring the use case for creating a vector store that encompasses all namespaces within an index. Here’s the configuration I’ve attempted:

Typescript

const index = pinecone.Index(PINECONE_INDEX_NAME);

const vectorStoreConfig = {
  pineconeIndex: index,
  textKey: 'text',
  namespace?: string,
} = {
  pineconeIndex: index,
  textKey: 'text',
};

if (namespace === 'knowledgebase') {
  // Set the namespace property to undefined to use all namespaces
  console.log('Configuring to use all namespaces for knowledgebase');
  vectorStoreConfig.namespace = undefined;
} else {
  vectorStoreConfig.namespace = namespace;
}

// create Vectorstore
    const vectorStore = await PineconeStore.fromExistingIndex(
      new OpenAIEmbeddings({}),
      vectorStoreConfig,
    );

However, I quickly realized that setting the namespace in the vectorStoreConfig to ‘undefined’ does not actually create a vector store from all the vectors!

As a fallback solution, I am considering combining all documents into one bulk and creating a vector store from that, assigning it a dedicated namespace. However, this method seems very inefficient.

Best regards, CL

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.