Skip to content

Conversation

@Ashitpatel001
Copy link

@Ashitpatel001 Ashitpatel001 commented Dec 21, 2025

Fix : #1065

This PR updates the Question Answering using Gemini, LangChain, and Pinecone notebook to fix compatibility issues with the latest LangChain ecosystem.

Changes

  • Updated deprecated langchain imports to langchain-core and langchain-community.
  • Fixed AttributeError caused by NumPy 2.0 / LangChain version mismatches.
  • Updated Pinecone initialization to use the modern client instance pattern.
  • Ensured the notebook runs successfully in a fresh Google Colab environment.

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

  • The notebook runs successfully from start to finish.
  • Verified compatibility with langchain-google-genai.
  • No secrets or PII are exposed in the output.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:examples Issues/PR referencing examples folder labels Dec 21, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • LangChain Imports: Deprecated langchain imports have been updated to use langchain-core and langchain-community for better modularity and compatibility.
  • Dependency Compatibility: An AttributeError related to NumPy 2.0 and LangChain version mismatches has been resolved, ensuring smoother execution.
  • Pinecone Initialization: The Pinecone client initialization has been modernized to align with the latest client instance patterns, improving reliability.
  • Google Colab Readiness: The notebook has been verified to run successfully in a fresh Google Colab environment, making it immediately usable for developers.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

},
{
"cell_type": "code",
"execution_count": 2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. If the execution_count has changed to something else than null, it usually indicates that the formatting script has not been run. A warning should be raised. (link)

Comment on lines +446 to +450
"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\")))"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:examples Issues/PR referencing examples folder status:awaiting review PR awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maintenance: Migrate deprecated LangChain imports across multiple notebooks

1 participant