Skip to content

Conversation

@bzj55pnkxy-droid
Copy link

@bzj55pnkxy-droid bzj55pnkxy-droid commented Nov 26, 2025

Callbacks uses deprecated imports - not compatible with langchain v1.


Summary by cubic

Updated callbacks.py to use LangChain v1 import paths to keep compatibility with LangSmith/langchain_core and prevent import errors.

  • Refactors
    • Run: langchain.callbacks.tracers.schemas → langsmith.schemas
    • dumps: langchain.load.dump → langchain_core.load.dump
    • BaseMessage: langchain.schema → langchain_core.messages

Written for commit 8547f46. Summary will update automatically on new commits.

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. backend Pertains to the Python backend. labels Nov 26, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@bzj55pnkxy-droid
Copy link
Author

FWIW have a similar PR for docs here:
Chainlit/docs#273

@hayescode
Copy link
Contributor

duplicate of #2700 and this PR has a lint issue.

@hayescode hayescode closed this Dec 4, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 4, 2025
Fixes #2607

- Replace deprecated `langchain.*` imports with `langchain_core.*`
- Updates imports for Run, dumps, and BaseMessage
- Resolves ModuleNotFoundError when using LangchainCallbackHandler with
LangChain v1.x

**Note:** This PR uses the correct `langchain_core.tracers.schemas.Run`
import, which is part of LangChain's core tracer interface. Another PR
(#2695) uses `langsmith.schemas.Run`, but `langchain_core` is the proper
source as it contains the base abstractions that LangChain's callback
system is built on, while `langsmith` is specifically for the LangSmith
monitoring service integration.




<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Updated LangChain imports to use langchain_core so the
LangchainCallbackHandler works with LangChain v1.x. Fixes #2607 by
resolving ModuleNotFoundError from deprecated langchain.* imports
(dumps, BaseMessage, Run).

<sup>Written for commit 7fed064.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: Josh Hayes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Pertains to the Python backend. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants