We use the deprecated gen_ai.response.tool_calls attribute in a number of places which has caused confusion in the data collection implementation because:
- tool calls are defined as "inputs"
- they currently may appear in the response output if "outputs" are set to False but "inputs" are set to True
Mirroring what the JS SDK does, we should be doing the following:
- tool calls appearing in the response like the
gen_ai.output.messages attribute should be gated on "output"
- arguments to a tool call should be gated on "input" and set on the non-deprecated attribute
gen_ai.tool.call.arguments (doc)
- results of a tool call should be gated on "output" and set on the non-deprecated attribute
gen_ai.tool.call.result (doc)
- confirm that integrations that create distinct tool invocation spans (i.e. agent frameworks such as openai-agents, langchain, and pydantic-ai) are setting the correct attributes and are gated correctly.
To preserve legacy behaviour, the code path for when data collection is not enabled should continue to set the legacy attributes.
We use the deprecated
gen_ai.response.tool_callsattribute in a number of places which has caused confusion in the data collection implementation because:Mirroring what the JS SDK does, we should be doing the following:
gen_ai.output.messagesattribute should be gated on "output"gen_ai.tool.call.arguments(doc)gen_ai.tool.call.result(doc)To preserve legacy behaviour, the code path for when data collection is not enabled should continue to set the legacy attributes.