Repository navigation
Update the LangChain retrieval agent notebook to current SDKs - #625
Merged
Merged
Conversation
Move to langchain 1.4.3, langchain-openai 1.6.7, langchain-pinecone 0.2.13, and pinecone 7.3.0, matching the LangChain integration guide on docs.pinecone.io. Replace RetrievalQA and initialize_agent with a retrieval tool and create_agent with an InMemorySaver checkpointer for memory. Use text-embedding-3-small and gpt-4o-mini, and load SQuAD as rajpurkar/squad, which datasets 5.x requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the LangChain handbook's retrieval agent notebook off
pinecone-client==3.1.0,langchain==0.1.1, andlangchain-community==0.0.13. It uses the same pins as the LangChain integration guide:pinecone==7.3.0(sincelangchain-pinecone==0.2.13requirespinecone<8),langchain-pinecone==0.2.13,langchain-openai==1.6.7, andlangchain==1.4.3.RetrievalQAandinitialize_agentare gone in LangChain 1.x, so the agent is nowcreate_agentwith a@toolthat searches the vector store, plus anInMemorySavercheckpointer for conversational memory.PineconeVectorStorefromlangchain-pinecone,text-embedding-3-small, andgpt-4o-mini.rajpurkar/squad, whichdatasets5.x requires.main.Ran end to end on Python 3.12: 18,891 vectors upserted, the agent answers the Notre Dame engineering question with the knowledge base, skips the tool for
2 * 7, and uses the conversation history for the follow-up summary.Note
Low Risk
Single documentation notebook with no production code; changes are dependency pins, API migrations, and re-run outputs only.
Overview
Modernizes the LangChain handbook retrieval-agent notebook (
08-langchain-retrieval-agent.ipynb) so it runs on current Pinecone and LangChain 1.x stacks and matches the official integration pins.Dependency installs move from legacy
pinecone-client,langchain-community, andopenaipins topinecone==7.3.0,langchain==1.4.3,langchain-pinecone,langchain-openai, anddatasets==5.1.0, with shared imports consolidated into the first setup cell (%pip).The agent flow is rewritten:
RetrievalQAplusinitialize_agent/ConversationBufferWindowMemoryare replaced bycreate_agent, a@toolthat runsvectorstore.similarity_search, andInMemorySaverwith a fixedthread_id. Demo calls go through a newchat()helper that prints tool use per turn.Vector and model updates:
PineconeVectorStorefromlangchain-pinecone,text-embedding-3-small, cosine metric,pc.has_indexfor index creation, SQuAD loaded asrajpurkar/squad, and the chat model set togpt-4o-mini. Colab/nbviewer links and handbook URLs point atmainand the updated learn-series paths; notebook outputs are refreshed from a Python 3.12 end-to-end run.Reviewed by Cursor Bugbot for commit 40a28e2. Bugbot is set up for automated code reviews on this repo. Configure here.