Skip to content

[bug] OpenInference tracer fails to handle RemoveMessage from langchain_core #2429

@AvinashMudireddy31

Description

@AvinashMudireddy31

Describe the bug
The _extract_message_role function in the OpenInference LangChain instrumentation tracer fails to handle RemoveMessage from langchain_core.messages.modifier. When processing a RemoveMessage class, the function raises a ValueError.

To Reproduce

  1. Use LangChain with OpenInference instrumentation enabled.
  2. Create a workflow or chain that uses RemoveMessage from langchain_core.messages.modifier (ex: Remove a message from complied Langgraph state).
  3. The tracer will throw a ValueError with message: "Cannot parse message of type: RemoveMessage"

Expected behavior
The _extract_message_role function should properly handle RemoveMessage without throwing an error.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: macOS
  • Python Version: 3.12
  • langchain-core>=0.3.72
  • openinference-instrumentation-langchain>=0.1.52
  • arize-phoenix>=10.13.1

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions