Skip to content

Conversation

@Dwij1704
Copy link
Collaborator

@Dwij1704 Dwij1704 commented Nov 17, 2025

Closes #2424 #2429 #2474

  • Updated langchain dependency to version 1.0.0 or higher.
  • Introduced langchain-classic for legacy support.
  • Enhanced README with compatibility information and installation instructions for both LangChain 1.x and LangChain Classic.
  • Updated example code to reflect new agent framework usage.
  • Added _is_json_parseable helper with optimizes approach
  • Handled RemoveMessage from langchain_core
  • Handled missing type in _get_attributes_from_message_content to prevent early return

Note

Adds LangChain 1.x and Classic compatibility, improves _convert_io to detect stringified JSON with MIME tagging, updates examples/docs, and adjusts deps/tests accordingly.

  • Instrumentation (core):
    • Enhance _convert_io to detect stringified JSON and emit application/json MIME type; add _is_json_parseable.
    • Make message role mapping more robust (support RemoveMessage, optional roles) and tolerate missing content.type.
  • Docs & Examples:
    • Update README.md with compatibility, install paths for LangChain 1.x and Classic, and new agent-based quickstart.
    • Add examples: examples/langchain_v1_agent.py, examples/langchain_v1_with_middleware.py; update langgraph_agent_supervisor.py to use langchain_classic.
  • Dependencies/Config:
    • Bump requirements to langchain>=1.0.0 and add langchain-classic>=1.0.0; update pyproject.toml optional test deps accordingly; refresh examples/requirements.txt.
  • Tests:
    • Expand _convert_io test coverage, including JSON-string detection, edge cases, performance, and advanced types.

Written by Cursor Bugbot for commit a6c142d. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 17, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@Dwij1704
Copy link
Collaborator Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Nov 25, 2025
@Dwij1704 Dwij1704 changed the title Fix Langchain fix: Fix Langchain Nov 25, 2025
@Dwij1704 Dwij1704 marked this pull request as ready for review December 12, 2025 22:30
@Dwij1704 Dwij1704 requested a review from a team as a code owner December 12, 2025 22:30
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Dec 12, 2025
# RemoveMessage is a special message type used by LangGraph to mark messages for removal
# It doesn't have a traditional role, so we skip adding a role attribute
# This prevents ValueError while allowing RemoveMessage to be processed
return None
Copy link

Choose a reason for hiding this comment

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

Bug: RemoveMessage triggers unnecessary warning log on every occurrence

The RemoveMessage handling in _map_class_name_to_role returns None to indicate no role is needed. However, in _extract_message_role, when role is None after all strategies are tried, a warning is logged. This means every RemoveMessage processed will trigger a "Unable to determine message role" warning, even though returning None for RemoveMessage is intentional and expected behavior. In LangGraph applications that use message removal frequently, this could cause significant log noise in production.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[feature request] LangChain Auto-Instrumentor Should Normalize JSON MIME

1 participant