AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Fix Incorrect Import Paths In Langchain-Core Docstring Examples

Docstring examples in langchain-core reference modules 'langchain_core.output_parser', 'langchain_core.runnable', and 'langchain_core.documents' which do not exist, causing ModuleNotFoundError or ImportError when copied. The correct modules are 'langchain_core.output_parsers', 'langchain_core.runnables', and 'langchain_core.documents.base'.

mediumConfidence 98%Langchain-CoreVector StoresEmbeddingsAffected V1.6.6

Origin Analysis

The docstrings use singular module names (output_parser, runnable) and import Blob from the package root, but the actual modules are plural (output_parsers, runnables) and Blob is defined in documents.base, not exported from documents.__init__. This is a documentation inconsistency rather than a runtime failure.
Run the following imports as shown in the docstrings: ```python from langchain_core.output_parser import StrOutputParser from langchain_core.runnable import RunnableLambda from langchain_core.documents import Blob ``` Each raises ModuleNotFoundError or ImportError.

Fixing Code Block

Replace the incorrect import statements in the corresponding docstrings with the correct ones: ```python from langchain_core.output_parsers import StrOutputParser from langchain_core.runnables import RunnableLambda from langchain_core.documents.base import Blob ```
Update the import paths in all affected docstrings to use the actual module names: 'output_parsers' (plural), 'runnables' (plural), and 'documents.base' for Blob. This ensures users copying the examples will not encounter import errors.

Edge Case Audit

This is a docstring-only change and does not affect runtime behavior. However, ensure a global search for the old import paths is performed to catch all occurrences. No rollback is necessary unless future versions re-export these names from the old paths, in which case the docstrings could be reverted. The change is safe for all Python versions and concurrency models.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state