Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fresh-tools-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@livekit/agents': patch
---

Include tool names in telemetry result parts.
7 changes: 6 additions & 1 deletion agents/src/telemetry/gen_ai.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ describe('gen_ai builders', () => {
arguments: { loc: 'Paris' },
});
// a serialized payload is deserialized, as the convention asks of instrumentations
expect(messages[2]!.parts[0]!.response).toEqual({ temp: 14 });
expect(messages[2]!.parts[0]).toEqual({
type: 'tool_call_response',
id: 'call_1',
name: 'get_weather',
response: { temp: 14 },
});

const output = genAI.toOutputMessages({
text: 'one moment',
Expand Down
2 changes: 2 additions & 0 deletions agents/src/telemetry/gen_ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ function messageParts(item: ChatItem): MessagePart[] {
parts.push({
type: 'tool_call_response',
id: item.callId,
// Optional extension: the OTel response-part schema permits extra fields.
...(item.name ? { name: item.name } : {}),
response: maybeJson(item.output),
});
}
Expand Down
Loading