-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat(langchain): Add Q&A notebook using langchain , Gemini and Pinecone #1078
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
base: main
Are you sure you want to change the base?
feat(langchain): Add Q&A notebook using langchain , Gemini and Pinecone #1078
Conversation
Removed a markdown cell that contained a link to GitHub.
Removed Colab badge and metadata from the notebook.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Summary of ChangesHello @Ashitpatel001, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request revitalizes a question-answering notebook that leverages Gemini, LangChain, and Pinecone. The primary goal is to ensure the notebook's continued functionality by addressing compatibility issues stemming from recent updates in the LangChain ecosystem and other dependencies, making it a reliable resource for developers. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This PR does a good job of updating the notebook to work with the latest versions of LangChain and its related packages, making the code more modern and robust. I've left several comments with suggestions for improvement, mostly related to adhering to the repository's style guide and fixing a few critical correctness issues. Key points from my review include style guide adherence (especially regarding execution_count and import placement), critical correctness issues with the embedding model and its configuration, clarity improvements in comments and markdown, and a file naming inconsistency. Addressing these points will make the notebook more robust and easier for users to follow.
examples/langchain/Copy_of_Gemini_LangChain_QA_Pinecone_WebLoad.ipynb
Outdated
Show resolved
Hide resolved
examples/langchain/Copy_of_Gemini_LangChain_QA_Pinecone_WebLoad.ipynb
Outdated
Show resolved
Hide resolved
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This notebook has execution_count values set for many cells (e.g., 2, 3, 4, etc.). According to the style guide, these should be null to indicate that the formatting script has been run. Please run the notebook formatter to clean up the execution counts and ensure consistency with other notebooks in the repository.
References
- If the
execution_counthas changed to something else thannull, it usually indicates that the formatting script has not been run. A warning should be raised. (link)
| "retriever = vectorstore.as_retriever()\n", | ||
| "# Check if the retriever is working by trying to fetch the relevant docs related\n", | ||
| "# to the word 'MMLU'(Massive Multitask Language Understanding). If the length is\n", | ||
| "# greater than zero, it means that the retriever is functioning well.\n", | ||
| "print(len(retriever.invoke(\"MMLU\")))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output for this cell in the notebook is 3, but based on the current code, only a single document is created and added to the vector store without splitting. Therefore, the retriever should return only one document, and the length should be 1. This stale output suggests the notebook was not fully re-run after the latest changes, which violates the repository's style guide (rule 41). Please ensure all cells are re-run and the outputs are up-to-date before committing.
References
- If none of the outputs changed while some code has, it might be a sign that the notebook has not been run to check that it works, in which case a warning should be raised. (link)
Fix : #1065
This PR updates the Question Answering using Gemini, LangChain, and Pinecone notebook to fix compatibility issues with the latest LangChain ecosystem.
Changes
langchainimports tolangchain-coreandlangchain-community.AttributeErrorcaused by NumPy 2.0 / LangChain version mismatches.Pineconeinitialization to use the modern client instance pattern.Motivation
The previous version of this notebook used deprecated imports that caused errors with modern library versions. This update ensures the tutorial remains usable for developers.
Checklist
langchain-google-genai.