Skip to content

Commit

Permalink
feat: allow out of order tool args streaming (#995)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Oct 13, 2024
1 parent 48a2bdc commit 28ceea3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @assistant-ui/react

## 0.5.79

### Patch Changes

- feat: allow out of order tool args streaming

## 0.5.78

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"conversational-ui",
"conversational-ai"
],
"version": "0.5.78",
"version": "0.5.79",
"license": "MIT",
"exports": {
".": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@ export function assistantDecoderStream() {
}
case AssistantStreamChunkType.ToolCallDelta: {
const { toolCallId, argsTextDelta } = value;
if (currentToolCall?.id !== toolCallId) {
throw new Error(
`Received tool call delta for unknown tool call "${toolCallId}".`,
);
}

const toolName = toolCallNames.get(toolCallId)!;
currentToolCall!.argsText += argsTextDelta;
controller.enqueue({
type: "tool-call-delta",
toolCallType: "function",
toolCallId: currentToolCall!.id,
toolName: currentToolCall!.name,
toolCallId,
toolName,
argsTextDelta: argsTextDelta,
});
break;
Expand Down

0 comments on commit 28ceea3

Please sign in to comment.