Skip to content

Migrate to langchain >=0.1.0,<0.3 - #620

Open
ehsandaya1-blip wants to merge 1 commit into
pinecone-io:mainfrom
ehsandaya1-blip:relay/langchain-0.1.0
Open

ehsandaya1-blip wants to merge 1 commit into
pinecone-io:mainfrom
ehsandaya1-blip:relay/langchain-0.1.0

Conversation

@ehsandaya1-blip

@ehsandaya1-blip ehsandaya1-blip commented Sep 12, 2026 •

Copy link
Copy Markdown

This updates the project's use of langchain from <0.1.0 to >=0.1.0,<0.3, following the provider's migration guide (https://python.langchain.com/docs/versions/v0_2/).

What changed

  • langchain.{vectorstores,document_loaders,utilities,tools,retrievers,chat_models,llms,embeddings,docstore,graphs,storage,agent_toolkits}.* → langchain_community.<same path> (29 sites): Third-party integrations moved to langchain-community with identical module paths.
  • langchain.chat_models.ChatOpenAI / langchain.llms.OpenAI / langchain.embeddings.OpenAIEmbeddings (+ Azure variants) → langchain_openai.{ChatOpenAI, OpenAI, OpenAIEmbeddings, AzureChatOpenAI, AzureOpenAI, AzureOpenAIEmbeddings} (17 sites): OpenAI integrations moved to the langchain-openai partner package.
  • langchain.text_splitter → langchain_text_splitters (8 sites): Text splitters moved to their own package (0.2).

Files touched: 30; files the mechanical pass matched but did not need to change: 7.

How this was produced

Deterministic rewrites from a machine-readable MigrationSpec for this upgrade, then a review pass on the semantic residue; every changed file was parsed and checked with pyflakes for new undefined names before this PR was prepared. No behaviour beyond the migration was touched: no reformatting, no import reordering, no unrelated code.

Happy to adjust anything — if the project deliberately pins the old major version, say so and I will close this.

Notes for reviewers

  • langchain.prompts / langchain.chains / langchain.agents / langchain.memory / langchain.callbacks imports still resolve in 0.1/0.2 and were left alone; three notebooks mention langchain.schema only inside model-output text.

Note

Low Risk
Documentation and example-only import and dependency updates with no production code or behavioral changes.

Overview
This PR updates example notebooks and one streaming demo (main.py) so they work with LangChain’s 0.1+ modular packages instead of deprecated top-level langchain.* integration imports.

Imports are rewired across docs, learn, and search examples: community integrations (e.g. Pinecone vector stores, ReadTheDocsLoader, HuggingFacePipeline) now come from langchain_community, OpenAI/Azure chat and embeddings from langchain_openai, splitters from langchain_text_splitters, and shared types (HumanMessage, StrOutputParser, Document, LLMResult, AgentAction) from langchain_core. Root pyproject.toml dev optional dependency langchain is relaxed to >=0.1 (from >=0.3.21), and the Ollama LangGraph example pyproject.toml pins the new split packages alongside langchain>=0.1.

No tutorial logic, prompts, or chains were refactored—only import paths and dependency declarations, per the LangChain v0.2 migration layout.

Reviewed by Cursor Bugbot for commit 9031da8. Bugbot is set up for automated code reviews on this repo. Configure here.

- **langchain.{vectorstores,document_loaders,utilities,tools,retrievers,chat_models,llms,embeddings,docstore,graphs,storage,agent_toolkits}.*** → `langchain_community.<same path>` (29 sites): Third-party integrations moved to langchain-community with identical module paths.
- **langchain.chat_models.ChatOpenAI / langchain.llms.OpenAI / langchain.embeddings.OpenAIEmbeddings (+ Azure variants)** → `langchain_openai.{ChatOpenAI, OpenAI, OpenAIEmbeddings, AzureChatOpenAI, AzureOpenAI, AzureOpenAIEmbeddings}` (17 sites): OpenAI integrations moved to the langchain-openai partner package.
- **langchain.text_splitter** → `langchain_text_splitters` (8 sites): Text splitters moved to their own package (0.2).
Files touched: 30; files the mechanical pass matched but did not need to change: 7.
Deterministic rewrites from a machine-readable MigrationSpec for this upgrade, then a review pass on the semantic residue; every changed file was parsed and checked with pyflakes for new undefined names before this PR was prepared. No behaviour beyond the migration was touched: no reformatting, no import reordering, no unrelated code.
Happy to adjust anything — if the project deliberately pins the old major version, say so and I will close this.
@ehsandaya1-blip
ehsandaya1-blip requested a review from a team as a code owner September 12, 2026 00:07

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9031da8. Configure here.

" import requests\n",
" from IPython.display import Image, display\n",
" from langchain.chat_models import init_chat_model\n",
" from langchain_community.chat_models import init_chat_model\n",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong init_chat_model import path

High Severity

init_chat_model is imported from langchain_community.chat_models, but that helper lives on langchain.chat_models and was never moved to community. These docs notebooks install langchain[openai]==1.2.7 without langchain-community, so the import cell raises ImportError immediately.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: Bugbot Configuration

Reviewed by Cursor Bugbot for commit 9031da8. Configure here.

"outputs": [],
"source": [
"from langchain.embeddings.openai import OpenAIEmbeddings\n",
"from langchain_openai import OpenAIEmbeddings\n",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Imports diverge from pinned dependencies

High Severity

Imports were rewritten to langchain_community, langchain_openai, langchain_text_splitters, and langchain_core while install cells still pin langchain 0.0.x or 0.1.x and do not install the new packages. Those modules are not available under the existing pins, so the notebooks fail at import time.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: Bugbot Configuration

Reviewed by Cursor Bugbot for commit 9031da8. Configure here.

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