Skip to content

Conversation

@caroger
Copy link
Collaborator

@caroger caroger commented Nov 6, 2025

resolves AX issue -https://github.com/Arize-ai/arize/issues/55878
also closes #2426


Note

Improve role extraction to handle messages lacking id (e.g., LangGraph streaming, raw dicts) and add tests/cassettes validating agent flows.

  • Tracer updates (_tracer.py):
    • Add _infer_role_from_context and _map_class_name_to_role helpers.
    • Rewrite _extract_message_role to use layered strategies: id parsing, type, direct role, and contextual inference (e.g., tool_calls, tool_call_id).
    • Yield MESSAGE_ROLE when derivable; otherwise log a warning instead of asserting.
  • Tests:
    • Add tests/test_raw_dict_message.py covering agent invocation with raw dict messages and unit role extraction (including multiple roles).
    • Add VCR cassette tests/cassettes/test_raw_dict_message/test_agent_with_raw_dict_messages.yaml for streaming tool-call and completion flows.

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

@caroger caroger marked this pull request as ready for review November 18, 2025 18:28
@caroger caroger requested a review from a team as a code owner November 18, 2025 18:28
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 18, 2025
@caroger caroger changed the title fix(langchain): handle None message id fields in LangGraph streaming fix(langchain): handle None message id fields Nov 18, 2025
@caroger caroger requested a review from RogerHYang November 18, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[bug] Python LangChain 1.0 instrumentation error in _extract_message_role(): expected list, found <class 'NoneType'>

2 participants