Skip to content

Commit e4372fc

Browse files
committed
merge function complete
1 parent 614c100 commit e4372fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/orchestration/src/util/stream.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,16 @@ function mergeToolCalls(
155155
const existingToolCall = mergedToolCalls.find(
156156
tc => tc.id === toolCall.id
157157
);
158-
// TODO: THIS
159158
if (existingToolCall) {
160159
// Merge existing tool call with incoming tool call
160+
existingToolCall.id = toolCall.id ?? existingToolCall.id;
161161
existingToolCall.function.name =
162162
toolCall.function?.name ?? existingToolCall.function.name;
163163
existingToolCall.function.arguments =
164-
toolCall.function?.arguments ?? existingToolCall.function.arguments;
164+
existingToolCall.function.arguments + (toolCall.function?.arguments ?? '');
165165
} else {
166166
// Add new tool call
167-
mergedToolCalls.push(transformStreamingToolCall(toolCall));
167+
mergedToolCalls.push(transformStreamingToolCall(toolCall));
168168
}
169169
}
170170
return mergedToolCalls;

0 commit comments

Comments
 (0)