Skip to content

Fix broken LangChain imports in examples/langchain_rag #400

Description

@AlexFoxalt

Name and Version

development

What is the problem this feature will solve?

examples/langchain_rag/app.py uses outdated LangChain import paths that are incompatible with currently pinned dependencies in examples/langchain_rag/requirements.txt.

Repro steps:

  1. cd examples/langchain_rag
  2. python -m venv .venv && source .venv/bin/activate
  3. pip install -r requirements.txt
  4. python app.py

Current result: app fails at import time with errors like:

  • ModuleNotFoundError: No module named 'langchain.chains'
  • ImportError: cannot import name 'CacheBackedEmbeddings' from 'langchain.embeddings'
  • ModuleNotFoundError: No module named 'langchain.globals'
  • ModuleNotFoundError: No module named 'langchain.storage'

Expected result: example should start without import-time failures (runtime config errors like missing DIAL_URL are acceptable).

What is the feature you are proposing to solve the problem?

Update examples/langchain_rag/app.py imports to match modern LangChain package split used by pinned versions:

  • RetrievalQA import: langchain.chains... -> langchain_classic.chains.retrieval_qa.base
  • CacheBackedEmbeddings import: langchain.embeddings -> langchain_classic.embeddings
  • set_debug import: langchain.globals -> langchain_core.globals
  • LocalFileStore import: langchain.storage -> langchain_classic.storage

Acceptance criteria:

  • python app.py no longer fails on import errors in examples/langchain_rag.

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions