@orq-ai/node 4.1.0-rc.4 → 4.1.0-rc.5
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/bin/mcp-server.js +25494 -27422
- package/bin/mcp-server.js.map +64 -47
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.js +1 -1
- package/models/components/actionreviewedstreamingevent.d.ts +76 -0
- package/models/components/actionreviewedstreamingevent.d.ts.map +1 -0
- package/models/components/actionreviewedstreamingevent.js +127 -0
- package/models/components/actionreviewedstreamingevent.js.map +1 -0
- package/models/components/actionreviewrequestedstreamingevent.d.ts +135 -0
- package/models/components/actionreviewrequestedstreamingevent.d.ts.map +1 -0
- package/models/components/actionreviewrequestedstreamingevent.js +180 -0
- package/models/components/actionreviewrequestedstreamingevent.js.map +1 -0
- package/models/components/agenterroredstreamingevent.d.ts +58 -0
- package/models/components/agenterroredstreamingevent.d.ts.map +1 -0
- package/models/components/agenterroredstreamingevent.js +91 -0
- package/models/components/agenterroredstreamingevent.js.map +1 -0
- package/models/components/agentexecutionstartedstreamingevent.d.ts +62 -0
- package/models/components/agentexecutionstartedstreamingevent.d.ts.map +1 -0
- package/models/components/agentexecutionstartedstreamingevent.js +103 -0
- package/models/components/agentexecutionstartedstreamingevent.js.map +1 -0
- package/models/components/agenthandedoffstreamingevent.d.ts +51 -0
- package/models/components/agenthandedoffstreamingevent.d.ts.map +1 -0
- package/models/components/agenthandedoffstreamingevent.js +96 -0
- package/models/components/agenthandedoffstreamingevent.js.map +1 -0
- package/models/components/agentinactivestreamingevent.d.ts +309 -0
- package/models/components/agentinactivestreamingevent.d.ts.map +1 -0
- package/models/components/agentinactivestreamingevent.js +385 -0
- package/models/components/agentinactivestreamingevent.js.map +1 -0
- package/models/components/agentmessagecreatedstreamingevent.d.ts +141 -0
- package/models/components/agentmessagecreatedstreamingevent.d.ts.map +1 -0
- package/models/components/agentmessagecreatedstreamingevent.js +190 -0
- package/models/components/agentmessagecreatedstreamingevent.js.map +1 -0
- package/models/components/agentstartedstreamingevent.d.ts +382 -0
- package/models/components/agentstartedstreamingevent.d.ts.map +1 -0
- package/models/components/agentstartedstreamingevent.js +441 -0
- package/models/components/agentstartedstreamingevent.js.map +1 -0
- package/models/components/agentthoughtstreamingevent.d.ts +542 -0
- package/models/components/agentthoughtstreamingevent.d.ts.map +1 -0
- package/models/components/agentthoughtstreamingevent.js +626 -0
- package/models/components/agentthoughtstreamingevent.js.map +1 -0
- package/models/components/errorstreamingevent.d.ts +51 -0
- package/models/components/errorstreamingevent.d.ts.map +1 -0
- package/models/components/errorstreamingevent.js +87 -0
- package/models/components/errorstreamingevent.js.map +1 -0
- package/models/components/executionnamedstreamingevent.d.ts +51 -0
- package/models/components/executionnamedstreamingevent.d.ts.map +1 -0
- package/models/components/executionnamedstreamingevent.js +96 -0
- package/models/components/executionnamedstreamingevent.js.map +1 -0
- package/models/components/executionreviewedstreamingevent.d.ts +45 -0
- package/models/components/executionreviewedstreamingevent.d.ts.map +1 -0
- package/models/components/executionreviewedstreamingevent.js +81 -0
- package/models/components/executionreviewedstreamingevent.js.map +1 -0
- package/models/components/executionreviewrequiredstreamingevent.d.ts +45 -0
- package/models/components/executionreviewrequiredstreamingevent.d.ts.map +1 -0
- package/models/components/executionreviewrequiredstreamingevent.js +82 -0
- package/models/components/executionreviewrequiredstreamingevent.js.map +1 -0
- package/models/components/filepart.d.ts +1 -1
- package/models/components/index.d.ts +17 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +17 -0
- package/models/components/index.js.map +1 -1
- package/models/components/invokedeploymentrequest.d.ts +13 -13
- package/models/components/invokedeploymentrequest.d.ts.map +1 -1
- package/models/components/invokedeploymentrequest.js +17 -17
- package/models/components/invokedeploymentrequest.js.map +1 -1
- package/models/components/timeoutstreamingevent.d.ts +49 -0
- package/models/components/timeoutstreamingevent.d.ts.map +1 -0
- package/models/components/timeoutstreamingevent.js +85 -0
- package/models/components/timeoutstreamingevent.js.map +1 -0
- package/models/components/toolexecutionfailedstreamingevent.d.ts +144 -0
- package/models/components/toolexecutionfailedstreamingevent.d.ts.map +1 -0
- package/models/components/toolexecutionfailedstreamingevent.js +223 -0
- package/models/components/toolexecutionfailedstreamingevent.js.map +1 -0
- package/models/components/toolexecutionfinishedstreamingevent.d.ts +129 -0
- package/models/components/toolexecutionfinishedstreamingevent.d.ts.map +1 -0
- package/models/components/toolexecutionfinishedstreamingevent.js +205 -0
- package/models/components/toolexecutionfinishedstreamingevent.js.map +1 -0
- package/models/components/toolexecutionstartedstreamingevent.d.ts +139 -0
- package/models/components/toolexecutionstartedstreamingevent.d.ts.map +1 -0
- package/models/components/toolexecutionstartedstreamingevent.js +217 -0
- package/models/components/toolexecutionstartedstreamingevent.js.map +1 -0
- package/models/components/toolresultpart.d.ts +1 -1
- package/models/operations/createagentresponserequest.d.ts +4 -137
- package/models/operations/createagentresponserequest.d.ts.map +1 -1
- package/models/operations/createagentresponserequest.js +9 -138
- package/models/operations/createagentresponserequest.js.map +1 -1
- package/models/operations/createbudget.js +2 -2
- package/models/operations/createcontact.js +2 -2
- package/models/operations/createdataset.js +2 -2
- package/models/operations/createdatasetitem.js +8 -8
- package/models/operations/createdatasource.js +2 -2
- package/models/operations/createeval.d.ts +80 -145
- package/models/operations/createeval.d.ts.map +1 -1
- package/models/operations/createeval.js +190 -266
- package/models/operations/createeval.js.map +1 -1
- package/models/operations/createtool.js +12 -12
- package/models/operations/fileget.js +2 -2
- package/models/operations/filelist.js +2 -2
- package/models/operations/fileupload.js +2 -2
- package/models/operations/getalltools.js +12 -12
- package/models/operations/getbudget.js +2 -2
- package/models/operations/getevals.d.ts +14 -79
- package/models/operations/getevals.d.ts.map +1 -1
- package/models/operations/getevals.js +49 -132
- package/models/operations/getevals.js.map +1 -1
- package/models/operations/invokeagent.d.ts +14 -147
- package/models/operations/invokeagent.d.ts.map +1 -1
- package/models/operations/invokeagent.js +19 -148
- package/models/operations/invokeagent.js.map +1 -1
- package/models/operations/listbudgets.js +2 -2
- package/models/operations/listcontacts.js +2 -2
- package/models/operations/listdatasetdatapoints.js +8 -8
- package/models/operations/listdatasets.js +2 -2
- package/models/operations/listdatasources.js +2 -2
- package/models/operations/listknowledgebases.d.ts +16 -16
- package/models/operations/listknowledgebases.d.ts.map +1 -1
- package/models/operations/listknowledgebases.js +27 -25
- package/models/operations/listknowledgebases.js.map +1 -1
- package/models/operations/retrievecontact.js +2 -2
- package/models/operations/retrievedatapoint.js +8 -8
- package/models/operations/retrievedataset.js +2 -2
- package/models/operations/retrievedatasource.js +2 -2
- package/models/operations/retrievetool.js +12 -12
- package/models/operations/runagent.d.ts +4 -137
- package/models/operations/runagent.d.ts.map +1 -1
- package/models/operations/runagent.js +17 -145
- package/models/operations/runagent.js.map +1 -1
- package/models/operations/streamagent.d.ts +241 -2491
- package/models/operations/streamagent.d.ts.map +1 -1
- package/models/operations/streamagent.js +172 -2826
- package/models/operations/streamagent.js.map +1 -1
- package/models/operations/streamrunagent.d.ts +889 -3139
- package/models/operations/streamrunagent.d.ts.map +1 -1
- package/models/operations/streamrunagent.js +175 -2825
- package/models/operations/streamrunagent.js.map +1 -1
- package/models/operations/updatebudget.js +2 -2
- package/models/operations/updatecontact.js +2 -2
- package/models/operations/updatedatapoint.js +8 -8
- package/models/operations/updatedataset.js +2 -2
- package/models/operations/updatedatasource.js +2 -2
- package/models/operations/updateeval.d.ts +14 -79
- package/models/operations/updateeval.d.ts.map +1 -1
- package/models/operations/updateeval.js +51 -134
- package/models/operations/updateeval.js.map +1 -1
- package/models/operations/updatetool.js +14 -14
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/components/actionreviewedstreamingevent.ts +189 -0
- package/src/models/components/actionreviewrequestedstreamingevent.ts +326 -0
- package/src/models/components/agenterroredstreamingevent.ts +142 -0
- package/src/models/components/agentexecutionstartedstreamingevent.ts +145 -0
- package/src/models/components/agenthandedoffstreamingevent.ts +142 -0
- package/src/models/components/agentinactivestreamingevent.ts +857 -0
- package/src/models/components/agentmessagecreatedstreamingevent.ts +396 -0
- package/src/models/components/agentstartedstreamingevent.ts +909 -0
- package/src/models/components/agentthoughtstreamingevent.ts +1419 -0
- package/src/models/components/errorstreamingevent.ts +129 -0
- package/src/models/components/executionnamedstreamingevent.ts +142 -0
- package/src/models/components/executionreviewedstreamingevent.ts +122 -0
- package/src/models/components/executionreviewrequiredstreamingevent.ts +130 -0
- package/src/models/components/filepart.ts +1 -1
- package/src/models/components/index.ts +17 -0
- package/src/models/components/invokedeploymentrequest.ts +32 -27
- package/src/models/components/timeoutstreamingevent.ts +125 -0
- package/src/models/components/toolexecutionfailedstreamingevent.ts +406 -0
- package/src/models/components/toolexecutionfinishedstreamingevent.ts +373 -0
- package/src/models/components/toolexecutionstartedstreamingevent.ts +350 -0
- package/src/models/components/toolresultpart.ts +1 -1
- package/src/models/operations/createagentresponserequest.ts +20 -321
- package/src/models/operations/createbudget.ts +2 -2
- package/src/models/operations/createcontact.ts +2 -2
- package/src/models/operations/createdataset.ts +2 -2
- package/src/models/operations/createdatasetitem.ts +8 -8
- package/src/models/operations/createdatasource.ts +2 -2
- package/src/models/operations/createeval.ts +318 -615
- package/src/models/operations/createtool.ts +12 -12
- package/src/models/operations/fileget.ts +2 -2
- package/src/models/operations/filelist.ts +2 -2
- package/src/models/operations/fileupload.ts +2 -2
- package/src/models/operations/getalltools.ts +12 -12
- package/src/models/operations/getbudget.ts +2 -2
- package/src/models/operations/getevals.ts +52 -287
- package/src/models/operations/invokeagent.ts +36 -373
- package/src/models/operations/listbudgets.ts +2 -2
- package/src/models/operations/listcontacts.ts +2 -2
- package/src/models/operations/listdatasetdatapoints.ts +8 -8
- package/src/models/operations/listdatasets.ts +2 -2
- package/src/models/operations/listdatasources.ts +2 -2
- package/src/models/operations/listknowledgebases.ts +82 -102
- package/src/models/operations/retrievecontact.ts +2 -2
- package/src/models/operations/retrievedatapoint.ts +8 -8
- package/src/models/operations/retrievedataset.ts +2 -2
- package/src/models/operations/retrievedatasource.ts +2 -2
- package/src/models/operations/retrievetool.ts +12 -12
- package/src/models/operations/runagent.ts +17 -365
- package/src/models/operations/streamagent.ts +794 -6985
- package/src/models/operations/streamrunagent.ts +3939 -9983
- package/src/models/operations/updatebudget.ts +2 -2
- package/src/models/operations/updatecontact.ts +2 -2
- package/src/models/operations/updatedatapoint.ts +8 -8
- package/src/models/operations/updatedataset.ts +2 -2
- package/src/models/operations/updatedatasource.ts +2 -2
- package/src/models/operations/updateeval.ts +52 -287
- package/src/models/operations/updatetool.ts +14 -14
|
@@ -0,0 +1,1419 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
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
|
+
DataPart,
|
|
13
|
+
DataPart$inboundSchema,
|
|
14
|
+
DataPart$Outbound,
|
|
15
|
+
DataPart$outboundSchema,
|
|
16
|
+
} from "./datapart.js";
|
|
17
|
+
import {
|
|
18
|
+
FilePart,
|
|
19
|
+
FilePart$inboundSchema,
|
|
20
|
+
FilePart$Outbound,
|
|
21
|
+
FilePart$outboundSchema,
|
|
22
|
+
} from "./filepart.js";
|
|
23
|
+
import {
|
|
24
|
+
TextPart,
|
|
25
|
+
TextPart$inboundSchema,
|
|
26
|
+
TextPart$Outbound,
|
|
27
|
+
TextPart$outboundSchema,
|
|
28
|
+
} from "./textpart.js";
|
|
29
|
+
import {
|
|
30
|
+
ToolCallPart,
|
|
31
|
+
ToolCallPart$inboundSchema,
|
|
32
|
+
ToolCallPart$Outbound,
|
|
33
|
+
ToolCallPart$outboundSchema,
|
|
34
|
+
} from "./toolcallpart.js";
|
|
35
|
+
import {
|
|
36
|
+
ToolResultPart,
|
|
37
|
+
ToolResultPart$inboundSchema,
|
|
38
|
+
ToolResultPart$Outbound,
|
|
39
|
+
ToolResultPart$outboundSchema,
|
|
40
|
+
} from "./toolresultpart.js";
|
|
41
|
+
|
|
42
|
+
export const AgentThoughtStreamingEventType = {
|
|
43
|
+
EventAgentsThought: "event.agents.thought",
|
|
44
|
+
} as const;
|
|
45
|
+
export type AgentThoughtStreamingEventType = ClosedEnum<
|
|
46
|
+
typeof AgentThoughtStreamingEventType
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
export const AgentThoughtStreamingEventRole = {
|
|
50
|
+
User: "user",
|
|
51
|
+
Agent: "agent",
|
|
52
|
+
Tool: "tool",
|
|
53
|
+
System: "system",
|
|
54
|
+
} as const;
|
|
55
|
+
export type AgentThoughtStreamingEventRole = ClosedEnum<
|
|
56
|
+
typeof AgentThoughtStreamingEventRole
|
|
57
|
+
>;
|
|
58
|
+
|
|
59
|
+
export type AgentThoughtStreamingEventParts =
|
|
60
|
+
| (ToolCallPart & { kind: "tool_call" })
|
|
61
|
+
| (TextPart & { kind: "text" })
|
|
62
|
+
| (DataPart & { kind: "data" })
|
|
63
|
+
| (FilePart & { kind: "file" })
|
|
64
|
+
| (ToolResultPart & { kind: "tool_result" });
|
|
65
|
+
|
|
66
|
+
export type MessageDifference = {
|
|
67
|
+
messageId: string;
|
|
68
|
+
role: AgentThoughtStreamingEventRole;
|
|
69
|
+
parts: Array<
|
|
70
|
+
| (ToolCallPart & { kind: "tool_call" })
|
|
71
|
+
| (TextPart & { kind: "text" })
|
|
72
|
+
| (DataPart & { kind: "data" })
|
|
73
|
+
| (FilePart & { kind: "file" })
|
|
74
|
+
| (ToolResultPart & { kind: "tool_result" })
|
|
75
|
+
>;
|
|
76
|
+
metadata?: { [k: string]: any } | undefined;
|
|
77
|
+
agentId: string;
|
|
78
|
+
agentExecutionId: string;
|
|
79
|
+
workspaceId: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The reason the model stopped generating tokens.
|
|
84
|
+
*/
|
|
85
|
+
export const AgentThoughtStreamingEventFinishReason = {
|
|
86
|
+
Stop: "stop",
|
|
87
|
+
Length: "length",
|
|
88
|
+
ToolCalls: "tool_calls",
|
|
89
|
+
ContentFilter: "content_filter",
|
|
90
|
+
FunctionCall: "function_call",
|
|
91
|
+
} as const;
|
|
92
|
+
/**
|
|
93
|
+
* The reason the model stopped generating tokens.
|
|
94
|
+
*/
|
|
95
|
+
export type AgentThoughtStreamingEventFinishReason = ClosedEnum<
|
|
96
|
+
typeof AgentThoughtStreamingEventFinishReason
|
|
97
|
+
>;
|
|
98
|
+
|
|
99
|
+
export const AgentThoughtStreamingEventDataType = {
|
|
100
|
+
Function: "function",
|
|
101
|
+
} as const;
|
|
102
|
+
export type AgentThoughtStreamingEventDataType = ClosedEnum<
|
|
103
|
+
typeof AgentThoughtStreamingEventDataType
|
|
104
|
+
>;
|
|
105
|
+
|
|
106
|
+
export type AgentThoughtStreamingEventFunction = {
|
|
107
|
+
/**
|
|
108
|
+
* The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
|
|
109
|
+
*/
|
|
110
|
+
name?: string | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
|
|
113
|
+
*/
|
|
114
|
+
arguments?: string | undefined;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type AgentThoughtStreamingEventToolCalls = {
|
|
118
|
+
id?: string | undefined;
|
|
119
|
+
type?: AgentThoughtStreamingEventDataType | undefined;
|
|
120
|
+
function?: AgentThoughtStreamingEventFunction | undefined;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const AgentThoughtStreamingEventDataRole = {
|
|
124
|
+
Assistant: "assistant",
|
|
125
|
+
} as const;
|
|
126
|
+
export type AgentThoughtStreamingEventDataRole = ClosedEnum<
|
|
127
|
+
typeof AgentThoughtStreamingEventDataRole
|
|
128
|
+
>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* If the audio output modality is requested, this object contains data about the audio response from the model.
|
|
132
|
+
*/
|
|
133
|
+
export type AgentThoughtStreamingEventAudio = {
|
|
134
|
+
id: string;
|
|
135
|
+
expiresAt: number;
|
|
136
|
+
data: string;
|
|
137
|
+
transcript: string;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A chat completion message generated by the model.
|
|
142
|
+
*/
|
|
143
|
+
export type AgentThoughtStreamingEventMessage = {
|
|
144
|
+
content?: string | null | undefined;
|
|
145
|
+
refusal?: string | null | undefined;
|
|
146
|
+
toolCalls?: Array<AgentThoughtStreamingEventToolCalls> | undefined;
|
|
147
|
+
role?: AgentThoughtStreamingEventDataRole | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Internal thought process of the model
|
|
150
|
+
*/
|
|
151
|
+
reasoning?: string | null | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* The signature holds a cryptographic token which verifies that the thinking block was generated by the model, and is verified when thinking is part of a multiturn conversation. This value should not be modified and should always be sent to the API when the reasoning is redacted. Currently only supported by `Anthropic`.
|
|
154
|
+
*/
|
|
155
|
+
reasoningSignature?: string | null | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Occasionally the model's internal reasoning will be flagged by the safety systems of the provider. When this occurs, the provider will encrypt the reasoning. These redacted reasoning is decrypted when passed back to the API, allowing the model to continue its response without losing context.
|
|
158
|
+
*/
|
|
159
|
+
redactedReasoning?: string | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* If the audio output modality is requested, this object contains data about the audio response from the model.
|
|
162
|
+
*/
|
|
163
|
+
audio?: AgentThoughtStreamingEventAudio | null | undefined;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export type TopLogprobs = {
|
|
167
|
+
/**
|
|
168
|
+
* The token.
|
|
169
|
+
*/
|
|
170
|
+
token: string;
|
|
171
|
+
/**
|
|
172
|
+
* The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.
|
|
173
|
+
*/
|
|
174
|
+
logprob: number;
|
|
175
|
+
/**
|
|
176
|
+
* A list of integers representing the UTF-8 bytes representation of the token.
|
|
177
|
+
*/
|
|
178
|
+
bytes: Array<number> | null;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type AgentThoughtStreamingEventContent = {
|
|
182
|
+
/**
|
|
183
|
+
* The token.
|
|
184
|
+
*/
|
|
185
|
+
token: string;
|
|
186
|
+
/**
|
|
187
|
+
* The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.
|
|
188
|
+
*/
|
|
189
|
+
logprob: number;
|
|
190
|
+
/**
|
|
191
|
+
* A list of integers representing the UTF-8 bytes representation of the token.
|
|
192
|
+
*/
|
|
193
|
+
bytes: Array<number> | null;
|
|
194
|
+
/**
|
|
195
|
+
* List of the most likely tokens and their log probability, at this token position.
|
|
196
|
+
*/
|
|
197
|
+
topLogprobs: Array<TopLogprobs>;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export type AgentThoughtStreamingEventTopLogprobs = {
|
|
201
|
+
/**
|
|
202
|
+
* The token.
|
|
203
|
+
*/
|
|
204
|
+
token: string;
|
|
205
|
+
/**
|
|
206
|
+
* The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.
|
|
207
|
+
*/
|
|
208
|
+
logprob: number;
|
|
209
|
+
/**
|
|
210
|
+
* A list of integers representing the UTF-8 bytes representation of the token.
|
|
211
|
+
*/
|
|
212
|
+
bytes: Array<number> | null;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export type Refusal = {
|
|
216
|
+
/**
|
|
217
|
+
* The token.
|
|
218
|
+
*/
|
|
219
|
+
token: string;
|
|
220
|
+
/**
|
|
221
|
+
* The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.
|
|
222
|
+
*/
|
|
223
|
+
logprob: number;
|
|
224
|
+
/**
|
|
225
|
+
* A list of integers representing the UTF-8 bytes representation of the token.
|
|
226
|
+
*/
|
|
227
|
+
bytes: Array<number> | null;
|
|
228
|
+
/**
|
|
229
|
+
* List of the most likely tokens and their log probability, at this token position.
|
|
230
|
+
*/
|
|
231
|
+
topLogprobs: Array<AgentThoughtStreamingEventTopLogprobs>;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Log probability information for the choice.
|
|
236
|
+
*/
|
|
237
|
+
export type Logprobs = {
|
|
238
|
+
/**
|
|
239
|
+
* A list of message content tokens with log probability information.
|
|
240
|
+
*/
|
|
241
|
+
content: Array<AgentThoughtStreamingEventContent> | null;
|
|
242
|
+
/**
|
|
243
|
+
* A list of message refusal tokens with log probability information.
|
|
244
|
+
*/
|
|
245
|
+
refusal: Array<Refusal> | null;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export type Choice = {
|
|
249
|
+
/**
|
|
250
|
+
* The reason the model stopped generating tokens.
|
|
251
|
+
*/
|
|
252
|
+
finishReason: AgentThoughtStreamingEventFinishReason | null;
|
|
253
|
+
/**
|
|
254
|
+
* The index of the choice in the list of choices.
|
|
255
|
+
*/
|
|
256
|
+
index?: number | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* A chat completion message generated by the model.
|
|
259
|
+
*/
|
|
260
|
+
message: AgentThoughtStreamingEventMessage;
|
|
261
|
+
/**
|
|
262
|
+
* Log probability information for the choice.
|
|
263
|
+
*/
|
|
264
|
+
logprobs?: Logprobs | null | undefined;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export type PromptTokensDetails = {
|
|
268
|
+
cachedTokens?: number | null | undefined;
|
|
269
|
+
/**
|
|
270
|
+
* The number of audio input tokens consumed by the request.
|
|
271
|
+
*/
|
|
272
|
+
audioTokens?: number | null | undefined;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export type CompletionTokensDetails = {
|
|
276
|
+
reasoningTokens?: number | null | undefined;
|
|
277
|
+
acceptedPredictionTokens?: number | null | undefined;
|
|
278
|
+
rejectedPredictionTokens?: number | null | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* The number of audio output tokens produced by the response.
|
|
281
|
+
*/
|
|
282
|
+
audioTokens?: number | null | undefined;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Usage statistics for the completion request.
|
|
287
|
+
*/
|
|
288
|
+
export type Usage = {
|
|
289
|
+
/**
|
|
290
|
+
* Number of tokens in the generated completion.
|
|
291
|
+
*/
|
|
292
|
+
completionTokens?: number | undefined;
|
|
293
|
+
/**
|
|
294
|
+
* Number of tokens in the prompt.
|
|
295
|
+
*/
|
|
296
|
+
promptTokens?: number | undefined;
|
|
297
|
+
/**
|
|
298
|
+
* Total number of tokens used in the request (prompt + completion).
|
|
299
|
+
*/
|
|
300
|
+
totalTokens?: number | undefined;
|
|
301
|
+
promptTokensDetails?: PromptTokensDetails | null | undefined;
|
|
302
|
+
completionTokensDetails?: CompletionTokensDetails | null | undefined;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export type AgentThoughtStreamingEventData = {
|
|
306
|
+
agentId: string;
|
|
307
|
+
messageDifference: { [k: string]: MessageDifference };
|
|
308
|
+
choice?: Choice | undefined;
|
|
309
|
+
choiceIndex?: number | undefined;
|
|
310
|
+
iteration: number;
|
|
311
|
+
accumulatedExecutionTime: number;
|
|
312
|
+
responseId?: string | undefined;
|
|
313
|
+
/**
|
|
314
|
+
* Usage statistics for the completion request.
|
|
315
|
+
*/
|
|
316
|
+
usage?: Usage | undefined;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Emitted during agent reasoning. Contains the incremental message changes, model choices, iteration count, and token usage for this processing step.
|
|
321
|
+
*/
|
|
322
|
+
export type AgentThoughtStreamingEvent = {
|
|
323
|
+
type: AgentThoughtStreamingEventType;
|
|
324
|
+
/**
|
|
325
|
+
* ISO timestamp of the event
|
|
326
|
+
*/
|
|
327
|
+
timestamp: string;
|
|
328
|
+
data: AgentThoughtStreamingEventData;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/** @internal */
|
|
332
|
+
export const AgentThoughtStreamingEventType$inboundSchema: z.ZodNativeEnum<
|
|
333
|
+
typeof AgentThoughtStreamingEventType
|
|
334
|
+
> = z.nativeEnum(AgentThoughtStreamingEventType);
|
|
335
|
+
/** @internal */
|
|
336
|
+
export const AgentThoughtStreamingEventType$outboundSchema: z.ZodNativeEnum<
|
|
337
|
+
typeof AgentThoughtStreamingEventType
|
|
338
|
+
> = AgentThoughtStreamingEventType$inboundSchema;
|
|
339
|
+
|
|
340
|
+
/** @internal */
|
|
341
|
+
export const AgentThoughtStreamingEventRole$inboundSchema: z.ZodNativeEnum<
|
|
342
|
+
typeof AgentThoughtStreamingEventRole
|
|
343
|
+
> = z.nativeEnum(AgentThoughtStreamingEventRole);
|
|
344
|
+
/** @internal */
|
|
345
|
+
export const AgentThoughtStreamingEventRole$outboundSchema: z.ZodNativeEnum<
|
|
346
|
+
typeof AgentThoughtStreamingEventRole
|
|
347
|
+
> = AgentThoughtStreamingEventRole$inboundSchema;
|
|
348
|
+
|
|
349
|
+
/** @internal */
|
|
350
|
+
export const AgentThoughtStreamingEventParts$inboundSchema: z.ZodType<
|
|
351
|
+
AgentThoughtStreamingEventParts,
|
|
352
|
+
z.ZodTypeDef,
|
|
353
|
+
unknown
|
|
354
|
+
> = z.union([
|
|
355
|
+
ToolCallPart$inboundSchema.and(
|
|
356
|
+
z.object({ kind: z.literal("tool_call") }).transform((v) => ({
|
|
357
|
+
kind: v.kind,
|
|
358
|
+
})),
|
|
359
|
+
),
|
|
360
|
+
TextPart$inboundSchema.and(
|
|
361
|
+
z.object({ kind: z.literal("text") }).transform((v) => ({ kind: v.kind })),
|
|
362
|
+
),
|
|
363
|
+
DataPart$inboundSchema.and(
|
|
364
|
+
z.object({ kind: z.literal("data") }).transform((v) => ({ kind: v.kind })),
|
|
365
|
+
),
|
|
366
|
+
FilePart$inboundSchema.and(
|
|
367
|
+
z.object({ kind: z.literal("file") }).transform((v) => ({ kind: v.kind })),
|
|
368
|
+
),
|
|
369
|
+
ToolResultPart$inboundSchema.and(
|
|
370
|
+
z.object({ kind: z.literal("tool_result") }).transform((v) => ({
|
|
371
|
+
kind: v.kind,
|
|
372
|
+
})),
|
|
373
|
+
),
|
|
374
|
+
]);
|
|
375
|
+
/** @internal */
|
|
376
|
+
export type AgentThoughtStreamingEventParts$Outbound =
|
|
377
|
+
| (ToolCallPart$Outbound & { kind: "tool_call" })
|
|
378
|
+
| (TextPart$Outbound & { kind: "text" })
|
|
379
|
+
| (DataPart$Outbound & { kind: "data" })
|
|
380
|
+
| (FilePart$Outbound & { kind: "file" })
|
|
381
|
+
| (ToolResultPart$Outbound & { kind: "tool_result" });
|
|
382
|
+
|
|
383
|
+
/** @internal */
|
|
384
|
+
export const AgentThoughtStreamingEventParts$outboundSchema: z.ZodType<
|
|
385
|
+
AgentThoughtStreamingEventParts$Outbound,
|
|
386
|
+
z.ZodTypeDef,
|
|
387
|
+
AgentThoughtStreamingEventParts
|
|
388
|
+
> = z.union([
|
|
389
|
+
ToolCallPart$outboundSchema.and(
|
|
390
|
+
z.object({ kind: z.literal("tool_call") }).transform((v) => ({
|
|
391
|
+
kind: v.kind,
|
|
392
|
+
})),
|
|
393
|
+
),
|
|
394
|
+
TextPart$outboundSchema.and(
|
|
395
|
+
z.object({ kind: z.literal("text") }).transform((v) => ({ kind: v.kind })),
|
|
396
|
+
),
|
|
397
|
+
DataPart$outboundSchema.and(
|
|
398
|
+
z.object({ kind: z.literal("data") }).transform((v) => ({ kind: v.kind })),
|
|
399
|
+
),
|
|
400
|
+
FilePart$outboundSchema.and(
|
|
401
|
+
z.object({ kind: z.literal("file") }).transform((v) => ({ kind: v.kind })),
|
|
402
|
+
),
|
|
403
|
+
ToolResultPart$outboundSchema.and(
|
|
404
|
+
z.object({ kind: z.literal("tool_result") }).transform((v) => ({
|
|
405
|
+
kind: v.kind,
|
|
406
|
+
})),
|
|
407
|
+
),
|
|
408
|
+
]);
|
|
409
|
+
|
|
410
|
+
export function agentThoughtStreamingEventPartsToJSON(
|
|
411
|
+
agentThoughtStreamingEventParts: AgentThoughtStreamingEventParts,
|
|
412
|
+
): string {
|
|
413
|
+
return JSON.stringify(
|
|
414
|
+
AgentThoughtStreamingEventParts$outboundSchema.parse(
|
|
415
|
+
agentThoughtStreamingEventParts,
|
|
416
|
+
),
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
export function agentThoughtStreamingEventPartsFromJSON(
|
|
420
|
+
jsonString: string,
|
|
421
|
+
): SafeParseResult<AgentThoughtStreamingEventParts, SDKValidationError> {
|
|
422
|
+
return safeParse(
|
|
423
|
+
jsonString,
|
|
424
|
+
(x) => AgentThoughtStreamingEventParts$inboundSchema.parse(JSON.parse(x)),
|
|
425
|
+
`Failed to parse 'AgentThoughtStreamingEventParts' from JSON`,
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** @internal */
|
|
430
|
+
export const MessageDifference$inboundSchema: z.ZodType<
|
|
431
|
+
MessageDifference,
|
|
432
|
+
z.ZodTypeDef,
|
|
433
|
+
unknown
|
|
434
|
+
> = z.object({
|
|
435
|
+
messageId: z.string(),
|
|
436
|
+
role: AgentThoughtStreamingEventRole$inboundSchema,
|
|
437
|
+
parts: z.array(
|
|
438
|
+
z.union([
|
|
439
|
+
ToolCallPart$inboundSchema.and(
|
|
440
|
+
z.object({ kind: z.literal("tool_call") }).transform((v) => ({
|
|
441
|
+
kind: v.kind,
|
|
442
|
+
})),
|
|
443
|
+
),
|
|
444
|
+
TextPart$inboundSchema.and(
|
|
445
|
+
z.object({ kind: z.literal("text") }).transform((v) => ({
|
|
446
|
+
kind: v.kind,
|
|
447
|
+
})),
|
|
448
|
+
),
|
|
449
|
+
DataPart$inboundSchema.and(
|
|
450
|
+
z.object({ kind: z.literal("data") }).transform((v) => ({
|
|
451
|
+
kind: v.kind,
|
|
452
|
+
})),
|
|
453
|
+
),
|
|
454
|
+
FilePart$inboundSchema.and(
|
|
455
|
+
z.object({ kind: z.literal("file") }).transform((v) => ({
|
|
456
|
+
kind: v.kind,
|
|
457
|
+
})),
|
|
458
|
+
),
|
|
459
|
+
ToolResultPart$inboundSchema.and(
|
|
460
|
+
z.object({ kind: z.literal("tool_result") }).transform((v) => ({
|
|
461
|
+
kind: v.kind,
|
|
462
|
+
})),
|
|
463
|
+
),
|
|
464
|
+
]),
|
|
465
|
+
),
|
|
466
|
+
metadata: z.record(z.any()).optional(),
|
|
467
|
+
agent_id: z.string(),
|
|
468
|
+
agent_execution_id: z.string(),
|
|
469
|
+
workspace_id: z.string(),
|
|
470
|
+
}).transform((v) => {
|
|
471
|
+
return remap$(v, {
|
|
472
|
+
"agent_id": "agentId",
|
|
473
|
+
"agent_execution_id": "agentExecutionId",
|
|
474
|
+
"workspace_id": "workspaceId",
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
/** @internal */
|
|
478
|
+
export type MessageDifference$Outbound = {
|
|
479
|
+
messageId: string;
|
|
480
|
+
role: string;
|
|
481
|
+
parts: Array<
|
|
482
|
+
| (ToolCallPart$Outbound & { kind: "tool_call" })
|
|
483
|
+
| (TextPart$Outbound & { kind: "text" })
|
|
484
|
+
| (DataPart$Outbound & { kind: "data" })
|
|
485
|
+
| (FilePart$Outbound & { kind: "file" })
|
|
486
|
+
| (ToolResultPart$Outbound & { kind: "tool_result" })
|
|
487
|
+
>;
|
|
488
|
+
metadata?: { [k: string]: any } | undefined;
|
|
489
|
+
agent_id: string;
|
|
490
|
+
agent_execution_id: string;
|
|
491
|
+
workspace_id: string;
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
/** @internal */
|
|
495
|
+
export const MessageDifference$outboundSchema: z.ZodType<
|
|
496
|
+
MessageDifference$Outbound,
|
|
497
|
+
z.ZodTypeDef,
|
|
498
|
+
MessageDifference
|
|
499
|
+
> = z.object({
|
|
500
|
+
messageId: z.string(),
|
|
501
|
+
role: AgentThoughtStreamingEventRole$outboundSchema,
|
|
502
|
+
parts: z.array(
|
|
503
|
+
z.union([
|
|
504
|
+
ToolCallPart$outboundSchema.and(
|
|
505
|
+
z.object({ kind: z.literal("tool_call") }).transform((v) => ({
|
|
506
|
+
kind: v.kind,
|
|
507
|
+
})),
|
|
508
|
+
),
|
|
509
|
+
TextPart$outboundSchema.and(
|
|
510
|
+
z.object({ kind: z.literal("text") }).transform((v) => ({
|
|
511
|
+
kind: v.kind,
|
|
512
|
+
})),
|
|
513
|
+
),
|
|
514
|
+
DataPart$outboundSchema.and(
|
|
515
|
+
z.object({ kind: z.literal("data") }).transform((v) => ({
|
|
516
|
+
kind: v.kind,
|
|
517
|
+
})),
|
|
518
|
+
),
|
|
519
|
+
FilePart$outboundSchema.and(
|
|
520
|
+
z.object({ kind: z.literal("file") }).transform((v) => ({
|
|
521
|
+
kind: v.kind,
|
|
522
|
+
})),
|
|
523
|
+
),
|
|
524
|
+
ToolResultPart$outboundSchema.and(
|
|
525
|
+
z.object({ kind: z.literal("tool_result") }).transform((v) => ({
|
|
526
|
+
kind: v.kind,
|
|
527
|
+
})),
|
|
528
|
+
),
|
|
529
|
+
]),
|
|
530
|
+
),
|
|
531
|
+
metadata: z.record(z.any()).optional(),
|
|
532
|
+
agentId: z.string(),
|
|
533
|
+
agentExecutionId: z.string(),
|
|
534
|
+
workspaceId: z.string(),
|
|
535
|
+
}).transform((v) => {
|
|
536
|
+
return remap$(v, {
|
|
537
|
+
agentId: "agent_id",
|
|
538
|
+
agentExecutionId: "agent_execution_id",
|
|
539
|
+
workspaceId: "workspace_id",
|
|
540
|
+
});
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
export function messageDifferenceToJSON(
|
|
544
|
+
messageDifference: MessageDifference,
|
|
545
|
+
): string {
|
|
546
|
+
return JSON.stringify(
|
|
547
|
+
MessageDifference$outboundSchema.parse(messageDifference),
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
export function messageDifferenceFromJSON(
|
|
551
|
+
jsonString: string,
|
|
552
|
+
): SafeParseResult<MessageDifference, SDKValidationError> {
|
|
553
|
+
return safeParse(
|
|
554
|
+
jsonString,
|
|
555
|
+
(x) => MessageDifference$inboundSchema.parse(JSON.parse(x)),
|
|
556
|
+
`Failed to parse 'MessageDifference' from JSON`,
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** @internal */
|
|
561
|
+
export const AgentThoughtStreamingEventFinishReason$inboundSchema:
|
|
562
|
+
z.ZodNativeEnum<typeof AgentThoughtStreamingEventFinishReason> = z.nativeEnum(
|
|
563
|
+
AgentThoughtStreamingEventFinishReason,
|
|
564
|
+
);
|
|
565
|
+
/** @internal */
|
|
566
|
+
export const AgentThoughtStreamingEventFinishReason$outboundSchema:
|
|
567
|
+
z.ZodNativeEnum<typeof AgentThoughtStreamingEventFinishReason> =
|
|
568
|
+
AgentThoughtStreamingEventFinishReason$inboundSchema;
|
|
569
|
+
|
|
570
|
+
/** @internal */
|
|
571
|
+
export const AgentThoughtStreamingEventDataType$inboundSchema: z.ZodNativeEnum<
|
|
572
|
+
typeof AgentThoughtStreamingEventDataType
|
|
573
|
+
> = z.nativeEnum(AgentThoughtStreamingEventDataType);
|
|
574
|
+
/** @internal */
|
|
575
|
+
export const AgentThoughtStreamingEventDataType$outboundSchema: z.ZodNativeEnum<
|
|
576
|
+
typeof AgentThoughtStreamingEventDataType
|
|
577
|
+
> = AgentThoughtStreamingEventDataType$inboundSchema;
|
|
578
|
+
|
|
579
|
+
/** @internal */
|
|
580
|
+
export const AgentThoughtStreamingEventFunction$inboundSchema: z.ZodType<
|
|
581
|
+
AgentThoughtStreamingEventFunction,
|
|
582
|
+
z.ZodTypeDef,
|
|
583
|
+
unknown
|
|
584
|
+
> = z.object({
|
|
585
|
+
name: z.string().optional(),
|
|
586
|
+
arguments: z.string().optional(),
|
|
587
|
+
});
|
|
588
|
+
/** @internal */
|
|
589
|
+
export type AgentThoughtStreamingEventFunction$Outbound = {
|
|
590
|
+
name?: string | undefined;
|
|
591
|
+
arguments?: string | undefined;
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
/** @internal */
|
|
595
|
+
export const AgentThoughtStreamingEventFunction$outboundSchema: z.ZodType<
|
|
596
|
+
AgentThoughtStreamingEventFunction$Outbound,
|
|
597
|
+
z.ZodTypeDef,
|
|
598
|
+
AgentThoughtStreamingEventFunction
|
|
599
|
+
> = z.object({
|
|
600
|
+
name: z.string().optional(),
|
|
601
|
+
arguments: z.string().optional(),
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
export function agentThoughtStreamingEventFunctionToJSON(
|
|
605
|
+
agentThoughtStreamingEventFunction: AgentThoughtStreamingEventFunction,
|
|
606
|
+
): string {
|
|
607
|
+
return JSON.stringify(
|
|
608
|
+
AgentThoughtStreamingEventFunction$outboundSchema.parse(
|
|
609
|
+
agentThoughtStreamingEventFunction,
|
|
610
|
+
),
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
export function agentThoughtStreamingEventFunctionFromJSON(
|
|
614
|
+
jsonString: string,
|
|
615
|
+
): SafeParseResult<AgentThoughtStreamingEventFunction, SDKValidationError> {
|
|
616
|
+
return safeParse(
|
|
617
|
+
jsonString,
|
|
618
|
+
(x) =>
|
|
619
|
+
AgentThoughtStreamingEventFunction$inboundSchema.parse(JSON.parse(x)),
|
|
620
|
+
`Failed to parse 'AgentThoughtStreamingEventFunction' from JSON`,
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/** @internal */
|
|
625
|
+
export const AgentThoughtStreamingEventToolCalls$inboundSchema: z.ZodType<
|
|
626
|
+
AgentThoughtStreamingEventToolCalls,
|
|
627
|
+
z.ZodTypeDef,
|
|
628
|
+
unknown
|
|
629
|
+
> = z.object({
|
|
630
|
+
id: z.string().optional(),
|
|
631
|
+
type: AgentThoughtStreamingEventDataType$inboundSchema.optional(),
|
|
632
|
+
function: z.lazy(() => AgentThoughtStreamingEventFunction$inboundSchema)
|
|
633
|
+
.optional(),
|
|
634
|
+
});
|
|
635
|
+
/** @internal */
|
|
636
|
+
export type AgentThoughtStreamingEventToolCalls$Outbound = {
|
|
637
|
+
id?: string | undefined;
|
|
638
|
+
type?: string | undefined;
|
|
639
|
+
function?: AgentThoughtStreamingEventFunction$Outbound | undefined;
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
/** @internal */
|
|
643
|
+
export const AgentThoughtStreamingEventToolCalls$outboundSchema: z.ZodType<
|
|
644
|
+
AgentThoughtStreamingEventToolCalls$Outbound,
|
|
645
|
+
z.ZodTypeDef,
|
|
646
|
+
AgentThoughtStreamingEventToolCalls
|
|
647
|
+
> = z.object({
|
|
648
|
+
id: z.string().optional(),
|
|
649
|
+
type: AgentThoughtStreamingEventDataType$outboundSchema.optional(),
|
|
650
|
+
function: z.lazy(() => AgentThoughtStreamingEventFunction$outboundSchema)
|
|
651
|
+
.optional(),
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
export function agentThoughtStreamingEventToolCallsToJSON(
|
|
655
|
+
agentThoughtStreamingEventToolCalls: AgentThoughtStreamingEventToolCalls,
|
|
656
|
+
): string {
|
|
657
|
+
return JSON.stringify(
|
|
658
|
+
AgentThoughtStreamingEventToolCalls$outboundSchema.parse(
|
|
659
|
+
agentThoughtStreamingEventToolCalls,
|
|
660
|
+
),
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
export function agentThoughtStreamingEventToolCallsFromJSON(
|
|
664
|
+
jsonString: string,
|
|
665
|
+
): SafeParseResult<AgentThoughtStreamingEventToolCalls, SDKValidationError> {
|
|
666
|
+
return safeParse(
|
|
667
|
+
jsonString,
|
|
668
|
+
(x) =>
|
|
669
|
+
AgentThoughtStreamingEventToolCalls$inboundSchema.parse(JSON.parse(x)),
|
|
670
|
+
`Failed to parse 'AgentThoughtStreamingEventToolCalls' from JSON`,
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/** @internal */
|
|
675
|
+
export const AgentThoughtStreamingEventDataRole$inboundSchema: z.ZodNativeEnum<
|
|
676
|
+
typeof AgentThoughtStreamingEventDataRole
|
|
677
|
+
> = z.nativeEnum(AgentThoughtStreamingEventDataRole);
|
|
678
|
+
/** @internal */
|
|
679
|
+
export const AgentThoughtStreamingEventDataRole$outboundSchema: z.ZodNativeEnum<
|
|
680
|
+
typeof AgentThoughtStreamingEventDataRole
|
|
681
|
+
> = AgentThoughtStreamingEventDataRole$inboundSchema;
|
|
682
|
+
|
|
683
|
+
/** @internal */
|
|
684
|
+
export const AgentThoughtStreamingEventAudio$inboundSchema: z.ZodType<
|
|
685
|
+
AgentThoughtStreamingEventAudio,
|
|
686
|
+
z.ZodTypeDef,
|
|
687
|
+
unknown
|
|
688
|
+
> = z.object({
|
|
689
|
+
id: z.string(),
|
|
690
|
+
expires_at: z.number().int(),
|
|
691
|
+
data: z.string(),
|
|
692
|
+
transcript: z.string(),
|
|
693
|
+
}).transform((v) => {
|
|
694
|
+
return remap$(v, {
|
|
695
|
+
"expires_at": "expiresAt",
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
/** @internal */
|
|
699
|
+
export type AgentThoughtStreamingEventAudio$Outbound = {
|
|
700
|
+
id: string;
|
|
701
|
+
expires_at: number;
|
|
702
|
+
data: string;
|
|
703
|
+
transcript: string;
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
/** @internal */
|
|
707
|
+
export const AgentThoughtStreamingEventAudio$outboundSchema: z.ZodType<
|
|
708
|
+
AgentThoughtStreamingEventAudio$Outbound,
|
|
709
|
+
z.ZodTypeDef,
|
|
710
|
+
AgentThoughtStreamingEventAudio
|
|
711
|
+
> = z.object({
|
|
712
|
+
id: z.string(),
|
|
713
|
+
expiresAt: z.number().int(),
|
|
714
|
+
data: z.string(),
|
|
715
|
+
transcript: z.string(),
|
|
716
|
+
}).transform((v) => {
|
|
717
|
+
return remap$(v, {
|
|
718
|
+
expiresAt: "expires_at",
|
|
719
|
+
});
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
export function agentThoughtStreamingEventAudioToJSON(
|
|
723
|
+
agentThoughtStreamingEventAudio: AgentThoughtStreamingEventAudio,
|
|
724
|
+
): string {
|
|
725
|
+
return JSON.stringify(
|
|
726
|
+
AgentThoughtStreamingEventAudio$outboundSchema.parse(
|
|
727
|
+
agentThoughtStreamingEventAudio,
|
|
728
|
+
),
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
export function agentThoughtStreamingEventAudioFromJSON(
|
|
732
|
+
jsonString: string,
|
|
733
|
+
): SafeParseResult<AgentThoughtStreamingEventAudio, SDKValidationError> {
|
|
734
|
+
return safeParse(
|
|
735
|
+
jsonString,
|
|
736
|
+
(x) => AgentThoughtStreamingEventAudio$inboundSchema.parse(JSON.parse(x)),
|
|
737
|
+
`Failed to parse 'AgentThoughtStreamingEventAudio' from JSON`,
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/** @internal */
|
|
742
|
+
export const AgentThoughtStreamingEventMessage$inboundSchema: z.ZodType<
|
|
743
|
+
AgentThoughtStreamingEventMessage,
|
|
744
|
+
z.ZodTypeDef,
|
|
745
|
+
unknown
|
|
746
|
+
> = z.object({
|
|
747
|
+
content: z.nullable(z.string()).optional(),
|
|
748
|
+
refusal: z.nullable(z.string()).optional(),
|
|
749
|
+
tool_calls: z.array(
|
|
750
|
+
z.lazy(() => AgentThoughtStreamingEventToolCalls$inboundSchema),
|
|
751
|
+
).optional(),
|
|
752
|
+
role: AgentThoughtStreamingEventDataRole$inboundSchema.optional(),
|
|
753
|
+
reasoning: z.nullable(z.string()).optional(),
|
|
754
|
+
reasoning_signature: z.nullable(z.string()).optional(),
|
|
755
|
+
redacted_reasoning: z.string().optional(),
|
|
756
|
+
audio: z.nullable(z.lazy(() => AgentThoughtStreamingEventAudio$inboundSchema))
|
|
757
|
+
.optional(),
|
|
758
|
+
}).transform((v) => {
|
|
759
|
+
return remap$(v, {
|
|
760
|
+
"tool_calls": "toolCalls",
|
|
761
|
+
"reasoning_signature": "reasoningSignature",
|
|
762
|
+
"redacted_reasoning": "redactedReasoning",
|
|
763
|
+
});
|
|
764
|
+
});
|
|
765
|
+
/** @internal */
|
|
766
|
+
export type AgentThoughtStreamingEventMessage$Outbound = {
|
|
767
|
+
content?: string | null | undefined;
|
|
768
|
+
refusal?: string | null | undefined;
|
|
769
|
+
tool_calls?: Array<AgentThoughtStreamingEventToolCalls$Outbound> | undefined;
|
|
770
|
+
role?: string | undefined;
|
|
771
|
+
reasoning?: string | null | undefined;
|
|
772
|
+
reasoning_signature?: string | null | undefined;
|
|
773
|
+
redacted_reasoning?: string | undefined;
|
|
774
|
+
audio?: AgentThoughtStreamingEventAudio$Outbound | null | undefined;
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
/** @internal */
|
|
778
|
+
export const AgentThoughtStreamingEventMessage$outboundSchema: z.ZodType<
|
|
779
|
+
AgentThoughtStreamingEventMessage$Outbound,
|
|
780
|
+
z.ZodTypeDef,
|
|
781
|
+
AgentThoughtStreamingEventMessage
|
|
782
|
+
> = z.object({
|
|
783
|
+
content: z.nullable(z.string()).optional(),
|
|
784
|
+
refusal: z.nullable(z.string()).optional(),
|
|
785
|
+
toolCalls: z.array(
|
|
786
|
+
z.lazy(() => AgentThoughtStreamingEventToolCalls$outboundSchema),
|
|
787
|
+
).optional(),
|
|
788
|
+
role: AgentThoughtStreamingEventDataRole$outboundSchema.optional(),
|
|
789
|
+
reasoning: z.nullable(z.string()).optional(),
|
|
790
|
+
reasoningSignature: z.nullable(z.string()).optional(),
|
|
791
|
+
redactedReasoning: z.string().optional(),
|
|
792
|
+
audio: z.nullable(
|
|
793
|
+
z.lazy(() => AgentThoughtStreamingEventAudio$outboundSchema),
|
|
794
|
+
).optional(),
|
|
795
|
+
}).transform((v) => {
|
|
796
|
+
return remap$(v, {
|
|
797
|
+
toolCalls: "tool_calls",
|
|
798
|
+
reasoningSignature: "reasoning_signature",
|
|
799
|
+
redactedReasoning: "redacted_reasoning",
|
|
800
|
+
});
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
export function agentThoughtStreamingEventMessageToJSON(
|
|
804
|
+
agentThoughtStreamingEventMessage: AgentThoughtStreamingEventMessage,
|
|
805
|
+
): string {
|
|
806
|
+
return JSON.stringify(
|
|
807
|
+
AgentThoughtStreamingEventMessage$outboundSchema.parse(
|
|
808
|
+
agentThoughtStreamingEventMessage,
|
|
809
|
+
),
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
export function agentThoughtStreamingEventMessageFromJSON(
|
|
813
|
+
jsonString: string,
|
|
814
|
+
): SafeParseResult<AgentThoughtStreamingEventMessage, SDKValidationError> {
|
|
815
|
+
return safeParse(
|
|
816
|
+
jsonString,
|
|
817
|
+
(x) => AgentThoughtStreamingEventMessage$inboundSchema.parse(JSON.parse(x)),
|
|
818
|
+
`Failed to parse 'AgentThoughtStreamingEventMessage' from JSON`,
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/** @internal */
|
|
823
|
+
export const TopLogprobs$inboundSchema: z.ZodType<
|
|
824
|
+
TopLogprobs,
|
|
825
|
+
z.ZodTypeDef,
|
|
826
|
+
unknown
|
|
827
|
+
> = z.object({
|
|
828
|
+
token: z.string(),
|
|
829
|
+
logprob: z.number(),
|
|
830
|
+
bytes: z.nullable(z.array(z.number())),
|
|
831
|
+
});
|
|
832
|
+
/** @internal */
|
|
833
|
+
export type TopLogprobs$Outbound = {
|
|
834
|
+
token: string;
|
|
835
|
+
logprob: number;
|
|
836
|
+
bytes: Array<number> | null;
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
/** @internal */
|
|
840
|
+
export const TopLogprobs$outboundSchema: z.ZodType<
|
|
841
|
+
TopLogprobs$Outbound,
|
|
842
|
+
z.ZodTypeDef,
|
|
843
|
+
TopLogprobs
|
|
844
|
+
> = z.object({
|
|
845
|
+
token: z.string(),
|
|
846
|
+
logprob: z.number(),
|
|
847
|
+
bytes: z.nullable(z.array(z.number())),
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
export function topLogprobsToJSON(topLogprobs: TopLogprobs): string {
|
|
851
|
+
return JSON.stringify(TopLogprobs$outboundSchema.parse(topLogprobs));
|
|
852
|
+
}
|
|
853
|
+
export function topLogprobsFromJSON(
|
|
854
|
+
jsonString: string,
|
|
855
|
+
): SafeParseResult<TopLogprobs, SDKValidationError> {
|
|
856
|
+
return safeParse(
|
|
857
|
+
jsonString,
|
|
858
|
+
(x) => TopLogprobs$inboundSchema.parse(JSON.parse(x)),
|
|
859
|
+
`Failed to parse 'TopLogprobs' from JSON`,
|
|
860
|
+
);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/** @internal */
|
|
864
|
+
export const AgentThoughtStreamingEventContent$inboundSchema: z.ZodType<
|
|
865
|
+
AgentThoughtStreamingEventContent,
|
|
866
|
+
z.ZodTypeDef,
|
|
867
|
+
unknown
|
|
868
|
+
> = z.object({
|
|
869
|
+
token: z.string(),
|
|
870
|
+
logprob: z.number(),
|
|
871
|
+
bytes: z.nullable(z.array(z.number())),
|
|
872
|
+
top_logprobs: z.array(z.lazy(() => TopLogprobs$inboundSchema)),
|
|
873
|
+
}).transform((v) => {
|
|
874
|
+
return remap$(v, {
|
|
875
|
+
"top_logprobs": "topLogprobs",
|
|
876
|
+
});
|
|
877
|
+
});
|
|
878
|
+
/** @internal */
|
|
879
|
+
export type AgentThoughtStreamingEventContent$Outbound = {
|
|
880
|
+
token: string;
|
|
881
|
+
logprob: number;
|
|
882
|
+
bytes: Array<number> | null;
|
|
883
|
+
top_logprobs: Array<TopLogprobs$Outbound>;
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
/** @internal */
|
|
887
|
+
export const AgentThoughtStreamingEventContent$outboundSchema: z.ZodType<
|
|
888
|
+
AgentThoughtStreamingEventContent$Outbound,
|
|
889
|
+
z.ZodTypeDef,
|
|
890
|
+
AgentThoughtStreamingEventContent
|
|
891
|
+
> = z.object({
|
|
892
|
+
token: z.string(),
|
|
893
|
+
logprob: z.number(),
|
|
894
|
+
bytes: z.nullable(z.array(z.number())),
|
|
895
|
+
topLogprobs: z.array(z.lazy(() => TopLogprobs$outboundSchema)),
|
|
896
|
+
}).transform((v) => {
|
|
897
|
+
return remap$(v, {
|
|
898
|
+
topLogprobs: "top_logprobs",
|
|
899
|
+
});
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
export function agentThoughtStreamingEventContentToJSON(
|
|
903
|
+
agentThoughtStreamingEventContent: AgentThoughtStreamingEventContent,
|
|
904
|
+
): string {
|
|
905
|
+
return JSON.stringify(
|
|
906
|
+
AgentThoughtStreamingEventContent$outboundSchema.parse(
|
|
907
|
+
agentThoughtStreamingEventContent,
|
|
908
|
+
),
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
export function agentThoughtStreamingEventContentFromJSON(
|
|
912
|
+
jsonString: string,
|
|
913
|
+
): SafeParseResult<AgentThoughtStreamingEventContent, SDKValidationError> {
|
|
914
|
+
return safeParse(
|
|
915
|
+
jsonString,
|
|
916
|
+
(x) => AgentThoughtStreamingEventContent$inboundSchema.parse(JSON.parse(x)),
|
|
917
|
+
`Failed to parse 'AgentThoughtStreamingEventContent' from JSON`,
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/** @internal */
|
|
922
|
+
export const AgentThoughtStreamingEventTopLogprobs$inboundSchema: z.ZodType<
|
|
923
|
+
AgentThoughtStreamingEventTopLogprobs,
|
|
924
|
+
z.ZodTypeDef,
|
|
925
|
+
unknown
|
|
926
|
+
> = z.object({
|
|
927
|
+
token: z.string(),
|
|
928
|
+
logprob: z.number(),
|
|
929
|
+
bytes: z.nullable(z.array(z.number())),
|
|
930
|
+
});
|
|
931
|
+
/** @internal */
|
|
932
|
+
export type AgentThoughtStreamingEventTopLogprobs$Outbound = {
|
|
933
|
+
token: string;
|
|
934
|
+
logprob: number;
|
|
935
|
+
bytes: Array<number> | null;
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
/** @internal */
|
|
939
|
+
export const AgentThoughtStreamingEventTopLogprobs$outboundSchema: z.ZodType<
|
|
940
|
+
AgentThoughtStreamingEventTopLogprobs$Outbound,
|
|
941
|
+
z.ZodTypeDef,
|
|
942
|
+
AgentThoughtStreamingEventTopLogprobs
|
|
943
|
+
> = z.object({
|
|
944
|
+
token: z.string(),
|
|
945
|
+
logprob: z.number(),
|
|
946
|
+
bytes: z.nullable(z.array(z.number())),
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
export function agentThoughtStreamingEventTopLogprobsToJSON(
|
|
950
|
+
agentThoughtStreamingEventTopLogprobs: AgentThoughtStreamingEventTopLogprobs,
|
|
951
|
+
): string {
|
|
952
|
+
return JSON.stringify(
|
|
953
|
+
AgentThoughtStreamingEventTopLogprobs$outboundSchema.parse(
|
|
954
|
+
agentThoughtStreamingEventTopLogprobs,
|
|
955
|
+
),
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
export function agentThoughtStreamingEventTopLogprobsFromJSON(
|
|
959
|
+
jsonString: string,
|
|
960
|
+
): SafeParseResult<AgentThoughtStreamingEventTopLogprobs, SDKValidationError> {
|
|
961
|
+
return safeParse(
|
|
962
|
+
jsonString,
|
|
963
|
+
(x) =>
|
|
964
|
+
AgentThoughtStreamingEventTopLogprobs$inboundSchema.parse(JSON.parse(x)),
|
|
965
|
+
`Failed to parse 'AgentThoughtStreamingEventTopLogprobs' from JSON`,
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/** @internal */
|
|
970
|
+
export const Refusal$inboundSchema: z.ZodType<Refusal, z.ZodTypeDef, unknown> =
|
|
971
|
+
z.object({
|
|
972
|
+
token: z.string(),
|
|
973
|
+
logprob: z.number(),
|
|
974
|
+
bytes: z.nullable(z.array(z.number())),
|
|
975
|
+
top_logprobs: z.array(
|
|
976
|
+
z.lazy(() => AgentThoughtStreamingEventTopLogprobs$inboundSchema),
|
|
977
|
+
),
|
|
978
|
+
}).transform((v) => {
|
|
979
|
+
return remap$(v, {
|
|
980
|
+
"top_logprobs": "topLogprobs",
|
|
981
|
+
});
|
|
982
|
+
});
|
|
983
|
+
/** @internal */
|
|
984
|
+
export type Refusal$Outbound = {
|
|
985
|
+
token: string;
|
|
986
|
+
logprob: number;
|
|
987
|
+
bytes: Array<number> | null;
|
|
988
|
+
top_logprobs: Array<AgentThoughtStreamingEventTopLogprobs$Outbound>;
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
/** @internal */
|
|
992
|
+
export const Refusal$outboundSchema: z.ZodType<
|
|
993
|
+
Refusal$Outbound,
|
|
994
|
+
z.ZodTypeDef,
|
|
995
|
+
Refusal
|
|
996
|
+
> = z.object({
|
|
997
|
+
token: z.string(),
|
|
998
|
+
logprob: z.number(),
|
|
999
|
+
bytes: z.nullable(z.array(z.number())),
|
|
1000
|
+
topLogprobs: z.array(
|
|
1001
|
+
z.lazy(() => AgentThoughtStreamingEventTopLogprobs$outboundSchema),
|
|
1002
|
+
),
|
|
1003
|
+
}).transform((v) => {
|
|
1004
|
+
return remap$(v, {
|
|
1005
|
+
topLogprobs: "top_logprobs",
|
|
1006
|
+
});
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
export function refusalToJSON(refusal: Refusal): string {
|
|
1010
|
+
return JSON.stringify(Refusal$outboundSchema.parse(refusal));
|
|
1011
|
+
}
|
|
1012
|
+
export function refusalFromJSON(
|
|
1013
|
+
jsonString: string,
|
|
1014
|
+
): SafeParseResult<Refusal, SDKValidationError> {
|
|
1015
|
+
return safeParse(
|
|
1016
|
+
jsonString,
|
|
1017
|
+
(x) => Refusal$inboundSchema.parse(JSON.parse(x)),
|
|
1018
|
+
`Failed to parse 'Refusal' from JSON`,
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
/** @internal */
|
|
1023
|
+
export const Logprobs$inboundSchema: z.ZodType<
|
|
1024
|
+
Logprobs,
|
|
1025
|
+
z.ZodTypeDef,
|
|
1026
|
+
unknown
|
|
1027
|
+
> = z.object({
|
|
1028
|
+
content: z.nullable(
|
|
1029
|
+
z.array(z.lazy(() => AgentThoughtStreamingEventContent$inboundSchema)),
|
|
1030
|
+
),
|
|
1031
|
+
refusal: z.nullable(z.array(z.lazy(() => Refusal$inboundSchema))),
|
|
1032
|
+
});
|
|
1033
|
+
/** @internal */
|
|
1034
|
+
export type Logprobs$Outbound = {
|
|
1035
|
+
content: Array<AgentThoughtStreamingEventContent$Outbound> | null;
|
|
1036
|
+
refusal: Array<Refusal$Outbound> | null;
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
/** @internal */
|
|
1040
|
+
export const Logprobs$outboundSchema: z.ZodType<
|
|
1041
|
+
Logprobs$Outbound,
|
|
1042
|
+
z.ZodTypeDef,
|
|
1043
|
+
Logprobs
|
|
1044
|
+
> = z.object({
|
|
1045
|
+
content: z.nullable(
|
|
1046
|
+
z.array(z.lazy(() => AgentThoughtStreamingEventContent$outboundSchema)),
|
|
1047
|
+
),
|
|
1048
|
+
refusal: z.nullable(z.array(z.lazy(() => Refusal$outboundSchema))),
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
export function logprobsToJSON(logprobs: Logprobs): string {
|
|
1052
|
+
return JSON.stringify(Logprobs$outboundSchema.parse(logprobs));
|
|
1053
|
+
}
|
|
1054
|
+
export function logprobsFromJSON(
|
|
1055
|
+
jsonString: string,
|
|
1056
|
+
): SafeParseResult<Logprobs, SDKValidationError> {
|
|
1057
|
+
return safeParse(
|
|
1058
|
+
jsonString,
|
|
1059
|
+
(x) => Logprobs$inboundSchema.parse(JSON.parse(x)),
|
|
1060
|
+
`Failed to parse 'Logprobs' from JSON`,
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/** @internal */
|
|
1065
|
+
export const Choice$inboundSchema: z.ZodType<Choice, z.ZodTypeDef, unknown> = z
|
|
1066
|
+
.object({
|
|
1067
|
+
finish_reason: z.nullable(
|
|
1068
|
+
AgentThoughtStreamingEventFinishReason$inboundSchema,
|
|
1069
|
+
),
|
|
1070
|
+
index: z.number().default(0),
|
|
1071
|
+
message: z.lazy(() => AgentThoughtStreamingEventMessage$inboundSchema),
|
|
1072
|
+
logprobs: z.nullable(z.lazy(() => Logprobs$inboundSchema)).optional(),
|
|
1073
|
+
}).transform((v) => {
|
|
1074
|
+
return remap$(v, {
|
|
1075
|
+
"finish_reason": "finishReason",
|
|
1076
|
+
});
|
|
1077
|
+
});
|
|
1078
|
+
/** @internal */
|
|
1079
|
+
export type Choice$Outbound = {
|
|
1080
|
+
finish_reason: string | null;
|
|
1081
|
+
index: number;
|
|
1082
|
+
message: AgentThoughtStreamingEventMessage$Outbound;
|
|
1083
|
+
logprobs?: Logprobs$Outbound | null | undefined;
|
|
1084
|
+
};
|
|
1085
|
+
|
|
1086
|
+
/** @internal */
|
|
1087
|
+
export const Choice$outboundSchema: z.ZodType<
|
|
1088
|
+
Choice$Outbound,
|
|
1089
|
+
z.ZodTypeDef,
|
|
1090
|
+
Choice
|
|
1091
|
+
> = z.object({
|
|
1092
|
+
finishReason: z.nullable(
|
|
1093
|
+
AgentThoughtStreamingEventFinishReason$outboundSchema,
|
|
1094
|
+
),
|
|
1095
|
+
index: z.number().default(0),
|
|
1096
|
+
message: z.lazy(() => AgentThoughtStreamingEventMessage$outboundSchema),
|
|
1097
|
+
logprobs: z.nullable(z.lazy(() => Logprobs$outboundSchema)).optional(),
|
|
1098
|
+
}).transform((v) => {
|
|
1099
|
+
return remap$(v, {
|
|
1100
|
+
finishReason: "finish_reason",
|
|
1101
|
+
});
|
|
1102
|
+
});
|
|
1103
|
+
|
|
1104
|
+
export function choiceToJSON(choice: Choice): string {
|
|
1105
|
+
return JSON.stringify(Choice$outboundSchema.parse(choice));
|
|
1106
|
+
}
|
|
1107
|
+
export function choiceFromJSON(
|
|
1108
|
+
jsonString: string,
|
|
1109
|
+
): SafeParseResult<Choice, SDKValidationError> {
|
|
1110
|
+
return safeParse(
|
|
1111
|
+
jsonString,
|
|
1112
|
+
(x) => Choice$inboundSchema.parse(JSON.parse(x)),
|
|
1113
|
+
`Failed to parse 'Choice' from JSON`,
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/** @internal */
|
|
1118
|
+
export const PromptTokensDetails$inboundSchema: z.ZodType<
|
|
1119
|
+
PromptTokensDetails,
|
|
1120
|
+
z.ZodTypeDef,
|
|
1121
|
+
unknown
|
|
1122
|
+
> = z.object({
|
|
1123
|
+
cached_tokens: z.nullable(z.number().int()).optional(),
|
|
1124
|
+
audio_tokens: z.nullable(z.number().int()).optional(),
|
|
1125
|
+
}).transform((v) => {
|
|
1126
|
+
return remap$(v, {
|
|
1127
|
+
"cached_tokens": "cachedTokens",
|
|
1128
|
+
"audio_tokens": "audioTokens",
|
|
1129
|
+
});
|
|
1130
|
+
});
|
|
1131
|
+
/** @internal */
|
|
1132
|
+
export type PromptTokensDetails$Outbound = {
|
|
1133
|
+
cached_tokens?: number | null | undefined;
|
|
1134
|
+
audio_tokens?: number | null | undefined;
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
/** @internal */
|
|
1138
|
+
export const PromptTokensDetails$outboundSchema: z.ZodType<
|
|
1139
|
+
PromptTokensDetails$Outbound,
|
|
1140
|
+
z.ZodTypeDef,
|
|
1141
|
+
PromptTokensDetails
|
|
1142
|
+
> = z.object({
|
|
1143
|
+
cachedTokens: z.nullable(z.number().int()).optional(),
|
|
1144
|
+
audioTokens: z.nullable(z.number().int()).optional(),
|
|
1145
|
+
}).transform((v) => {
|
|
1146
|
+
return remap$(v, {
|
|
1147
|
+
cachedTokens: "cached_tokens",
|
|
1148
|
+
audioTokens: "audio_tokens",
|
|
1149
|
+
});
|
|
1150
|
+
});
|
|
1151
|
+
|
|
1152
|
+
export function promptTokensDetailsToJSON(
|
|
1153
|
+
promptTokensDetails: PromptTokensDetails,
|
|
1154
|
+
): string {
|
|
1155
|
+
return JSON.stringify(
|
|
1156
|
+
PromptTokensDetails$outboundSchema.parse(promptTokensDetails),
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
export function promptTokensDetailsFromJSON(
|
|
1160
|
+
jsonString: string,
|
|
1161
|
+
): SafeParseResult<PromptTokensDetails, SDKValidationError> {
|
|
1162
|
+
return safeParse(
|
|
1163
|
+
jsonString,
|
|
1164
|
+
(x) => PromptTokensDetails$inboundSchema.parse(JSON.parse(x)),
|
|
1165
|
+
`Failed to parse 'PromptTokensDetails' from JSON`,
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/** @internal */
|
|
1170
|
+
export const CompletionTokensDetails$inboundSchema: z.ZodType<
|
|
1171
|
+
CompletionTokensDetails,
|
|
1172
|
+
z.ZodTypeDef,
|
|
1173
|
+
unknown
|
|
1174
|
+
> = z.object({
|
|
1175
|
+
reasoning_tokens: z.nullable(z.number()).optional(),
|
|
1176
|
+
accepted_prediction_tokens: z.nullable(z.number()).optional(),
|
|
1177
|
+
rejected_prediction_tokens: z.nullable(z.number()).optional(),
|
|
1178
|
+
audio_tokens: z.nullable(z.number().int()).optional(),
|
|
1179
|
+
}).transform((v) => {
|
|
1180
|
+
return remap$(v, {
|
|
1181
|
+
"reasoning_tokens": "reasoningTokens",
|
|
1182
|
+
"accepted_prediction_tokens": "acceptedPredictionTokens",
|
|
1183
|
+
"rejected_prediction_tokens": "rejectedPredictionTokens",
|
|
1184
|
+
"audio_tokens": "audioTokens",
|
|
1185
|
+
});
|
|
1186
|
+
});
|
|
1187
|
+
/** @internal */
|
|
1188
|
+
export type CompletionTokensDetails$Outbound = {
|
|
1189
|
+
reasoning_tokens?: number | null | undefined;
|
|
1190
|
+
accepted_prediction_tokens?: number | null | undefined;
|
|
1191
|
+
rejected_prediction_tokens?: number | null | undefined;
|
|
1192
|
+
audio_tokens?: number | null | undefined;
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
/** @internal */
|
|
1196
|
+
export const CompletionTokensDetails$outboundSchema: z.ZodType<
|
|
1197
|
+
CompletionTokensDetails$Outbound,
|
|
1198
|
+
z.ZodTypeDef,
|
|
1199
|
+
CompletionTokensDetails
|
|
1200
|
+
> = z.object({
|
|
1201
|
+
reasoningTokens: z.nullable(z.number()).optional(),
|
|
1202
|
+
acceptedPredictionTokens: z.nullable(z.number()).optional(),
|
|
1203
|
+
rejectedPredictionTokens: z.nullable(z.number()).optional(),
|
|
1204
|
+
audioTokens: z.nullable(z.number().int()).optional(),
|
|
1205
|
+
}).transform((v) => {
|
|
1206
|
+
return remap$(v, {
|
|
1207
|
+
reasoningTokens: "reasoning_tokens",
|
|
1208
|
+
acceptedPredictionTokens: "accepted_prediction_tokens",
|
|
1209
|
+
rejectedPredictionTokens: "rejected_prediction_tokens",
|
|
1210
|
+
audioTokens: "audio_tokens",
|
|
1211
|
+
});
|
|
1212
|
+
});
|
|
1213
|
+
|
|
1214
|
+
export function completionTokensDetailsToJSON(
|
|
1215
|
+
completionTokensDetails: CompletionTokensDetails,
|
|
1216
|
+
): string {
|
|
1217
|
+
return JSON.stringify(
|
|
1218
|
+
CompletionTokensDetails$outboundSchema.parse(completionTokensDetails),
|
|
1219
|
+
);
|
|
1220
|
+
}
|
|
1221
|
+
export function completionTokensDetailsFromJSON(
|
|
1222
|
+
jsonString: string,
|
|
1223
|
+
): SafeParseResult<CompletionTokensDetails, SDKValidationError> {
|
|
1224
|
+
return safeParse(
|
|
1225
|
+
jsonString,
|
|
1226
|
+
(x) => CompletionTokensDetails$inboundSchema.parse(JSON.parse(x)),
|
|
1227
|
+
`Failed to parse 'CompletionTokensDetails' from JSON`,
|
|
1228
|
+
);
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/** @internal */
|
|
1232
|
+
export const Usage$inboundSchema: z.ZodType<Usage, z.ZodTypeDef, unknown> = z
|
|
1233
|
+
.object({
|
|
1234
|
+
completion_tokens: z.number().optional(),
|
|
1235
|
+
prompt_tokens: z.number().optional(),
|
|
1236
|
+
total_tokens: z.number().optional(),
|
|
1237
|
+
prompt_tokens_details: z.nullable(
|
|
1238
|
+
z.lazy(() => PromptTokensDetails$inboundSchema),
|
|
1239
|
+
).optional(),
|
|
1240
|
+
completion_tokens_details: z.nullable(
|
|
1241
|
+
z.lazy(() => CompletionTokensDetails$inboundSchema),
|
|
1242
|
+
).optional(),
|
|
1243
|
+
}).transform((v) => {
|
|
1244
|
+
return remap$(v, {
|
|
1245
|
+
"completion_tokens": "completionTokens",
|
|
1246
|
+
"prompt_tokens": "promptTokens",
|
|
1247
|
+
"total_tokens": "totalTokens",
|
|
1248
|
+
"prompt_tokens_details": "promptTokensDetails",
|
|
1249
|
+
"completion_tokens_details": "completionTokensDetails",
|
|
1250
|
+
});
|
|
1251
|
+
});
|
|
1252
|
+
/** @internal */
|
|
1253
|
+
export type Usage$Outbound = {
|
|
1254
|
+
completion_tokens?: number | undefined;
|
|
1255
|
+
prompt_tokens?: number | undefined;
|
|
1256
|
+
total_tokens?: number | undefined;
|
|
1257
|
+
prompt_tokens_details?: PromptTokensDetails$Outbound | null | undefined;
|
|
1258
|
+
completion_tokens_details?:
|
|
1259
|
+
| CompletionTokensDetails$Outbound
|
|
1260
|
+
| null
|
|
1261
|
+
| undefined;
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
/** @internal */
|
|
1265
|
+
export const Usage$outboundSchema: z.ZodType<
|
|
1266
|
+
Usage$Outbound,
|
|
1267
|
+
z.ZodTypeDef,
|
|
1268
|
+
Usage
|
|
1269
|
+
> = z.object({
|
|
1270
|
+
completionTokens: z.number().optional(),
|
|
1271
|
+
promptTokens: z.number().optional(),
|
|
1272
|
+
totalTokens: z.number().optional(),
|
|
1273
|
+
promptTokensDetails: z.nullable(
|
|
1274
|
+
z.lazy(() => PromptTokensDetails$outboundSchema),
|
|
1275
|
+
).optional(),
|
|
1276
|
+
completionTokensDetails: z.nullable(
|
|
1277
|
+
z.lazy(() => CompletionTokensDetails$outboundSchema),
|
|
1278
|
+
).optional(),
|
|
1279
|
+
}).transform((v) => {
|
|
1280
|
+
return remap$(v, {
|
|
1281
|
+
completionTokens: "completion_tokens",
|
|
1282
|
+
promptTokens: "prompt_tokens",
|
|
1283
|
+
totalTokens: "total_tokens",
|
|
1284
|
+
promptTokensDetails: "prompt_tokens_details",
|
|
1285
|
+
completionTokensDetails: "completion_tokens_details",
|
|
1286
|
+
});
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
export function usageToJSON(usage: Usage): string {
|
|
1290
|
+
return JSON.stringify(Usage$outboundSchema.parse(usage));
|
|
1291
|
+
}
|
|
1292
|
+
export function usageFromJSON(
|
|
1293
|
+
jsonString: string,
|
|
1294
|
+
): SafeParseResult<Usage, SDKValidationError> {
|
|
1295
|
+
return safeParse(
|
|
1296
|
+
jsonString,
|
|
1297
|
+
(x) => Usage$inboundSchema.parse(JSON.parse(x)),
|
|
1298
|
+
`Failed to parse 'Usage' from JSON`,
|
|
1299
|
+
);
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
/** @internal */
|
|
1303
|
+
export const AgentThoughtStreamingEventData$inboundSchema: z.ZodType<
|
|
1304
|
+
AgentThoughtStreamingEventData,
|
|
1305
|
+
z.ZodTypeDef,
|
|
1306
|
+
unknown
|
|
1307
|
+
> = z.object({
|
|
1308
|
+
agent_id: z.string(),
|
|
1309
|
+
message_difference: z.record(z.lazy(() => MessageDifference$inboundSchema)),
|
|
1310
|
+
choice: z.lazy(() => Choice$inboundSchema).optional(),
|
|
1311
|
+
choiceIndex: z.number().optional(),
|
|
1312
|
+
iteration: z.number(),
|
|
1313
|
+
accumulated_execution_time: z.number(),
|
|
1314
|
+
responseId: z.string().optional(),
|
|
1315
|
+
usage: z.lazy(() => Usage$inboundSchema).optional(),
|
|
1316
|
+
}).transform((v) => {
|
|
1317
|
+
return remap$(v, {
|
|
1318
|
+
"agent_id": "agentId",
|
|
1319
|
+
"message_difference": "messageDifference",
|
|
1320
|
+
"accumulated_execution_time": "accumulatedExecutionTime",
|
|
1321
|
+
});
|
|
1322
|
+
});
|
|
1323
|
+
/** @internal */
|
|
1324
|
+
export type AgentThoughtStreamingEventData$Outbound = {
|
|
1325
|
+
agent_id: string;
|
|
1326
|
+
message_difference: { [k: string]: MessageDifference$Outbound };
|
|
1327
|
+
choice?: Choice$Outbound | undefined;
|
|
1328
|
+
choiceIndex?: number | undefined;
|
|
1329
|
+
iteration: number;
|
|
1330
|
+
accumulated_execution_time: number;
|
|
1331
|
+
responseId?: string | undefined;
|
|
1332
|
+
usage?: Usage$Outbound | undefined;
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
/** @internal */
|
|
1336
|
+
export const AgentThoughtStreamingEventData$outboundSchema: z.ZodType<
|
|
1337
|
+
AgentThoughtStreamingEventData$Outbound,
|
|
1338
|
+
z.ZodTypeDef,
|
|
1339
|
+
AgentThoughtStreamingEventData
|
|
1340
|
+
> = z.object({
|
|
1341
|
+
agentId: z.string(),
|
|
1342
|
+
messageDifference: z.record(z.lazy(() => MessageDifference$outboundSchema)),
|
|
1343
|
+
choice: z.lazy(() => Choice$outboundSchema).optional(),
|
|
1344
|
+
choiceIndex: z.number().optional(),
|
|
1345
|
+
iteration: z.number(),
|
|
1346
|
+
accumulatedExecutionTime: z.number(),
|
|
1347
|
+
responseId: z.string().optional(),
|
|
1348
|
+
usage: z.lazy(() => Usage$outboundSchema).optional(),
|
|
1349
|
+
}).transform((v) => {
|
|
1350
|
+
return remap$(v, {
|
|
1351
|
+
agentId: "agent_id",
|
|
1352
|
+
messageDifference: "message_difference",
|
|
1353
|
+
accumulatedExecutionTime: "accumulated_execution_time",
|
|
1354
|
+
});
|
|
1355
|
+
});
|
|
1356
|
+
|
|
1357
|
+
export function agentThoughtStreamingEventDataToJSON(
|
|
1358
|
+
agentThoughtStreamingEventData: AgentThoughtStreamingEventData,
|
|
1359
|
+
): string {
|
|
1360
|
+
return JSON.stringify(
|
|
1361
|
+
AgentThoughtStreamingEventData$outboundSchema.parse(
|
|
1362
|
+
agentThoughtStreamingEventData,
|
|
1363
|
+
),
|
|
1364
|
+
);
|
|
1365
|
+
}
|
|
1366
|
+
export function agentThoughtStreamingEventDataFromJSON(
|
|
1367
|
+
jsonString: string,
|
|
1368
|
+
): SafeParseResult<AgentThoughtStreamingEventData, SDKValidationError> {
|
|
1369
|
+
return safeParse(
|
|
1370
|
+
jsonString,
|
|
1371
|
+
(x) => AgentThoughtStreamingEventData$inboundSchema.parse(JSON.parse(x)),
|
|
1372
|
+
`Failed to parse 'AgentThoughtStreamingEventData' from JSON`,
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
/** @internal */
|
|
1377
|
+
export const AgentThoughtStreamingEvent$inboundSchema: z.ZodType<
|
|
1378
|
+
AgentThoughtStreamingEvent,
|
|
1379
|
+
z.ZodTypeDef,
|
|
1380
|
+
unknown
|
|
1381
|
+
> = z.object({
|
|
1382
|
+
type: AgentThoughtStreamingEventType$inboundSchema,
|
|
1383
|
+
timestamp: z.string(),
|
|
1384
|
+
data: z.lazy(() => AgentThoughtStreamingEventData$inboundSchema),
|
|
1385
|
+
});
|
|
1386
|
+
/** @internal */
|
|
1387
|
+
export type AgentThoughtStreamingEvent$Outbound = {
|
|
1388
|
+
type: string;
|
|
1389
|
+
timestamp: string;
|
|
1390
|
+
data: AgentThoughtStreamingEventData$Outbound;
|
|
1391
|
+
};
|
|
1392
|
+
|
|
1393
|
+
/** @internal */
|
|
1394
|
+
export const AgentThoughtStreamingEvent$outboundSchema: z.ZodType<
|
|
1395
|
+
AgentThoughtStreamingEvent$Outbound,
|
|
1396
|
+
z.ZodTypeDef,
|
|
1397
|
+
AgentThoughtStreamingEvent
|
|
1398
|
+
> = z.object({
|
|
1399
|
+
type: AgentThoughtStreamingEventType$outboundSchema,
|
|
1400
|
+
timestamp: z.string(),
|
|
1401
|
+
data: z.lazy(() => AgentThoughtStreamingEventData$outboundSchema),
|
|
1402
|
+
});
|
|
1403
|
+
|
|
1404
|
+
export function agentThoughtStreamingEventToJSON(
|
|
1405
|
+
agentThoughtStreamingEvent: AgentThoughtStreamingEvent,
|
|
1406
|
+
): string {
|
|
1407
|
+
return JSON.stringify(
|
|
1408
|
+
AgentThoughtStreamingEvent$outboundSchema.parse(agentThoughtStreamingEvent),
|
|
1409
|
+
);
|
|
1410
|
+
}
|
|
1411
|
+
export function agentThoughtStreamingEventFromJSON(
|
|
1412
|
+
jsonString: string,
|
|
1413
|
+
): SafeParseResult<AgentThoughtStreamingEvent, SDKValidationError> {
|
|
1414
|
+
return safeParse(
|
|
1415
|
+
jsonString,
|
|
1416
|
+
(x) => AgentThoughtStreamingEvent$inboundSchema.parse(JSON.parse(x)),
|
|
1417
|
+
`Failed to parse 'AgentThoughtStreamingEvent' from JSON`,
|
|
1418
|
+
);
|
|
1419
|
+
}
|