Skip to content

Commit

Permalink
fix: toolResultStream should support JSONSchema params (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Dec 17, 2024
1 parent 3ab85ab commit e5e06e4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 31 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.7.15

### Patch Changes

- fix: toolResultStream should support JSONSchema params

## 0.7.14

### 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.7.14",
"version": "0.7.15",
"license": "MIT",
"exports": {
".": {
Expand Down
60 changes: 30 additions & 30 deletions packages/react/src/runtimes/edge/streams/toolResultStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,38 +64,38 @@ export function toolResultStream(
isError: true,
});
return;
} else {
toolCallExecutions.set(
toolCallId,
(async () => {
if (!tool.execute) return;

try {
const result = await tool.execute(args, { abortSignal });

controller.enqueue({
type: "tool-result",
toolCallType,
toolCallId,
toolName,
result,
});
} catch (error) {
controller.enqueue({
type: "tool-result",
toolCallType,
toolCallId,
toolName,
result: "Error: " + error,
isError: true,
});
} finally {
toolCallExecutions.delete(toolCallId);
}
})(),
);
}
}

toolCallExecutions.set(
toolCallId,
(async () => {
if (!tool.execute) return;

try {
const result = await tool.execute(args, { abortSignal });

controller.enqueue({
type: "tool-result",
toolCallType,
toolCallId,
toolName,
result,
});
} catch (error) {
controller.enqueue({
type: "tool-result",
toolCallType,
toolCallId,
toolName,
result: "Error: " + error,
isError: true,
});
} finally {
toolCallExecutions.delete(toolCallId);
}
})(),
);
break;
}

Expand Down

0 comments on commit e5e06e4

Please sign in to comment.