Skip to content

Commit

Permalink
feat: ignore unsupported data stream parts (#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Dec 16, 2024
1 parent 0cbaaca commit 0404d67
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/assistant-stream/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# assistant-stream

## 0.0.12

### Patch Changes

- ignore unsupported data stream parts

## 0.0.11

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/assistant-stream/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "assistant-stream",
"version": "0.0.11",
"version": "0.0.12",
"license": "MIT",
"exports": {
".": {
Expand Down
27 changes: 27 additions & 0 deletions packages/assistant-stream/src/core/serialization/DataStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,33 @@ export class DataStreamDecoder {
break;
}

case "9": {
const { toolCallId, args } = value as {
toolCallId: string;
toolName: string;
args: object;
};
controller.enqueue({
type: "tool-call-begin",
toolCallId,
toolName: toolCallId,
});
controller.enqueue({
type: "tool-call-delta",
toolCallId,
argsTextDelta: JSON.stringify(args),
});
break;
}

case "2":
case "3":
case "8":
case "d":
case "e": {
break; // ignore
}

default:
const exhaustiveCheck: string = type;
throw new Error(`unsupported chunk type: ${exhaustiveCheck}`);
Expand Down

0 comments on commit 0404d67

Please sign in to comment.