Skip to content

Update the LangChain retrieval agent notebook to current SDKs - #625

Merged
nicoalba10 merged 3 commits into
mainfrom
update-langchain-retrieval-agent-notebook
Oct 8, 2026
Merged

nicoalba10 merged 3 commits into
mainfrom
update-langchain-retrieval-agent-notebook

Conversation

@nicoalba10

@nicoalba10 nicoalba10 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Moves the LangChain handbook's retrieval agent notebook off pinecone-client==3.1.0, langchain==0.1.1, and langchain-community==0.0.13. It uses the same pins as the LangChain integration guide: pinecone==7.3.0 (since langchain-pinecone==0.2.13 requires pinecone<8), langchain-pinecone==0.2.13, langchain-openai==1.6.7, and langchain==1.4.3.

  • RetrievalQA and initialize_agent are gone in LangChain 1.x, so the agent is now create_agent with a @tool that searches the vector store, plus an InMemorySaver checkpointer for conversational memory.
  • Uses PineconeVectorStore from langchain-pinecone, text-embedding-3-small, and gpt-4o-mini.
  • Loads SQuAD as rajpurkar/squad, which datasets 5.x requires.
  • Points the Colab and nbviewer badges at 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, and openai pins to pinecone==7.3.0, langchain==1.4.3, langchain-pinecone, langchain-openai, and datasets==5.1.0, with shared imports consolidated into the first setup cell (%pip).

The agent flow is rewritten: RetrievalQA plus initialize_agent / ConversationBufferWindowMemory are replaced by create_agent, a @tool that runs vectorstore.similarity_search, and InMemorySaver with a fixed thread_id. Demo calls go through a new chat() helper that prints tool use per turn.

Vector and model updates: PineconeVectorStore from langchain-pinecone, text-embedding-3-small, cosine metric, pc.has_index for index creation, SQuAD loaded as rajpurkar/squad, and the chat model set to gpt-4o-mini. Colab/nbviewer links and handbook URLs point at main and 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.

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>
@nicoalba10
nicoalba10 requested a review from a team as a code owner October 8, 2026 21:51
nicoalba10 and others added 2 commits October 8, 2026 15:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nicoalba10
nicoalba10 merged commit cb8077a into main Oct 8, 2026
18 of 19 checks passed
@nicoalba10
nicoalba10 deleted the update-langchain-retrieval-agent-notebook branch October 8, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant