You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Larger bug: In message history in assistant messages (gen_ai.prompt.N.content) the content is empty if the message was a tool call.
Smaller bug: Message type tool automatically gets converted to unknown. I am not sure if any of the observability platforms (in particular, Traceloop) rely on the message type to be one of user, assistant, unknown, but I'd say conversions like this must happen in the backend.
👟 Reproduction steps
from langchain_core.messages import HumanMessage, AIMessage, ToolMessage, SystemMessage, BaseMessage
from langchain_openai import ChatOpenAI
def get_weather(location: str) -> str:
return "sunny"
messages: list[BaseMessage] = [
SystemMessage(content="Be crisp and friendly."),
HumanMessage(content="Hey, what's the weather in San Francisco?"),
AIMessage(
content="",
tool_calls=[
{
"name": "get_weather",
"args": {"location": "San Francisco"},
"id": "tool_123",
"type": "tool_call",
}
],
),
ToolMessage(content="Sunny as always!", tool_call_id="tool_123"),
HumanMessage(content="What's the weather in London?"),
]
model = ChatOpenAI(model="gpt-4.1-nano", temperature=0)
model_with_tools = model.bind_tools([get_weather])
result = model_with_tools.invoke(messages)
👍 Expected behavior
gen_ai.prompts.2.content has the tool_calls gen_ai.prompts.3.role == tool
👎 Actual Behavior with Screenshots
gen_ai.prompts.2.content is empty gen_ai.prompts.3.role == unknown
🤖 Python Version
3.13
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
I checked and didn't find similar issue
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered:
Which component is this bug for?
Langchain Instrumentation
📜 Description
Larger bug: In message history in assistant messages (
gen_ai.prompt.N.content
) the content is empty if the message was a tool call.Smaller bug: Message type
tool
automatically gets converted tounknown
. I am not sure if any of the observability platforms (in particular, Traceloop) rely on the message type to be one ofuser
,assistant
,unknown
, but I'd say conversions like this must happen in the backend.👟 Reproduction steps
👍 Expected behavior
gen_ai.prompts.2.content
has the tool_callsgen_ai.prompts.3.role == tool
👎 Actual Behavior with Screenshots
gen_ai.prompts.2.content
is emptygen_ai.prompts.3.role == unknown
🤖 Python Version
3.13
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: