@gleanwork/api-client 0.19.2 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/commonjs/__tests__/summarize.test.js +2 -4
- package/dist/commonjs/__tests__/summarize.test.js.map +1 -1
- package/dist/commonjs/funcs/chatCreate.d.ts +2 -8
- package/dist/commonjs/funcs/chatCreate.d.ts.map +1 -1
- package/dist/commonjs/funcs/chatCreate.js +4 -13
- package/dist/commonjs/funcs/chatCreate.js.map +1 -1
- package/dist/commonjs/funcs/chatCreateStream.d.ts +20 -0
- package/dist/commonjs/funcs/chatCreateStream.d.ts.map +1 -0
- package/dist/commonjs/funcs/chatCreateStream.js +134 -0
- package/dist/commonjs/funcs/chatCreateStream.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/event-streams.d.ts +23 -0
- package/dist/commonjs/lib/event-streams.d.ts.map +1 -0
- package/dist/commonjs/lib/event-streams.js +168 -0
- package/dist/commonjs/lib/event-streams.js.map +1 -0
- package/dist/commonjs/models/components/chatmessagefragment.d.ts +1 -1
- package/dist/commonjs/models/components/index.d.ts +15 -1
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +15 -1
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/platformchatcompletedresponse.d.ts +4 -4
- package/dist/commonjs/models/components/platformchatcompletedresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/platformchatcompletedresponse.js +4 -5
- package/dist/commonjs/models/components/platformchatcompletedresponse.js.map +1 -1
- package/dist/commonjs/models/components/platformchatfailedresponse.d.ts +44 -0
- package/dist/commonjs/models/components/platformchatfailedresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatfailedresponse.js +71 -0
- package/dist/commonjs/models/components/platformchatfailedresponse.js.map +1 -0
- package/dist/commonjs/models/components/platformchatresponseerror.d.ts +16 -0
- package/dist/commonjs/models/components/platformchatresponseerror.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatresponseerror.js +52 -0
- package/dist/commonjs/models/components/platformchatresponseerror.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreameventserversentevent.d.ts +17 -0
- package/dist/commonjs/models/components/platformchatstreameventserversentevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreameventserversentevent.js +62 -0
- package/dist/commonjs/models/components/platformchatstreameventserversentevent.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdelta.d.ts +24 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdelta.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdelta.js +58 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdelta.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdeltaserversentevent.d.ts +13 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdeltaserversentevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdeltaserversentevent.js +64 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdeltaserversentevent.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdone.d.ts +24 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdone.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdone.js +58 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdone.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdoneserversentevent.d.ts +13 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdoneserversentevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdoneserversentevent.js +64 -0
- package/dist/commonjs/models/components/platformchatstreamoutputtextdoneserversentevent.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamprogress.d.ts +29 -0
- package/dist/commonjs/models/components/platformchatstreamprogress.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamprogress.js +58 -0
- package/dist/commonjs/models/components/platformchatstreamprogress.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamprogressserversentevent.d.ts +13 -0
- package/dist/commonjs/models/components/platformchatstreamprogressserversentevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamprogressserversentevent.js +64 -0
- package/dist/commonjs/models/components/platformchatstreamprogressserversentevent.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecompleted.d.ts +25 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecompleted.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecompleted.js +60 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecompleted.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecompletedserversentevent.d.ts +13 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecompletedserversentevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecompletedserversentevent.js +64 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecompletedserversentevent.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecreated.d.ts +23 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecreated.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecreated.js +57 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecreated.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecreatedserversentevent.d.ts +13 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecreatedserversentevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecreatedserversentevent.js +64 -0
- package/dist/commonjs/models/components/platformchatstreamresponsecreatedserversentevent.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsefailed.d.ts +25 -0
- package/dist/commonjs/models/components/platformchatstreamresponsefailed.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsefailed.js +59 -0
- package/dist/commonjs/models/components/platformchatstreamresponsefailed.js.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsefailedserversentevent.d.ts +13 -0
- package/dist/commonjs/models/components/platformchatstreamresponsefailedserversentevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/platformchatstreamresponsefailedserversentevent.js +64 -0
- package/dist/commonjs/models/components/platformchatstreamresponsefailedserversentevent.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/platformchatcreate.d.ts +41 -5
- package/dist/commonjs/models/operations/platformchatcreate.d.ts.map +1 -1
- package/dist/commonjs/models/operations/platformchatcreate.js +20 -7
- package/dist/commonjs/models/operations/platformchatcreate.js.map +1 -1
- package/dist/commonjs/models/operations/platformchatcreatestream.d.ts +45 -0
- package/dist/commonjs/models/operations/platformchatcreatestream.d.ts.map +1 -0
- package/dist/commonjs/models/{components/platformchatcreaterequest.js → operations/platformchatcreatestream.js} +17 -14
- package/dist/commonjs/models/operations/platformchatcreatestream.js.map +1 -0
- package/dist/commonjs/react-query/chatCreate.d.ts +5 -11
- package/dist/commonjs/react-query/chatCreate.d.ts.map +1 -1
- package/dist/commonjs/react-query/chatCreate.js +1 -4
- package/dist/commonjs/react-query/chatCreate.js.map +1 -1
- package/dist/commonjs/react-query/chatCreateStream.d.ts +31 -0
- package/dist/commonjs/react-query/chatCreateStream.d.ts.map +1 -0
- package/dist/commonjs/react-query/chatCreateStream.js +48 -0
- package/dist/commonjs/react-query/chatCreateStream.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +1 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +1 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/sdk/chat.d.ts +10 -6
- package/dist/commonjs/sdk/chat.d.ts.map +1 -1
- package/dist/commonjs/sdk/chat.js +12 -4
- package/dist/commonjs/sdk/chat.js.map +1 -1
- package/dist/esm/__tests__/summarize.test.js +2 -4
- package/dist/esm/__tests__/summarize.test.js.map +1 -1
- package/dist/esm/funcs/chatCreate.d.ts +2 -8
- package/dist/esm/funcs/chatCreate.d.ts.map +1 -1
- package/dist/esm/funcs/chatCreate.js +4 -12
- package/dist/esm/funcs/chatCreate.js.map +1 -1
- package/dist/esm/funcs/chatCreateStream.d.ts +20 -0
- package/dist/esm/funcs/chatCreateStream.d.ts.map +1 -0
- package/dist/esm/funcs/chatCreateStream.js +98 -0
- package/dist/esm/funcs/chatCreateStream.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/event-streams.d.ts +23 -0
- package/dist/esm/lib/event-streams.d.ts.map +1 -0
- package/dist/esm/lib/event-streams.js +164 -0
- package/dist/esm/lib/event-streams.js.map +1 -0
- package/dist/esm/models/components/chatmessagefragment.d.ts +1 -1
- package/dist/esm/models/components/index.d.ts +15 -1
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +15 -1
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/platformchatcompletedresponse.d.ts +4 -4
- package/dist/esm/models/components/platformchatcompletedresponse.d.ts.map +1 -1
- package/dist/esm/models/components/platformchatcompletedresponse.js +3 -4
- package/dist/esm/models/components/platformchatcompletedresponse.js.map +1 -1
- package/dist/esm/models/components/platformchatfailedresponse.d.ts +44 -0
- package/dist/esm/models/components/platformchatfailedresponse.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatfailedresponse.js +34 -0
- package/dist/esm/models/components/platformchatfailedresponse.js.map +1 -0
- package/dist/esm/models/components/platformchatresponseerror.d.ts +16 -0
- package/dist/esm/models/components/platformchatresponseerror.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatresponseerror.js +15 -0
- package/dist/esm/models/components/platformchatresponseerror.js.map +1 -0
- package/dist/esm/models/components/platformchatstreameventserversentevent.d.ts +17 -0
- package/dist/esm/models/components/platformchatstreameventserversentevent.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreameventserversentevent.js +25 -0
- package/dist/esm/models/components/platformchatstreameventserversentevent.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdelta.d.ts +24 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdelta.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdelta.js +21 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdelta.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdeltaserversentevent.d.ts +13 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdeltaserversentevent.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdeltaserversentevent.js +27 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdeltaserversentevent.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdone.d.ts +24 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdone.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdone.js +21 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdone.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdoneserversentevent.d.ts +13 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdoneserversentevent.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdoneserversentevent.js +27 -0
- package/dist/esm/models/components/platformchatstreamoutputtextdoneserversentevent.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamprogress.d.ts +29 -0
- package/dist/esm/models/components/platformchatstreamprogress.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamprogress.js +21 -0
- package/dist/esm/models/components/platformchatstreamprogress.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamprogressserversentevent.d.ts +13 -0
- package/dist/esm/models/components/platformchatstreamprogressserversentevent.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamprogressserversentevent.js +27 -0
- package/dist/esm/models/components/platformchatstreamprogressserversentevent.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsecompleted.d.ts +25 -0
- package/dist/esm/models/components/platformchatstreamresponsecompleted.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsecompleted.js +23 -0
- package/dist/esm/models/components/platformchatstreamresponsecompleted.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsecompletedserversentevent.d.ts +13 -0
- package/dist/esm/models/components/platformchatstreamresponsecompletedserversentevent.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsecompletedserversentevent.js +27 -0
- package/dist/esm/models/components/platformchatstreamresponsecompletedserversentevent.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsecreated.d.ts +23 -0
- package/dist/esm/models/components/platformchatstreamresponsecreated.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsecreated.js +20 -0
- package/dist/esm/models/components/platformchatstreamresponsecreated.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsecreatedserversentevent.d.ts +13 -0
- package/dist/esm/models/components/platformchatstreamresponsecreatedserversentevent.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsecreatedserversentevent.js +27 -0
- package/dist/esm/models/components/platformchatstreamresponsecreatedserversentevent.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsefailed.d.ts +25 -0
- package/dist/esm/models/components/platformchatstreamresponsefailed.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsefailed.js +22 -0
- package/dist/esm/models/components/platformchatstreamresponsefailed.js.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsefailedserversentevent.d.ts +13 -0
- package/dist/esm/models/components/platformchatstreamresponsefailedserversentevent.d.ts.map +1 -0
- package/dist/esm/models/components/platformchatstreamresponsefailedserversentevent.js +27 -0
- package/dist/esm/models/components/platformchatstreamresponsefailedserversentevent.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/platformchatcreate.d.ts +41 -5
- package/dist/esm/models/operations/platformchatcreate.d.ts.map +1 -1
- package/dist/esm/models/operations/platformchatcreate.js +17 -5
- package/dist/esm/models/operations/platformchatcreate.js.map +1 -1
- package/dist/esm/models/operations/platformchatcreatestream.d.ts +45 -0
- package/dist/esm/models/operations/platformchatcreatestream.d.ts.map +1 -0
- package/dist/esm/models/operations/platformchatcreatestream.js +28 -0
- package/dist/esm/models/operations/platformchatcreatestream.js.map +1 -0
- package/dist/esm/react-query/chatCreate.d.ts +5 -11
- package/dist/esm/react-query/chatCreate.d.ts.map +1 -1
- package/dist/esm/react-query/chatCreate.js +1 -2
- package/dist/esm/react-query/chatCreate.js.map +1 -1
- package/dist/esm/react-query/chatCreateStream.d.ts +31 -0
- package/dist/esm/react-query/chatCreateStream.d.ts.map +1 -0
- package/dist/esm/react-query/chatCreateStream.js +43 -0
- package/dist/esm/react-query/chatCreateStream.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +1 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +1 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/sdk/chat.d.ts +10 -6
- package/dist/esm/sdk/chat.d.ts.map +1 -1
- package/dist/esm/sdk/chat.js +11 -2
- package/dist/esm/sdk/chat.js.map +1 -1
- package/jsr.json +2 -1
- package/package.json +1 -1
- package/src/__tests__/summarize.test.ts +2 -4
- package/src/funcs/chatCreate.ts +11 -20
- package/src/funcs/chatCreateStream.ts +197 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/event-streams.ts +192 -0
- package/src/models/components/chatmessagefragment.ts +1 -1
- package/src/models/components/index.ts +15 -1
- package/src/models/components/platformchatcompletedresponse.ts +9 -6
- package/src/models/components/platformchatfailedresponse.ts +92 -0
- package/src/models/components/platformchatresponseerror.ts +39 -0
- package/src/models/components/platformchatstreameventserversentevent.ts +69 -0
- package/src/models/components/platformchatstreamoutputtextdelta.ts +55 -0
- package/src/models/components/platformchatstreamoutputtextdeltaserversentevent.ts +55 -0
- package/src/models/components/platformchatstreamoutputtextdone.ts +55 -0
- package/src/models/components/platformchatstreamoutputtextdoneserversentevent.ts +55 -0
- package/src/models/components/platformchatstreamprogress.ts +59 -0
- package/src/models/components/platformchatstreamprogressserversentevent.ts +54 -0
- package/src/models/components/platformchatstreamresponsecompleted.ts +59 -0
- package/src/models/components/platformchatstreamresponsecompletedserversentevent.ts +55 -0
- package/src/models/components/platformchatstreamresponsecreated.ts +53 -0
- package/src/models/components/platformchatstreamresponsecreatedserversentevent.ts +55 -0
- package/src/models/components/platformchatstreamresponsefailed.ts +59 -0
- package/src/models/components/platformchatstreamresponsefailedserversentevent.ts +55 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/platformchatcreate.ts +75 -17
- package/src/models/operations/platformchatcreatestream.ts +96 -0
- package/src/react-query/chatCreate.ts +6 -8
- package/src/react-query/chatCreateStream.ts +115 -0
- package/src/react-query/index.ts +1 -0
- package/src/sdk/chat.ts +24 -7
- package/dist/commonjs/models/components/platformchatcreaterequest.d.ts +0 -50
- package/dist/commonjs/models/components/platformchatcreaterequest.d.ts.map +0 -1
- package/dist/commonjs/models/components/platformchatcreaterequest.js.map +0 -1
- package/dist/esm/models/components/platformchatcreaterequest.d.ts +0 -50
- package/dist/esm/models/components/platformchatcreaterequest.d.ts.map +0 -1
- package/dist/esm/models/components/platformchatcreaterequest.js +0 -25
- package/dist/esm/models/components/platformchatcreaterequest.js.map +0 -1
- package/src/models/components/platformchatcreaterequest.ts +0 -90
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 030050bc1577
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
PlatformChatStreamOutputTextDone,
|
|
12
|
+
PlatformChatStreamOutputTextDone$inboundSchema,
|
|
13
|
+
} from "./platformchatstreamoutputtextdone.js";
|
|
14
|
+
|
|
15
|
+
export type PlatformChatStreamOutputTextDoneServerSentEvent = {
|
|
16
|
+
id?: string | undefined;
|
|
17
|
+
event: "RESPONSE_OUTPUT_TEXT_DONE";
|
|
18
|
+
data: PlatformChatStreamOutputTextDone;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const PlatformChatStreamOutputTextDoneServerSentEvent$inboundSchema:
|
|
23
|
+
z.ZodType<
|
|
24
|
+
PlatformChatStreamOutputTextDoneServerSentEvent,
|
|
25
|
+
z.ZodTypeDef,
|
|
26
|
+
unknown
|
|
27
|
+
> = z.object({
|
|
28
|
+
id: z.string().optional(),
|
|
29
|
+
event: z.literal("RESPONSE_OUTPUT_TEXT_DONE"),
|
|
30
|
+
data: z.unknown().transform((v, ctx) => {
|
|
31
|
+
if (typeof v !== "string") return v;
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(v);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
36
|
+
return z.NEVER;
|
|
37
|
+
}
|
|
38
|
+
}).pipe(PlatformChatStreamOutputTextDone$inboundSchema),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function platformChatStreamOutputTextDoneServerSentEventFromJSON(
|
|
42
|
+
jsonString: string,
|
|
43
|
+
): SafeParseResult<
|
|
44
|
+
PlatformChatStreamOutputTextDoneServerSentEvent,
|
|
45
|
+
SDKValidationError
|
|
46
|
+
> {
|
|
47
|
+
return safeParse(
|
|
48
|
+
jsonString,
|
|
49
|
+
(x) =>
|
|
50
|
+
PlatformChatStreamOutputTextDoneServerSentEvent$inboundSchema.parse(
|
|
51
|
+
JSON.parse(x),
|
|
52
|
+
),
|
|
53
|
+
`Failed to parse 'PlatformChatStreamOutputTextDoneServerSentEvent' from JSON`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: fdf796d73611
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export const PlatformChatStreamProgressType = {
|
|
13
|
+
ResponseProgress: "RESPONSE_PROGRESS",
|
|
14
|
+
} as const;
|
|
15
|
+
export type PlatformChatStreamProgressType = ClosedEnum<
|
|
16
|
+
typeof PlatformChatStreamProgressType
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export type PlatformChatStreamProgress = {
|
|
20
|
+
type: PlatformChatStreamProgressType;
|
|
21
|
+
/**
|
|
22
|
+
* Platform-owned, non-persisted response envelope identifier in `resp_<uuid>` form. The same identifier is used for every event in one streamed response.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
*/
|
|
26
|
+
response_id: string;
|
|
27
|
+
/**
|
|
28
|
+
* Verbatim concatenated fragment text from an assistant UPDATE wire message. Display-oriented passthrough only; not part of the final answer and not present on terminal response snapshots.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
*/
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const PlatformChatStreamProgressType$inboundSchema: z.ZodNativeEnum<
|
|
37
|
+
typeof PlatformChatStreamProgressType
|
|
38
|
+
> = z.nativeEnum(PlatformChatStreamProgressType);
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const PlatformChatStreamProgress$inboundSchema: z.ZodType<
|
|
42
|
+
PlatformChatStreamProgress,
|
|
43
|
+
z.ZodTypeDef,
|
|
44
|
+
unknown
|
|
45
|
+
> = z.object({
|
|
46
|
+
type: PlatformChatStreamProgressType$inboundSchema,
|
|
47
|
+
response_id: z.string(),
|
|
48
|
+
text: z.string(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export function platformChatStreamProgressFromJSON(
|
|
52
|
+
jsonString: string,
|
|
53
|
+
): SafeParseResult<PlatformChatStreamProgress, SDKValidationError> {
|
|
54
|
+
return safeParse(
|
|
55
|
+
jsonString,
|
|
56
|
+
(x) => PlatformChatStreamProgress$inboundSchema.parse(JSON.parse(x)),
|
|
57
|
+
`Failed to parse 'PlatformChatStreamProgress' from JSON`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5248bd43dea5
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
PlatformChatStreamProgress,
|
|
12
|
+
PlatformChatStreamProgress$inboundSchema,
|
|
13
|
+
} from "./platformchatstreamprogress.js";
|
|
14
|
+
|
|
15
|
+
export type PlatformChatStreamProgressServerSentEvent = {
|
|
16
|
+
id?: string | undefined;
|
|
17
|
+
event: "RESPONSE_PROGRESS";
|
|
18
|
+
data: PlatformChatStreamProgress;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const PlatformChatStreamProgressServerSentEvent$inboundSchema: z.ZodType<
|
|
23
|
+
PlatformChatStreamProgressServerSentEvent,
|
|
24
|
+
z.ZodTypeDef,
|
|
25
|
+
unknown
|
|
26
|
+
> = z.object({
|
|
27
|
+
id: z.string().optional(),
|
|
28
|
+
event: z.literal("RESPONSE_PROGRESS"),
|
|
29
|
+
data: z.unknown().transform((v, ctx) => {
|
|
30
|
+
if (typeof v !== "string") return v;
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(v);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
35
|
+
return z.NEVER;
|
|
36
|
+
}
|
|
37
|
+
}).pipe(PlatformChatStreamProgress$inboundSchema),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export function platformChatStreamProgressServerSentEventFromJSON(
|
|
41
|
+
jsonString: string,
|
|
42
|
+
): SafeParseResult<
|
|
43
|
+
PlatformChatStreamProgressServerSentEvent,
|
|
44
|
+
SDKValidationError
|
|
45
|
+
> {
|
|
46
|
+
return safeParse(
|
|
47
|
+
jsonString,
|
|
48
|
+
(x) =>
|
|
49
|
+
PlatformChatStreamProgressServerSentEvent$inboundSchema.parse(
|
|
50
|
+
JSON.parse(x),
|
|
51
|
+
),
|
|
52
|
+
`Failed to parse 'PlatformChatStreamProgressServerSentEvent' from JSON`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: acec96f29e31
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
import {
|
|
12
|
+
PlatformChatCompletedResponse,
|
|
13
|
+
PlatformChatCompletedResponse$inboundSchema,
|
|
14
|
+
} from "./platformchatcompletedresponse.js";
|
|
15
|
+
|
|
16
|
+
export const PlatformChatStreamResponseCompletedType = {
|
|
17
|
+
ResponseCompleted: "RESPONSE_COMPLETED",
|
|
18
|
+
} as const;
|
|
19
|
+
export type PlatformChatStreamResponseCompletedType = ClosedEnum<
|
|
20
|
+
typeof PlatformChatStreamResponseCompletedType
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
export type PlatformChatStreamResponseCompleted = {
|
|
24
|
+
type: PlatformChatStreamResponseCompletedType;
|
|
25
|
+
/**
|
|
26
|
+
* Platform-owned, non-persisted response envelope identifier in `resp_<uuid>` form. The same identifier is used for every event in one streamed response.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
*/
|
|
30
|
+
response_id: string;
|
|
31
|
+
response: PlatformChatCompletedResponse;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const PlatformChatStreamResponseCompletedType$inboundSchema:
|
|
36
|
+
z.ZodNativeEnum<typeof PlatformChatStreamResponseCompletedType> = z
|
|
37
|
+
.nativeEnum(PlatformChatStreamResponseCompletedType);
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const PlatformChatStreamResponseCompleted$inboundSchema: z.ZodType<
|
|
41
|
+
PlatformChatStreamResponseCompleted,
|
|
42
|
+
z.ZodTypeDef,
|
|
43
|
+
unknown
|
|
44
|
+
> = z.object({
|
|
45
|
+
type: PlatformChatStreamResponseCompletedType$inboundSchema,
|
|
46
|
+
response_id: z.string(),
|
|
47
|
+
response: PlatformChatCompletedResponse$inboundSchema,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export function platformChatStreamResponseCompletedFromJSON(
|
|
51
|
+
jsonString: string,
|
|
52
|
+
): SafeParseResult<PlatformChatStreamResponseCompleted, SDKValidationError> {
|
|
53
|
+
return safeParse(
|
|
54
|
+
jsonString,
|
|
55
|
+
(x) =>
|
|
56
|
+
PlatformChatStreamResponseCompleted$inboundSchema.parse(JSON.parse(x)),
|
|
57
|
+
`Failed to parse 'PlatformChatStreamResponseCompleted' from JSON`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: c836031cea7d
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
PlatformChatStreamResponseCompleted,
|
|
12
|
+
PlatformChatStreamResponseCompleted$inboundSchema,
|
|
13
|
+
} from "./platformchatstreamresponsecompleted.js";
|
|
14
|
+
|
|
15
|
+
export type PlatformChatStreamResponseCompletedServerSentEvent = {
|
|
16
|
+
id?: string | undefined;
|
|
17
|
+
event: "RESPONSE_COMPLETED";
|
|
18
|
+
data: PlatformChatStreamResponseCompleted;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const PlatformChatStreamResponseCompletedServerSentEvent$inboundSchema:
|
|
23
|
+
z.ZodType<
|
|
24
|
+
PlatformChatStreamResponseCompletedServerSentEvent,
|
|
25
|
+
z.ZodTypeDef,
|
|
26
|
+
unknown
|
|
27
|
+
> = z.object({
|
|
28
|
+
id: z.string().optional(),
|
|
29
|
+
event: z.literal("RESPONSE_COMPLETED"),
|
|
30
|
+
data: z.unknown().transform((v, ctx) => {
|
|
31
|
+
if (typeof v !== "string") return v;
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(v);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
36
|
+
return z.NEVER;
|
|
37
|
+
}
|
|
38
|
+
}).pipe(PlatformChatStreamResponseCompleted$inboundSchema),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function platformChatStreamResponseCompletedServerSentEventFromJSON(
|
|
42
|
+
jsonString: string,
|
|
43
|
+
): SafeParseResult<
|
|
44
|
+
PlatformChatStreamResponseCompletedServerSentEvent,
|
|
45
|
+
SDKValidationError
|
|
46
|
+
> {
|
|
47
|
+
return safeParse(
|
|
48
|
+
jsonString,
|
|
49
|
+
(x) =>
|
|
50
|
+
PlatformChatStreamResponseCompletedServerSentEvent$inboundSchema.parse(
|
|
51
|
+
JSON.parse(x),
|
|
52
|
+
),
|
|
53
|
+
`Failed to parse 'PlatformChatStreamResponseCompletedServerSentEvent' from JSON`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: e696c4aff75f
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export const PlatformChatStreamResponseCreatedType = {
|
|
13
|
+
ResponseCreated: "RESPONSE_CREATED",
|
|
14
|
+
} as const;
|
|
15
|
+
export type PlatformChatStreamResponseCreatedType = ClosedEnum<
|
|
16
|
+
typeof PlatformChatStreamResponseCreatedType
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export type PlatformChatStreamResponseCreated = {
|
|
20
|
+
type: PlatformChatStreamResponseCreatedType;
|
|
21
|
+
/**
|
|
22
|
+
* Platform-owned, non-persisted response envelope identifier in `resp_<uuid>` form. The same identifier is used for every event in one streamed response.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
*/
|
|
26
|
+
response_id: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const PlatformChatStreamResponseCreatedType$inboundSchema:
|
|
31
|
+
z.ZodNativeEnum<typeof PlatformChatStreamResponseCreatedType> = z.nativeEnum(
|
|
32
|
+
PlatformChatStreamResponseCreatedType,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const PlatformChatStreamResponseCreated$inboundSchema: z.ZodType<
|
|
37
|
+
PlatformChatStreamResponseCreated,
|
|
38
|
+
z.ZodTypeDef,
|
|
39
|
+
unknown
|
|
40
|
+
> = z.object({
|
|
41
|
+
type: PlatformChatStreamResponseCreatedType$inboundSchema,
|
|
42
|
+
response_id: z.string(),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export function platformChatStreamResponseCreatedFromJSON(
|
|
46
|
+
jsonString: string,
|
|
47
|
+
): SafeParseResult<PlatformChatStreamResponseCreated, SDKValidationError> {
|
|
48
|
+
return safeParse(
|
|
49
|
+
jsonString,
|
|
50
|
+
(x) => PlatformChatStreamResponseCreated$inboundSchema.parse(JSON.parse(x)),
|
|
51
|
+
`Failed to parse 'PlatformChatStreamResponseCreated' from JSON`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: eff9abd76433
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
PlatformChatStreamResponseCreated,
|
|
12
|
+
PlatformChatStreamResponseCreated$inboundSchema,
|
|
13
|
+
} from "./platformchatstreamresponsecreated.js";
|
|
14
|
+
|
|
15
|
+
export type PlatformChatStreamResponseCreatedServerSentEvent = {
|
|
16
|
+
id?: string | undefined;
|
|
17
|
+
event: "RESPONSE_CREATED";
|
|
18
|
+
data: PlatformChatStreamResponseCreated;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const PlatformChatStreamResponseCreatedServerSentEvent$inboundSchema:
|
|
23
|
+
z.ZodType<
|
|
24
|
+
PlatformChatStreamResponseCreatedServerSentEvent,
|
|
25
|
+
z.ZodTypeDef,
|
|
26
|
+
unknown
|
|
27
|
+
> = z.object({
|
|
28
|
+
id: z.string().optional(),
|
|
29
|
+
event: z.literal("RESPONSE_CREATED"),
|
|
30
|
+
data: z.unknown().transform((v, ctx) => {
|
|
31
|
+
if (typeof v !== "string") return v;
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(v);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
36
|
+
return z.NEVER;
|
|
37
|
+
}
|
|
38
|
+
}).pipe(PlatformChatStreamResponseCreated$inboundSchema),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function platformChatStreamResponseCreatedServerSentEventFromJSON(
|
|
42
|
+
jsonString: string,
|
|
43
|
+
): SafeParseResult<
|
|
44
|
+
PlatformChatStreamResponseCreatedServerSentEvent,
|
|
45
|
+
SDKValidationError
|
|
46
|
+
> {
|
|
47
|
+
return safeParse(
|
|
48
|
+
jsonString,
|
|
49
|
+
(x) =>
|
|
50
|
+
PlatformChatStreamResponseCreatedServerSentEvent$inboundSchema.parse(
|
|
51
|
+
JSON.parse(x),
|
|
52
|
+
),
|
|
53
|
+
`Failed to parse 'PlatformChatStreamResponseCreatedServerSentEvent' from JSON`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 710179349337
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
import {
|
|
12
|
+
PlatformChatFailedResponse,
|
|
13
|
+
PlatformChatFailedResponse$inboundSchema,
|
|
14
|
+
} from "./platformchatfailedresponse.js";
|
|
15
|
+
|
|
16
|
+
export const PlatformChatStreamResponseFailedType = {
|
|
17
|
+
ResponseFailed: "RESPONSE_FAILED",
|
|
18
|
+
} as const;
|
|
19
|
+
export type PlatformChatStreamResponseFailedType = ClosedEnum<
|
|
20
|
+
typeof PlatformChatStreamResponseFailedType
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
export type PlatformChatStreamResponseFailed = {
|
|
24
|
+
type: PlatformChatStreamResponseFailedType;
|
|
25
|
+
/**
|
|
26
|
+
* Platform-owned, non-persisted response envelope identifier in `resp_<uuid>` form. The same identifier is used for every event in one streamed response.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
*/
|
|
30
|
+
response_id: string;
|
|
31
|
+
response: PlatformChatFailedResponse;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const PlatformChatStreamResponseFailedType$inboundSchema:
|
|
36
|
+
z.ZodNativeEnum<typeof PlatformChatStreamResponseFailedType> = z.nativeEnum(
|
|
37
|
+
PlatformChatStreamResponseFailedType,
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const PlatformChatStreamResponseFailed$inboundSchema: z.ZodType<
|
|
42
|
+
PlatformChatStreamResponseFailed,
|
|
43
|
+
z.ZodTypeDef,
|
|
44
|
+
unknown
|
|
45
|
+
> = z.object({
|
|
46
|
+
type: PlatformChatStreamResponseFailedType$inboundSchema,
|
|
47
|
+
response_id: z.string(),
|
|
48
|
+
response: PlatformChatFailedResponse$inboundSchema,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export function platformChatStreamResponseFailedFromJSON(
|
|
52
|
+
jsonString: string,
|
|
53
|
+
): SafeParseResult<PlatformChatStreamResponseFailed, SDKValidationError> {
|
|
54
|
+
return safeParse(
|
|
55
|
+
jsonString,
|
|
56
|
+
(x) => PlatformChatStreamResponseFailed$inboundSchema.parse(JSON.parse(x)),
|
|
57
|
+
`Failed to parse 'PlatformChatStreamResponseFailed' from JSON`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: bd824a2d14c5
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
PlatformChatStreamResponseFailed,
|
|
12
|
+
PlatformChatStreamResponseFailed$inboundSchema,
|
|
13
|
+
} from "./platformchatstreamresponsefailed.js";
|
|
14
|
+
|
|
15
|
+
export type PlatformChatStreamResponseFailedServerSentEvent = {
|
|
16
|
+
id?: string | undefined;
|
|
17
|
+
event: "RESPONSE_FAILED";
|
|
18
|
+
data: PlatformChatStreamResponseFailed;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const PlatformChatStreamResponseFailedServerSentEvent$inboundSchema:
|
|
23
|
+
z.ZodType<
|
|
24
|
+
PlatformChatStreamResponseFailedServerSentEvent,
|
|
25
|
+
z.ZodTypeDef,
|
|
26
|
+
unknown
|
|
27
|
+
> = z.object({
|
|
28
|
+
id: z.string().optional(),
|
|
29
|
+
event: z.literal("RESPONSE_FAILED"),
|
|
30
|
+
data: z.unknown().transform((v, ctx) => {
|
|
31
|
+
if (typeof v !== "string") return v;
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(v);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
36
|
+
return z.NEVER;
|
|
37
|
+
}
|
|
38
|
+
}).pipe(PlatformChatStreamResponseFailed$inboundSchema),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function platformChatStreamResponseFailedServerSentEventFromJSON(
|
|
42
|
+
jsonString: string,
|
|
43
|
+
): SafeParseResult<
|
|
44
|
+
PlatformChatStreamResponseFailedServerSentEvent,
|
|
45
|
+
SDKValidationError
|
|
46
|
+
> {
|
|
47
|
+
return safeParse(
|
|
48
|
+
jsonString,
|
|
49
|
+
(x) =>
|
|
50
|
+
PlatformChatStreamResponseFailedServerSentEvent$inboundSchema.parse(
|
|
51
|
+
JSON.parse(x),
|
|
52
|
+
),
|
|
53
|
+
`Failed to parse 'PlatformChatStreamResponseFailedServerSentEvent' from JSON`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -78,6 +78,7 @@ export * from "./platformagentscreaterun.js";
|
|
|
78
78
|
export * from "./platformagentsget.js";
|
|
79
79
|
export * from "./platformagentsgetschemas.js";
|
|
80
80
|
export * from "./platformchatcreate.js";
|
|
81
|
+
export * from "./platformchatcreatestream.js";
|
|
81
82
|
export * from "./platformsearchfilters.js";
|
|
82
83
|
export * from "./platformskillscreateversion.js";
|
|
83
84
|
export * from "./platformskillsdelete.js";
|
|
@@ -4,31 +4,89 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import * as z from "zod/v3";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
7
|
import * as components from "../components/index.js";
|
|
10
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
*/
|
|
14
|
+
export type PlatformChatCreateInput =
|
|
15
|
+
| string
|
|
16
|
+
| Array<components.PlatformChatInputMessage>;
|
|
17
|
+
|
|
18
|
+
export type PlatformChatCreateRequest = {
|
|
19
|
+
/**
|
|
20
|
+
* Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
*/
|
|
24
|
+
input: string | Array<components.PlatformChatInputMessage>;
|
|
25
|
+
stream?: false | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
*/
|
|
31
|
+
store?: boolean | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
*/
|
|
37
|
+
conversation_id?: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export type PlatformChatCreateInput$Outbound =
|
|
42
|
+
| string
|
|
43
|
+
| Array<components.PlatformChatInputMessage$Outbound>;
|
|
15
44
|
|
|
16
45
|
/** @internal */
|
|
17
|
-
export const
|
|
18
|
-
|
|
46
|
+
export const PlatformChatCreateInput$outboundSchema: z.ZodType<
|
|
47
|
+
PlatformChatCreateInput$Outbound,
|
|
19
48
|
z.ZodTypeDef,
|
|
20
|
-
|
|
49
|
+
PlatformChatCreateInput
|
|
21
50
|
> = z.union([
|
|
22
|
-
components.PlatformChatCompletedResponse$inboundSchema,
|
|
23
51
|
z.string(),
|
|
52
|
+
z.array(components.PlatformChatInputMessage$outboundSchema),
|
|
24
53
|
]);
|
|
25
54
|
|
|
26
|
-
export function
|
|
27
|
-
|
|
28
|
-
):
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
55
|
+
export function platformChatCreateInputToJSON(
|
|
56
|
+
platformChatCreateInput: PlatformChatCreateInput,
|
|
57
|
+
): string {
|
|
58
|
+
return JSON.stringify(
|
|
59
|
+
PlatformChatCreateInput$outboundSchema.parse(platformChatCreateInput),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export type PlatformChatCreateRequest$Outbound = {
|
|
65
|
+
input: string | Array<components.PlatformChatInputMessage$Outbound>;
|
|
66
|
+
stream: false;
|
|
67
|
+
store: boolean;
|
|
68
|
+
conversation_id?: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const PlatformChatCreateRequest$outboundSchema: z.ZodType<
|
|
73
|
+
PlatformChatCreateRequest$Outbound,
|
|
74
|
+
z.ZodTypeDef,
|
|
75
|
+
PlatformChatCreateRequest
|
|
76
|
+
> = z.object({
|
|
77
|
+
input: z.union([
|
|
78
|
+
z.string(),
|
|
79
|
+
z.array(components.PlatformChatInputMessage$outboundSchema),
|
|
80
|
+
]),
|
|
81
|
+
stream: z.literal(false).default(false as const),
|
|
82
|
+
store: z.boolean().default(true),
|
|
83
|
+
conversation_id: z.string().optional(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export function platformChatCreateRequestToJSON(
|
|
87
|
+
platformChatCreateRequest: PlatformChatCreateRequest,
|
|
88
|
+
): string {
|
|
89
|
+
return JSON.stringify(
|
|
90
|
+
PlatformChatCreateRequest$outboundSchema.parse(platformChatCreateRequest),
|
|
33
91
|
);
|
|
34
92
|
}
|