Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs[patch]: Update PineconeStore creation to include namespace parameter #6169

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docs/core_docs/docs/how_to/qa_per_user.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,19 @@
"\n",
"const pineconeIndex = pinecone.Index(Deno.env.get(\"PINECONE_INDEX\"));\n",
"\n",
"/**\n",
" * Pinecone allows you to partition the records in an index into namespaces. \n",
" * Queries and other operations are then limited to one namespace, \n",
" * so different requests can search different subsets of your index.\n",
" * Read more about namespaces here: https://docs.pinecone.io/guides/indexes/use-namespaces\n",
" * \n",
" * NOTE: If you have namespace enabled in your Pinecone index, you must provide the namespace when creating the PineconeStore.\n",
" */\n",
"const namespace = \"pinecone\";\n",
"\n",
"const vectorStore = await PineconeStore.fromExistingIndex(\n",
" new OpenAIEmbeddings(),\n",
" { pineconeIndex },\n",
" { pineconeIndex, namespace },\n",
");\n",
"\n",
"await vectorStore.addDocuments(\n",
Expand Down
12 changes: 11 additions & 1 deletion examples/src/indexes/vector_stores/pinecone/mmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@ const pinecone = new Pinecone();

const pineconeIndex = pinecone.Index(process.env.PINECONE_INDEX!);

/**
* Pinecone allows you to partition the records in an index into namespaces.
* Queries and other operations are then limited to one namespace,
* so different requests can search different subsets of your index.
* Read more about namespaces here: https://docs.pinecone.io/guides/indexes/use-namespaces
*
* NOTE: If you have namespace enabled in your Pinecone index, you must provide the namespace when creating the PineconeStore.
*/
const namespace = "pinecone";

const vectorStore = await PineconeStore.fromExistingIndex(
new OpenAIEmbeddings(),
{ pineconeIndex }
{ pineconeIndex, namespace }
);

/* Search the vector DB independently with meta filters */
Expand Down
12 changes: 11 additions & 1 deletion examples/src/indexes/vector_stores/pinecone/query_docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@ const pinecone = new Pinecone();

const pineconeIndex = pinecone.Index(process.env.PINECONE_INDEX!);

/**
* Pinecone allows you to partition the records in an index into namespaces.
* Queries and other operations are then limited to one namespace,
* so different requests can search different subsets of your index.
* Read more about namespaces here: https://docs.pinecone.io/guides/indexes/use-namespaces
*
* NOTE: If you have namespace enabled in your Pinecone index, you must provide the namespace when creating the PineconeStore.
*/
const namespace = "pinecone";

const vectorStore = await PineconeStore.fromExistingIndex(
new OpenAIEmbeddings(),
{ pineconeIndex }
{ pineconeIndex, namespace }
);

/* Search the vector DB independently with metadata filters */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@ const pinecone = new Pinecone();

const pineconeIndex = pinecone.Index(process.env.PINECONE_INDEX!);

/**
* Pinecone allows you to partition the records in an index into namespaces.
* Queries and other operations are then limited to one namespace,
* so different requests can search different subsets of your index.
* Read more about namespaces here: https://docs.pinecone.io/guides/indexes/use-namespaces
*
* NOTE: If you have namespace enabled in your Pinecone index, you must provide the namespace when creating the PineconeStore.
*/
const namespace = "pinecone";

const pineconeVectorstore = await PineconeStore.fromExistingIndex(
new OpenAIEmbeddings(),
{ pineconeIndex }
{ pineconeIndex, namespace }
);

const pineconeMmrRetriever = pineconeVectorstore.asRetriever({
Expand Down
Loading