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

DOC: Missing Initialization of pineconeIndex in PineconeStore in the URL #29454

Open
2 tasks done
codeapexdev opened this issue Jan 28, 2025 · 0 comments
Open
2 tasks done
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder

Comments

@codeapexdev
Copy link

URL

https://js.langchain.com/docs/tutorials/rag/

Checklist

  • I added a very descriptive title to this issue.
  • I included a link to the documentation page I am referring to (if applicable).

Issue with current documentation:

The provided example code in the LangChain documentation for using PineconeStore is incomplete as it does not initialize or create the pineconeIndex variable.

import { PineconeStore } from "@langchain/pinecone";
import { Pinecone as PineconeClient } from "@pinecone-database/pinecone";

const pinecone = new PineconeClient();
const vectorStore = new PineconeStore(embeddings, {
  pineconeIndex,
  maxConcurrency: 5,
});

The variable pineconeIndex is used without being initialized or created. This will result in an error when running the code.

Image

Idea or request for content:

The code can be fixed by adding the initialization of pineconeIndex using the pinecone.Index()

import { PineconeStore } from "@langchain/pinecone";
import { Pinecone as PineconeClient } from "@pinecone-database/pinecone";

const PINECONE_API_KEY:any = process.env.PINECONE_API_KEY
const pinecone = new PineconeClient({
apiKey: PINECONE_API_KEY
});
const pineconeIndex = pinecone.Index("rag"); // Initialize the Pinecone index
const vectorStore = new PineconeStore(embeddings, {
pineconeIndex,
maxConcurrency: 5,
});

Also added the API key since it was not mentioned in the docs either.

@dosubot dosubot bot added the 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder
Projects
None yet
Development

No branches or pull requests

1 participant