Skip to content
Open
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/cuddly-parrots-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/agents": patch
---

fix(generation): preserve LLM-supplied call_id instead of overwriting with item id
3 changes: 2 additions & 1 deletion agents/src/voice/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ export function performLLMInference(
if (tool.type !== 'function_call') continue;

const toolCall = FunctionCall.create({
callId: `${data.id}/fnc_${data.generatedToolCalls.length}`,
id: `${data.id}/fnc_${data.generatedToolCalls.length}`,
callId: tool.callId,
name: tool.name,
args: tool.args,
// Preserve thought signature for Gemini 3+ thinking mode
Expand Down
25 changes: 23 additions & 2 deletions examples/src/testing/basic_task_group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,28 @@ describe('basic_task_group', { timeout: 120_000 }, () => {
toolCalls: [{ name: 'save_email', args: { email: 'charlie@test.com' } }],
},
{
input: 'Conversation to summarize:\n\nuser: My name is Charlie.\nuser: charlie@test.com',
input: [
'Conversation to summarize:',
'',
'<user>',
'My name is Charlie.',
'</user>',
'<function_call name="save_name" call_id="fake_call_0">',
'{"name":"Charlie"}',
'</function_call>',
'<function_call_output name="save_name" call_id="fake_call_0">',
'"Saved name: Charlie"',
'</function_call_output>',
'<user>',
'charlie@test.com',
'</user>',
'<function_call name="save_email" call_id="fake_call_0">',
Comment thread
toubatbrian marked this conversation as resolved.
'{"email":"charlie@test.com"}',
'</function_call>',
'<function_call_output name="save_email" call_id="fake_call_0">',
'"Saved email: charlie@test.com"',
'</function_call_output>',
].join('\n'),
content: 'Summary: name=Charlie, email=charlie@test.com.',
},
]);
Expand All @@ -461,7 +482,7 @@ describe('basic_task_group', { timeout: 120_000 }, () => {
);
expect(summaryMsg).toBeDefined();
if (summaryMsg && summaryMsg.type === 'message') {
expect(summaryMsg.textContent).toContain('[history summary]');
expect(summaryMsg.textContent).toContain('<chat_history_summary>');
}
});
});
Expand Down
Loading