From 0ef0e39a870541bbe800b03c1bdcf88eb6e1350c Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 30 May 2024 15:52:41 +0100 Subject: [PATCH] docs(helpers): mention inputJson event --- helpers.md | 4 ++++ src/lib/MessageStream.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers.md b/helpers.md index 859d9442..53fb049a 100644 --- a/helpers.md +++ b/helpers.md @@ -35,6 +35,10 @@ returns an accumulated `Message` which is progressively built-up over events. The event fired when a text delta is sent by the API. The second parameter returns a `textSnapshot`. +#### `.on('inputJson', (patialJson: string, jsonSnapshot: unknown) => …)` + +The event fired when a json delta is sent by the API. The second parameter returns a `jsonSnapshot`. + #### `.on('message', (message: Message) => …)` The event fired when a message is done being streamed by the API. Corresponds to the `message_stop` SSE event. diff --git a/src/lib/MessageStream.ts b/src/lib/MessageStream.ts index 5fb629fe..072cca7f 100644 --- a/src/lib/MessageStream.ts +++ b/src/lib/MessageStream.ts @@ -18,7 +18,7 @@ export interface MessageStreamEvents { connect: () => void; streamEvent: (event: MessageStreamEvent, snapshot: Message) => void; text: (textDelta: string, textSnapshot: string) => void; - inputJson: (jsonDelta: string, jsonSnapshot: unknown) => void; + inputJson: (partialJson: string, jsonSnapshot: unknown) => void; message: (message: Message) => void; contentBlock: (content: ContentBlock) => void; finalMessage: (message: Message) => void;