@mistralai/mistralai 3.3.0 → 3.4.0
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/esm/extra/realtime/connection.d.ts +16 -3
- package/esm/extra/realtime/connection.d.ts.map +1 -1
- package/esm/extra/realtime/connection.js +35 -9
- package/esm/extra/realtime/connection.js.map +1 -1
- package/esm/extra/realtime/errors.d.ts +18 -0
- package/esm/extra/realtime/errors.d.ts.map +1 -1
- package/esm/extra/realtime/errors.js +19 -0
- package/esm/extra/realtime/errors.js.map +1 -1
- package/esm/extra/realtime/index.d.ts +20 -1
- package/esm/extra/realtime/index.d.ts.map +1 -1
- package/esm/extra/realtime/index.js +5 -0
- package/esm/extra/realtime/index.js.map +1 -1
- package/esm/extra/realtime/speech.d.ts +64 -0
- package/esm/extra/realtime/speech.d.ts.map +1 -0
- package/esm/extra/realtime/speech.js +461 -0
- package/esm/extra/realtime/speech.js.map +1 -0
- package/esm/extra/realtime/transcription.d.ts +2 -2
- package/esm/extra/realtime/transcription.d.ts.map +1 -1
- package/esm/extra/realtime/transcription.js +11 -2
- package/esm/extra/realtime/transcription.js.map +1 -1
- package/esm/extra/workflows/encoding/payload-encoder.d.ts.map +1 -1
- package/esm/extra/workflows/encoding/payload-encoder.js +2 -2
- package/esm/extra/workflows/encoding/payload-encoder.js.map +1 -1
- package/esm/extra/workflows/encoding/python-json.d.ts +3 -2
- package/esm/extra/workflows/encoding/python-json.d.ts.map +1 -1
- package/esm/extra/workflows/encoding/python-json.js +24 -9
- package/esm/extra/workflows/encoding/python-json.js.map +1 -1
- package/esm/funcs/betaRagManagedIndexesCreate.js +1 -1
- package/esm/funcs/betaRagManagedIndexesCreate.js.map +1 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/components/connectionpreference.d.ts +12 -2
- package/esm/models/components/connectionpreference.d.ts.map +1 -1
- package/esm/models/components/connectionpreference.js +3 -3
- package/esm/models/components/connectionpreference.js.map +1 -1
- package/esm/models/components/index.d.ts +11 -5
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +11 -5
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/observabilityerrorcode.d.ts +1 -0
- package/esm/models/components/observabilityerrorcode.d.ts.map +1 -1
- package/esm/models/components/observabilityerrorcode.js +1 -0
- package/esm/models/components/observabilityerrorcode.js.map +1 -1
- package/esm/models/components/realtimespeecherror.d.ts +20 -0
- package/esm/models/components/realtimespeecherror.d.ts.map +1 -0
- package/esm/models/components/realtimespeecherror.js +23 -0
- package/esm/models/components/realtimespeecherror.js.map +1 -0
- package/esm/models/components/realtimespeecherrordetail.d.ts +45 -0
- package/esm/models/components/realtimespeecherrordetail.d.ts.map +1 -0
- package/esm/models/components/realtimespeecherrordetail.js +33 -0
- package/esm/models/components/realtimespeecherrordetail.js.map +1 -0
- package/esm/models/components/realtimespeechinputtextappend.d.ts +19 -0
- package/esm/models/components/realtimespeechinputtextappend.d.ts.map +1 -0
- package/esm/models/components/realtimespeechinputtextappend.js +22 -0
- package/esm/models/components/realtimespeechinputtextappend.js.map +1 -0
- package/esm/models/components/realtimespeechinputtextend.d.ts +17 -0
- package/esm/models/components/realtimespeechinputtextend.d.ts.map +1 -0
- package/esm/models/components/realtimespeechinputtextend.js +20 -0
- package/esm/models/components/realtimespeechinputtextend.js.map +1 -0
- package/esm/models/components/realtimespeechinputtextflush.d.ts +19 -0
- package/esm/models/components/realtimespeechinputtextflush.d.ts.map +1 -0
- package/esm/models/components/realtimespeechinputtextflush.js +22 -0
- package/esm/models/components/realtimespeechinputtextflush.js.map +1 -0
- package/esm/models/components/realtimespeechsession.d.ts +31 -0
- package/esm/models/components/realtimespeechsession.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsession.js +49 -0
- package/esm/models/components/realtimespeechsession.js.map +1 -0
- package/esm/models/components/realtimespeechsessioncreated.d.ts +20 -0
- package/esm/models/components/realtimespeechsessioncreated.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsessioncreated.js +23 -0
- package/esm/models/components/realtimespeechsessioncreated.js.map +1 -0
- package/esm/models/components/realtimespeechsessionupdated.d.ts +20 -0
- package/esm/models/components/realtimespeechsessionupdated.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsessionupdated.js +23 -0
- package/esm/models/components/realtimespeechsessionupdated.js.map +1 -0
- package/esm/models/components/realtimespeechsessionupdatemessage.d.ts +20 -0
- package/esm/models/components/realtimespeechsessionupdatemessage.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsessionupdatemessage.js +23 -0
- package/esm/models/components/realtimespeechsessionupdatemessage.js.map +1 -0
- package/esm/models/components/realtimespeechsessionupdatepayload.d.ts +42 -0
- package/esm/models/components/realtimespeechsessionupdatepayload.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsessionupdatepayload.js +45 -0
- package/esm/models/components/realtimespeechsessionupdatepayload.js.map +1 -0
- package/esm/models/components/realtimespeechstreamingmode.d.ts +12 -0
- package/esm/models/components/realtimespeechstreamingmode.d.ts.map +1 -0
- package/esm/models/components/realtimespeechstreamingmode.js +13 -0
- package/esm/models/components/realtimespeechstreamingmode.js.map +1 -0
- package/esm/models/components/speechoutputformat.d.ts +2 -0
- package/esm/models/components/speechoutputformat.d.ts.map +1 -1
- package/esm/models/components/speechoutputformat.js +3 -1
- package/esm/models/components/speechoutputformat.js.map +1 -1
- package/esm/models/components/speechstreamaudiodelta.d.ts +8 -0
- package/esm/models/components/speechstreamaudiodelta.d.ts.map +1 -1
- package/esm/models/components/speechstreamaudiodelta.js +12 -0
- package/esm/models/components/speechstreamaudiodelta.js.map +1 -1
- package/esm/models/components/speechstreamdone.d.ts +10 -2
- package/esm/models/components/speechstreamdone.d.ts.map +1 -1
- package/esm/models/components/speechstreamdone.js +10 -2
- package/esm/models/components/speechstreamdone.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +12 -12
- package/src/extra/realtime/connection.ts +88 -13
- package/src/extra/realtime/errors.ts +32 -0
- package/src/extra/realtime/index.ts +42 -1
- package/src/extra/realtime/speech.ts +646 -0
- package/src/extra/realtime/transcription.ts +22 -9
- package/src/extra/workflows/encoding/payload-encoder.ts +2 -1
- package/src/extra/workflows/encoding/python-json.ts +34 -8
- package/src/funcs/betaRagManagedIndexesCreate.ts +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/connectionpreference.ts +15 -5
- package/src/models/components/index.ts +11 -5
- package/src/models/components/observabilityerrorcode.ts +2 -0
- package/src/models/components/realtimespeecherror.ts +59 -0
- package/src/models/components/realtimespeecherrordetail.ts +100 -0
- package/src/models/components/realtimespeechinputtextappend.ts +55 -0
- package/src/models/components/realtimespeechinputtextend.ts +49 -0
- package/src/models/components/realtimespeechinputtextflush.ts +55 -0
- package/src/models/components/realtimespeechsession.ts +98 -0
- package/src/models/components/realtimespeechsessioncreated.ts +61 -0
- package/src/models/components/realtimespeechsessionupdated.ts +61 -0
- package/src/models/components/realtimespeechsessionupdatemessage.ts +62 -0
- package/src/models/components/realtimespeechsessionupdatepayload.ts +108 -0
- package/src/models/components/realtimespeechstreamingmode.ts +23 -0
- package/src/models/components/speechoutputformat.ts +5 -1
- package/src/models/components/speechstreamaudiodelta.ts +25 -0
- package/src/models/components/speechstreamdone.ts +28 -5
- package/tests/extra/realtime-speech-ws.test.ts +193 -0
- package/tests/extra/realtime-speech.test.ts +532 -0
- package/tests/extra/realtime.test.ts +217 -0
- package/tests/extra/workflow-encryption.test.ts +2 -2
- package/tests/hooks/workflow-encoding.test.ts +1 -1
- package/esm/models/components/completiontokensdetails.d.ts +0 -19
- package/esm/models/components/completiontokensdetails.d.ts.map +0 -1
- package/esm/models/components/completiontokensdetails.js +0 -18
- package/esm/models/components/completiontokensdetails.js.map +0 -1
- package/esm/models/components/messagetokens.d.ts +0 -18
- package/esm/models/components/messagetokens.d.ts.map +0 -1
- package/esm/models/components/messagetokens.js +0 -26
- package/esm/models/components/messagetokens.js.map +0 -1
- package/esm/models/components/prompttokensdetails.d.ts +0 -16
- package/esm/models/components/prompttokensdetails.d.ts.map +0 -1
- package/esm/models/components/prompttokensdetails.js +0 -22
- package/esm/models/components/prompttokensdetails.js.map +0 -1
- package/esm/models/components/roles.d.ts +0 -12
- package/esm/models/components/roles.d.ts.map +0 -1
- package/esm/models/components/roles.js +0 -14
- package/esm/models/components/roles.js.map +0 -1
- package/esm/models/components/usageinfodollardefs.d.ts +0 -24
- package/esm/models/components/usageinfodollardefs.d.ts.map +0 -1
- package/esm/models/components/usageinfodollardefs.js +0 -41
- package/esm/models/components/usageinfodollardefs.js.map +0 -1
- package/src/models/components/completiontokensdetails.ts +0 -44
- package/src/models/components/messagetokens.ts +0 -47
- package/src/models/components/prompttokensdetails.ts +0 -44
- package/src/models/components/roles.ts +0 -19
- package/src/models/components/usageinfodollardefs.ts +0 -76
|
@@ -170,6 +170,55 @@ describe("RealtimeConnection async iterator", () => {
|
|
|
170
170
|
await donePromise;
|
|
171
171
|
});
|
|
172
172
|
|
|
173
|
+
it.each([
|
|
174
|
+
[{ type: "turn.start", time_s: 1.84 }, { type: "turn.start", timeS: 1.84 }],
|
|
175
|
+
[{ type: "turn.eager_end", time_s: 2.5 }, { type: "turn.eager_end", timeS: 2.5 }],
|
|
176
|
+
[{ type: "turn.resume", time_s: 2.9 }, { type: "turn.resume", timeS: 2.9 }],
|
|
177
|
+
[
|
|
178
|
+
{ type: "turn.end", time_s: 4.4, end_reason: "threshold" },
|
|
179
|
+
{ type: "turn.end", timeS: 4.4, endReason: "threshold" },
|
|
180
|
+
],
|
|
181
|
+
])("parses turn detection event %j", async (payload, expected) => {
|
|
182
|
+
const { MockWebSocket } = getMockModule();
|
|
183
|
+
const ws = new MockWebSocket();
|
|
184
|
+
const connection = new RealtimeConnection(
|
|
185
|
+
ws as unknown as WebSocket,
|
|
186
|
+
makeSession(),
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
const iterator = connection[Symbol.asyncIterator]();
|
|
190
|
+
const result = await collectNext(iterator, ws, payload);
|
|
191
|
+
|
|
192
|
+
expect(result.value).toEqual(expected);
|
|
193
|
+
|
|
194
|
+
const donePromise = iterator.next();
|
|
195
|
+
ws.close();
|
|
196
|
+
await donePromise;
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it.each([
|
|
200
|
+
{ type: "turn.start" },
|
|
201
|
+
{ type: "turn.end", time_s: 4.4, end_reason: "unexpected" },
|
|
202
|
+
])("yields UnknownRealtimeEvent for invalid turn event %j", async (payload) => {
|
|
203
|
+
const { MockWebSocket } = getMockModule();
|
|
204
|
+
const ws = new MockWebSocket();
|
|
205
|
+
const connection = new RealtimeConnection(
|
|
206
|
+
ws as unknown as WebSocket,
|
|
207
|
+
makeSession(),
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
const iterator = connection[Symbol.asyncIterator]();
|
|
211
|
+
const result = await collectNext(iterator, ws, payload);
|
|
212
|
+
|
|
213
|
+
expect(result.value.type).toBe(payload.type);
|
|
214
|
+
expect(result.value.raw).toEqual(payload);
|
|
215
|
+
expect(result.value.error).toBeInstanceOf(Error);
|
|
216
|
+
|
|
217
|
+
const donePromise = iterator.next();
|
|
218
|
+
ws.close();
|
|
219
|
+
await donePromise;
|
|
220
|
+
});
|
|
221
|
+
|
|
173
222
|
it("yields UnknownRealtimeEvent on schema parse failure", async () => {
|
|
174
223
|
const { MockWebSocket } = getMockModule();
|
|
175
224
|
const ws = new MockWebSocket();
|
|
@@ -193,6 +242,105 @@ describe("RealtimeConnection async iterator", () => {
|
|
|
193
242
|
});
|
|
194
243
|
});
|
|
195
244
|
|
|
245
|
+
describe("RealtimeConnection.updateSession", () => {
|
|
246
|
+
it.each<[
|
|
247
|
+
string,
|
|
248
|
+
Parameters<InstanceType<typeof RealtimeConnection>["updateSession"]>,
|
|
249
|
+
Record<string, unknown>,
|
|
250
|
+
]>([
|
|
251
|
+
[
|
|
252
|
+
"an audio format only",
|
|
253
|
+
[{ encoding: "pcm_s16le", sampleRate: 24000 }, {}],
|
|
254
|
+
{ audio_format: { encoding: "pcm_s16le", sample_rate: 24000 } },
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
"Voxtral 3 session fields",
|
|
258
|
+
[
|
|
259
|
+
undefined,
|
|
260
|
+
{
|
|
261
|
+
diarize: true,
|
|
262
|
+
contextBias: ["Voxtral", "Harmattan"],
|
|
263
|
+
language: "en",
|
|
264
|
+
speakerReferences: { alice: "UklGRg==" },
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
{
|
|
268
|
+
diarize: true,
|
|
269
|
+
context_bias: ["Voxtral", "Harmattan"],
|
|
270
|
+
language: "en",
|
|
271
|
+
speaker_references: { alice: "UklGRg==" },
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
[
|
|
275
|
+
"turn detection",
|
|
276
|
+
[undefined, { turnDetection: { startThreshold: 0.8, endThreshold: 0.2 } }],
|
|
277
|
+
{
|
|
278
|
+
turn_detection: {
|
|
279
|
+
start_threshold: 0.8,
|
|
280
|
+
eager_end_threshold: 0.5,
|
|
281
|
+
end_threshold: 0.2,
|
|
282
|
+
min_silence_ms: 500,
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
],
|
|
286
|
+
])("sends %s as a snake_case session.update", async (_label, args, expected) => {
|
|
287
|
+
const { MockWebSocket } = getMockModule();
|
|
288
|
+
const ws = new MockWebSocket();
|
|
289
|
+
const connection = new RealtimeConnection(
|
|
290
|
+
ws as unknown as WebSocket,
|
|
291
|
+
makeSession(),
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
await connection.updateSession(...args);
|
|
295
|
+
|
|
296
|
+
expect(ws.sent.map((message) => JSON.parse(message))).toEqual([
|
|
297
|
+
{ type: "session.update", session: expected },
|
|
298
|
+
]);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it("only sends known session fields and tracks the audio format argument", async () => {
|
|
302
|
+
const { MockWebSocket } = getMockModule();
|
|
303
|
+
const ws = new MockWebSocket();
|
|
304
|
+
const connection = new RealtimeConnection(
|
|
305
|
+
ws as unknown as WebSocket,
|
|
306
|
+
makeSession(),
|
|
307
|
+
);
|
|
308
|
+
const options = {
|
|
309
|
+
language: "en",
|
|
310
|
+
audioFormat: { encoding: AudioEncoding.PcmS16le, sampleRate: 8000 },
|
|
311
|
+
timeoutMs: 1000,
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
await connection.updateSession(undefined, options);
|
|
315
|
+
expect(connection.audioFormat.sampleRate).toBe(16000);
|
|
316
|
+
|
|
317
|
+
await connection.updateSession({ encoding: AudioEncoding.PcmS16le, sampleRate: 24000 });
|
|
318
|
+
expect(connection.audioFormat.sampleRate).toBe(24000);
|
|
319
|
+
|
|
320
|
+
expect(ws.sent.map((message) => JSON.parse(message))).toEqual([
|
|
321
|
+
{ type: "session.update", session: { language: "en" } },
|
|
322
|
+
{
|
|
323
|
+
type: "session.update",
|
|
324
|
+
session: { audio_format: { encoding: "pcm_s16le", sample_rate: 24000 } },
|
|
325
|
+
},
|
|
326
|
+
]);
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
it("rejects an empty update", async () => {
|
|
330
|
+
const { MockWebSocket } = getMockModule();
|
|
331
|
+
const ws = new MockWebSocket();
|
|
332
|
+
const connection = new RealtimeConnection(
|
|
333
|
+
ws as unknown as WebSocket,
|
|
334
|
+
makeSession(),
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
await expect(connection.updateSession()).rejects.toThrow(
|
|
338
|
+
"At least one session field must be provided",
|
|
339
|
+
);
|
|
340
|
+
expect(ws.sent).toEqual([]);
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
|
|
196
344
|
describe("RealtimeTranscription handshake", () => {
|
|
197
345
|
it("replays pre-session events", async () => {
|
|
198
346
|
const { getLastSocket } = getMockModule();
|
|
@@ -225,6 +373,67 @@ describe("RealtimeTranscription handshake", () => {
|
|
|
225
373
|
await donePromise;
|
|
226
374
|
});
|
|
227
375
|
|
|
376
|
+
it("sends session options in one session.update after the handshake", async () => {
|
|
377
|
+
const client = new RealtimeTranscription({
|
|
378
|
+
apiKey: "test",
|
|
379
|
+
serverURL: "wss://example.com",
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
const previousSocket = getMockModule().getLastSocket();
|
|
383
|
+
const connectPromise = client.connect("voxtral-realtime", {
|
|
384
|
+
audioFormat: { encoding: AudioEncoding.PcmS16le, sampleRate: 16000 },
|
|
385
|
+
language: "fr",
|
|
386
|
+
turnDetection: {},
|
|
387
|
+
timeoutMs: 5000,
|
|
388
|
+
});
|
|
389
|
+
const ws = await waitForSocket(previousSocket);
|
|
390
|
+
ws.emitMessage(makeSessionCreatedMessage());
|
|
391
|
+
const connection = await connectPromise;
|
|
392
|
+
await connection.close();
|
|
393
|
+
|
|
394
|
+
expect(ws.sent.map((message) => JSON.parse(message))).toEqual([
|
|
395
|
+
{
|
|
396
|
+
type: "session.update",
|
|
397
|
+
session: {
|
|
398
|
+
audio_format: { encoding: "pcm_s16le", sample_rate: 16000 },
|
|
399
|
+
language: "fr",
|
|
400
|
+
turn_detection: {
|
|
401
|
+
start_threshold: 0.5,
|
|
402
|
+
eager_end_threshold: 0.5,
|
|
403
|
+
end_threshold: 0.33,
|
|
404
|
+
min_silence_ms: 500,
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
]);
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it.each<[string, Record<string, unknown>]>([
|
|
412
|
+
[
|
|
413
|
+
"only connection options",
|
|
414
|
+
{
|
|
415
|
+
serverUrl: "wss://example.com",
|
|
416
|
+
timeoutMs: 5000,
|
|
417
|
+
httpHeaders: { "x-test": "1" },
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
["unknown options", { timeoutMs: 5000, signal: {}, audio_format: {} }],
|
|
421
|
+
])("sends no session.update with %s", async (_label, options) => {
|
|
422
|
+
const client = new RealtimeTranscription({
|
|
423
|
+
apiKey: "test",
|
|
424
|
+
serverURL: "wss://example.com",
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
const previousSocket = getMockModule().getLastSocket();
|
|
428
|
+
const connectPromise = client.connect("voxtral-realtime", options);
|
|
429
|
+
const ws = await waitForSocket(previousSocket);
|
|
430
|
+
ws.emitMessage(makeSessionCreatedMessage());
|
|
431
|
+
const connection = await connectPromise;
|
|
432
|
+
|
|
433
|
+
expect(ws.sent).toEqual([]);
|
|
434
|
+
await connection.close();
|
|
435
|
+
});
|
|
436
|
+
|
|
228
437
|
it("throws RealtimeTranscriptionWSError on server error", async () => {
|
|
229
438
|
const { getLastSocket } = getMockModule();
|
|
230
439
|
const client = new RealtimeTranscription({
|
|
@@ -313,6 +522,7 @@ describe("RealtimeTranscription.transcribeStream", () => {
|
|
|
313
522
|
encoding: AudioEncoding.PcmS16le,
|
|
314
523
|
sampleRate: 16000,
|
|
315
524
|
},
|
|
525
|
+
diarize: true,
|
|
316
526
|
},
|
|
317
527
|
)) {
|
|
318
528
|
events.push(event as { type: string });
|
|
@@ -338,6 +548,13 @@ describe("RealtimeTranscription.transcribeStream", () => {
|
|
|
338
548
|
|
|
339
549
|
const events = await eventsPromise;
|
|
340
550
|
expect(events.map((event) => event.type)).toContain("transcription.done");
|
|
551
|
+
expect(JSON.parse(ws.sent[0]!)).toEqual({
|
|
552
|
+
type: "session.update",
|
|
553
|
+
session: {
|
|
554
|
+
audio_format: { encoding: "pcm_s16le", sample_rate: 16000 },
|
|
555
|
+
diarize: true,
|
|
556
|
+
},
|
|
557
|
+
});
|
|
341
558
|
const sentMessageTypes = ws.sent.map((message) => {
|
|
342
559
|
const parsed = JSON.parse(message) as { type?: string };
|
|
343
560
|
return parsed.type;
|
|
@@ -189,7 +189,7 @@ describe("PayloadEncoder", () => {
|
|
|
189
189
|
expect(encoded.encoding_options).toEqual([
|
|
190
190
|
EncodedPayloadOptions.PartiallyEncrypted,
|
|
191
191
|
]);
|
|
192
|
-
expect(plaintext).toContain("\"user\"
|
|
192
|
+
expect(plaintext).toContain("\"user\":\"alice\"");
|
|
193
193
|
expect(plaintext).not.toContain("s3cr3t");
|
|
194
194
|
});
|
|
195
195
|
|
|
@@ -202,7 +202,7 @@ describe("PayloadEncoder", () => {
|
|
|
202
202
|
|
|
203
203
|
expect(encoded.encoding_options).toEqual([]);
|
|
204
204
|
expect(Buffer.from(encoded.b64payload, "base64").toString()).toBe(
|
|
205
|
-
"{\"a\":
|
|
205
|
+
"{\"a\":1}",
|
|
206
206
|
);
|
|
207
207
|
});
|
|
208
208
|
|
|
@@ -195,7 +195,7 @@ describe("WorkflowEncodingHook", () => {
|
|
|
195
195
|
const sent = await requests[0]!.json();
|
|
196
196
|
expect(sent.input.encoding_options).toEqual(["encrypted-partial"]);
|
|
197
197
|
const plaintext = Buffer.from(sent.input.b64payload, "base64").toString();
|
|
198
|
-
expect(plaintext).toContain("\"by\"
|
|
198
|
+
expect(plaintext).toContain("\"by\":\"bob\"");
|
|
199
199
|
expect(plaintext).not.toContain("t0k3n");
|
|
200
200
|
});
|
|
201
201
|
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
-
/**
|
|
5
|
-
* Token usage details for the completion.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
*
|
|
9
|
-
* ``reasoning_tokens`` is ``None`` when the provider did not report a count.
|
|
10
|
-
* Preserve that distinction instead of inventing a measured zero: ``0`` means
|
|
11
|
-
* "reasoning off, confirmed by the provider", ``None`` means "unknown".
|
|
12
|
-
*/
|
|
13
|
-
export type CompletionTokensDetails = {
|
|
14
|
-
reasoningTokens?: number | null | undefined;
|
|
15
|
-
};
|
|
16
|
-
/** @internal */
|
|
17
|
-
export declare const CompletionTokensDetails$inboundSchema: z.ZodType<CompletionTokensDetails, unknown>;
|
|
18
|
-
export declare function completionTokensDetailsFromJSON(jsonString: string): SafeParseResult<CompletionTokensDetails, SDKValidationError>;
|
|
19
|
-
//# sourceMappingURL=completiontokensdetails.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"completiontokensdetails.d.ts","sourceRoot":"","sources":["../../../src/models/components/completiontokensdetails.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,qCAAqC,EAAE,CAAC,CAAC,OAAO,CAC3D,uBAAuB,EACvB,OAAO,CAOP,CAAC;AAEH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAM9D"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
import * as z from "zod/v4";
|
|
5
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
/** @internal */
|
|
8
|
-
export const CompletionTokensDetails$inboundSchema = z.object({
|
|
9
|
-
reasoning_tokens: z.nullable(z.int()).optional(),
|
|
10
|
-
}).transform((v) => {
|
|
11
|
-
return remap$(v, {
|
|
12
|
-
"reasoning_tokens": "reasoningTokens",
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
export function completionTokensDetailsFromJSON(jsonString) {
|
|
16
|
-
return safeParse(jsonString, (x) => CompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompletionTokensDetails' from JSON`);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=completiontokensdetails.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"completiontokensdetails.js","sourceRoot":"","sources":["../../../src/models/components/completiontokensdetails.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAiBjD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qCAAqC,GAG9C,CAAC,CAAC,MAAM,CAAC;IACX,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC,CAAC,EAAE;QACf,kBAAkB,EAAE,iBAAiB;KACtC,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC;AAEH,MAAM,UAAU,+BAA+B,CAC7C,UAAkB,EAC4C;IAC9D,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,qCAAqC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACjE,qDAAqD,CACtD,CAAC;AAAA,CACH"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
-
import { Roles } from "./roles.js";
|
|
5
|
-
/**
|
|
6
|
-
* Information on a single message included in a tokenized prompt as part of an InstructRequest.
|
|
7
|
-
*/
|
|
8
|
-
export type MessageTokens = {
|
|
9
|
-
role: Roles;
|
|
10
|
-
totalTokens?: number | null | undefined;
|
|
11
|
-
settingsTokens?: number | null | undefined;
|
|
12
|
-
truncated: boolean;
|
|
13
|
-
usageCount: number;
|
|
14
|
-
};
|
|
15
|
-
/** @internal */
|
|
16
|
-
export declare const MessageTokens$inboundSchema: z.ZodType<MessageTokens, unknown>;
|
|
17
|
-
export declare function messageTokensFromJSON(jsonString: string): SafeParseResult<MessageTokens, SDKValidationError>;
|
|
18
|
-
//# sourceMappingURL=messagetokens.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messagetokens.d.ts","sourceRoot":"","sources":["../../../src/models/components/messagetokens.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAuB,MAAM,YAAY,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAatE,CAAC;AAEL,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAMpD"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
import * as z from "zod/v4";
|
|
5
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
import { Roles$inboundSchema } from "./roles.js";
|
|
8
|
-
/** @internal */
|
|
9
|
-
export const MessageTokens$inboundSchema = z
|
|
10
|
-
.object({
|
|
11
|
-
role: Roles$inboundSchema,
|
|
12
|
-
total_tokens: z.nullable(z.int()).optional(),
|
|
13
|
-
settings_tokens: z.nullable(z.int()).optional(),
|
|
14
|
-
truncated: z.boolean().default(false),
|
|
15
|
-
usage_count: z.int().default(1),
|
|
16
|
-
}).transform((v) => {
|
|
17
|
-
return remap$(v, {
|
|
18
|
-
"total_tokens": "totalTokens",
|
|
19
|
-
"settings_tokens": "settingsTokens",
|
|
20
|
-
"usage_count": "usageCount",
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
export function messageTokensFromJSON(jsonString) {
|
|
24
|
-
return safeParse(jsonString, (x) => MessageTokens$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MessageTokens' from JSON`);
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=messagetokens.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messagetokens.js","sourceRoot":"","sources":["../../../src/models/components/messagetokens.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAS,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAaxD,gBAAgB;AAChB,MAAM,CAAC,MAAM,2BAA2B,GAAsC,CAAC;KAC5E,MAAM,CAAC;IACN,IAAI,EAAE,mBAAmB;IACzB,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC/C,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACrC,WAAW,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC,CAAC,EAAE;QACf,cAAc,EAAE,aAAa;QAC7B,iBAAiB,EAAE,gBAAgB;QACnC,aAAa,EAAE,YAAY;KAC5B,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC;AAEL,MAAM,UAAU,qBAAqB,CACnC,UAAkB,EACkC;IACpD,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACvD,2CAA2C,CAC5C,CAAC;AAAA,CACH"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
-
import { MessageTokens } from "./messagetokens.js";
|
|
5
|
-
/**
|
|
6
|
-
* Token usage details for the prompt.
|
|
7
|
-
*/
|
|
8
|
-
export type PromptTokensDetails = {
|
|
9
|
-
messages?: Array<MessageTokens> | undefined;
|
|
10
|
-
cachedTokens: number;
|
|
11
|
-
audioTokens: number;
|
|
12
|
-
};
|
|
13
|
-
/** @internal */
|
|
14
|
-
export declare const PromptTokensDetails$inboundSchema: z.ZodType<PromptTokensDetails, unknown>;
|
|
15
|
-
export declare function promptTokensDetailsFromJSON(jsonString: string): SafeParseResult<PromptTokensDetails, SDKValidationError>;
|
|
16
|
-
//# sourceMappingURL=prompttokensdetails.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompttokensdetails.d.ts","sourceRoot":"","sources":["../../../src/models/components/prompttokensdetails.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,aAAa,EAA+B,MAAM,oBAAoB,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,iCAAiC,EAAE,CAAC,CAAC,OAAO,CACvD,mBAAmB,EACnB,OAAO,CAUP,CAAC;AAEH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAM1D"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
import * as z from "zod/v4";
|
|
5
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
import { MessageTokens$inboundSchema } from "./messagetokens.js";
|
|
8
|
-
/** @internal */
|
|
9
|
-
export const PromptTokensDetails$inboundSchema = z.object({
|
|
10
|
-
messages: z.array(MessageTokens$inboundSchema).optional(),
|
|
11
|
-
cached_tokens: z.int().default(0),
|
|
12
|
-
audio_tokens: z.int().default(0),
|
|
13
|
-
}).transform((v) => {
|
|
14
|
-
return remap$(v, {
|
|
15
|
-
"cached_tokens": "cachedTokens",
|
|
16
|
-
"audio_tokens": "audioTokens",
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
export function promptTokensDetailsFromJSON(jsonString) {
|
|
20
|
-
return safeParse(jsonString, (x) => PromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PromptTokensDetails' from JSON`);
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=prompttokensdetails.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompttokensdetails.js","sourceRoot":"","sources":["../../../src/models/components/prompttokensdetails.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAiB,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAWhF,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAG1C,CAAC,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE;IACzD,aAAa,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACjC,YAAY,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CACjC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC,CAAC,EAAE;QACf,eAAe,EAAE,cAAc;QAC/B,cAAc,EAAE,aAAa;KAC9B,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC;AAEH,MAAM,UAAU,2BAA2B,CACzC,UAAkB,EACwC;IAC1D,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,iCAAiC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC7D,iDAAiD,CAClD,CAAC;AAAA,CACH"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
import { OpenEnum } from "../../types/enums.js";
|
|
3
|
-
export declare const Roles: {
|
|
4
|
-
readonly System: "system";
|
|
5
|
-
readonly User: "user";
|
|
6
|
-
readonly Assistant: "assistant";
|
|
7
|
-
readonly Tool: "tool";
|
|
8
|
-
};
|
|
9
|
-
export type Roles = OpenEnum<typeof Roles>;
|
|
10
|
-
/** @internal */
|
|
11
|
-
export declare const Roles$inboundSchema: z.ZodType<Roles, unknown>;
|
|
12
|
-
//# sourceMappingURL=roles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../src/models/components/roles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,eAAO,MAAM,KAAK;;;;;CAKR,CAAC;AACX,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAE3C,gBAAgB;AAChB,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CACnC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
import * as openEnums from "../../types/enums.js";
|
|
5
|
-
export const Roles = {
|
|
6
|
-
System: "system",
|
|
7
|
-
User: "user",
|
|
8
|
-
Assistant: "assistant",
|
|
9
|
-
Tool: "tool",
|
|
10
|
-
};
|
|
11
|
-
/** @internal */
|
|
12
|
-
export const Roles$inboundSchema = openEnums
|
|
13
|
-
.inboundSchema(Roles);
|
|
14
|
-
//# sourceMappingURL=roles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../../src/models/components/roles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAGlD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;CACJ,CAAC;AAGX,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAA8B,SAAS;KACpE,aAAa,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v4";
|
|
2
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
-
import { CompletionTokensDetails } from "./completiontokensdetails.js";
|
|
5
|
-
import { PromptTokensDetails } from "./prompttokensdetails.js";
|
|
6
|
-
export type UsageInfoDollarDefs = {
|
|
7
|
-
promptAudioSeconds?: number | null | undefined;
|
|
8
|
-
promptTokens: number;
|
|
9
|
-
totalTokens: number;
|
|
10
|
-
completionTokens?: number | null | undefined;
|
|
11
|
-
requestCount?: number | null | undefined;
|
|
12
|
-
promptTokensDetails?: PromptTokensDetails | null | undefined;
|
|
13
|
-
completionTokensDetails?: CompletionTokensDetails | null | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* The service tier at which the request was processed: standard or priority.
|
|
16
|
-
*/
|
|
17
|
-
serviceTier?: string | null | undefined;
|
|
18
|
-
promptTokenDetails?: PromptTokensDetails | null | undefined;
|
|
19
|
-
numCachedTokens?: number | null | undefined;
|
|
20
|
-
};
|
|
21
|
-
/** @internal */
|
|
22
|
-
export declare const UsageInfoDollarDefs$inboundSchema: z.ZodType<UsageInfoDollarDefs, unknown>;
|
|
23
|
-
export declare function usageInfoDollarDefsFromJSON(jsonString: string): SafeParseResult<UsageInfoDollarDefs, SDKValidationError>;
|
|
24
|
-
//# sourceMappingURL=usageinfodollardefs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usageinfodollardefs.d.ts","sourceRoot":"","sources":["../../../src/models/components/usageinfodollardefs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,uBAAuB,EAExB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,mBAAmB,EAEpB,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,mBAAmB,GAAG;IAChC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7D,uBAAuB,CAAC,EAAE,uBAAuB,GAAG,IAAI,GAAG,SAAS,CAAC;IACrE;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,kBAAkB,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,iCAAiC,EAAE,CAAC,CAAC,OAAO,CACvD,mBAAmB,EACnB,OAAO,CA4BP,CAAC;AAEH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAM1D"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
import * as z from "zod/v4";
|
|
5
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
import { CompletionTokensDetails$inboundSchema, } from "./completiontokensdetails.js";
|
|
8
|
-
import { PromptTokensDetails$inboundSchema, } from "./prompttokensdetails.js";
|
|
9
|
-
/** @internal */
|
|
10
|
-
export const UsageInfoDollarDefs$inboundSchema = z.object({
|
|
11
|
-
prompt_audio_seconds: z.nullable(z.int()).optional(),
|
|
12
|
-
prompt_tokens: z.int().default(0),
|
|
13
|
-
total_tokens: z.int().default(0),
|
|
14
|
-
completion_tokens: z.nullable(z.int()).optional(),
|
|
15
|
-
request_count: z.nullable(z.int()).optional(),
|
|
16
|
-
prompt_tokens_details: z.nullable(PromptTokensDetails$inboundSchema)
|
|
17
|
-
.optional(),
|
|
18
|
-
completion_tokens_details: z.nullable(CompletionTokensDetails$inboundSchema)
|
|
19
|
-
.optional(),
|
|
20
|
-
service_tier: z.nullable(z.string()).optional(),
|
|
21
|
-
prompt_token_details: z.nullable(PromptTokensDetails$inboundSchema)
|
|
22
|
-
.optional(),
|
|
23
|
-
num_cached_tokens: z.nullable(z.int()).optional(),
|
|
24
|
-
}).transform((v) => {
|
|
25
|
-
return remap$(v, {
|
|
26
|
-
"prompt_audio_seconds": "promptAudioSeconds",
|
|
27
|
-
"prompt_tokens": "promptTokens",
|
|
28
|
-
"total_tokens": "totalTokens",
|
|
29
|
-
"completion_tokens": "completionTokens",
|
|
30
|
-
"request_count": "requestCount",
|
|
31
|
-
"prompt_tokens_details": "promptTokensDetails",
|
|
32
|
-
"completion_tokens_details": "completionTokensDetails",
|
|
33
|
-
"service_tier": "serviceTier",
|
|
34
|
-
"prompt_token_details": "promptTokenDetails",
|
|
35
|
-
"num_cached_tokens": "numCachedTokens",
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
export function usageInfoDollarDefsFromJSON(jsonString) {
|
|
39
|
-
return safeParse(jsonString, (x) => UsageInfoDollarDefs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UsageInfoDollarDefs' from JSON`);
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=usageinfodollardefs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usageinfodollardefs.js","sourceRoot":"","sources":["../../../src/models/components/usageinfodollardefs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAEL,qCAAqC,GACtC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,iCAAiC,GAClC,MAAM,0BAA0B,CAAC;AAkBlC,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAG1C,CAAC,CAAC,MAAM,CAAC;IACX,oBAAoB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpD,aAAa,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACjC,YAAY,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAChC,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IACjD,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC7C,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;SACjE,QAAQ,EAAE;IACb,yBAAyB,EAAE,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;SACzE,QAAQ,EAAE;IACb,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC/C,oBAAoB,EAAE,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;SAChE,QAAQ,EAAE;IACb,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC,CAAC,EAAE;QACf,sBAAsB,EAAE,oBAAoB;QAC5C,eAAe,EAAE,cAAc;QAC/B,cAAc,EAAE,aAAa;QAC7B,mBAAmB,EAAE,kBAAkB;QACvC,eAAe,EAAE,cAAc;QAC/B,uBAAuB,EAAE,qBAAqB;QAC9C,2BAA2B,EAAE,yBAAyB;QACtD,cAAc,EAAE,aAAa;QAC7B,sBAAsB,EAAE,oBAAoB;QAC5C,mBAAmB,EAAE,iBAAiB;KACvC,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC;AAEH,MAAM,UAAU,2BAA2B,CACzC,UAAkB,EACwC;IAC1D,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,iCAAiC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC7D,iDAAiD,CAClD,CAAC;AAAA,CACH"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Token usage details for the completion.
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
*
|
|
16
|
-
* ``reasoning_tokens`` is ``None`` when the provider did not report a count.
|
|
17
|
-
* Preserve that distinction instead of inventing a measured zero: ``0`` means
|
|
18
|
-
* "reasoning off, confirmed by the provider", ``None`` means "unknown".
|
|
19
|
-
*/
|
|
20
|
-
export type CompletionTokensDetails = {
|
|
21
|
-
reasoningTokens?: number | null | undefined;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/** @internal */
|
|
25
|
-
export const CompletionTokensDetails$inboundSchema: z.ZodType<
|
|
26
|
-
CompletionTokensDetails,
|
|
27
|
-
unknown
|
|
28
|
-
> = z.object({
|
|
29
|
-
reasoning_tokens: z.nullable(z.int()).optional(),
|
|
30
|
-
}).transform((v) => {
|
|
31
|
-
return remap$(v, {
|
|
32
|
-
"reasoning_tokens": "reasoningTokens",
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
export function completionTokensDetailsFromJSON(
|
|
37
|
-
jsonString: string,
|
|
38
|
-
): SafeParseResult<CompletionTokensDetails, SDKValidationError> {
|
|
39
|
-
return safeParse(
|
|
40
|
-
jsonString,
|
|
41
|
-
(x) => CompletionTokensDetails$inboundSchema.parse(JSON.parse(x)),
|
|
42
|
-
`Failed to parse 'CompletionTokensDetails' from JSON`,
|
|
43
|
-
);
|
|
44
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
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 { Roles, Roles$inboundSchema } from "./roles.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Information on a single message included in a tokenized prompt as part of an InstructRequest.
|
|
14
|
-
*/
|
|
15
|
-
export type MessageTokens = {
|
|
16
|
-
role: Roles;
|
|
17
|
-
totalTokens?: number | null | undefined;
|
|
18
|
-
settingsTokens?: number | null | undefined;
|
|
19
|
-
truncated: boolean;
|
|
20
|
-
usageCount: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/** @internal */
|
|
24
|
-
export const MessageTokens$inboundSchema: z.ZodType<MessageTokens, unknown> = z
|
|
25
|
-
.object({
|
|
26
|
-
role: Roles$inboundSchema,
|
|
27
|
-
total_tokens: z.nullable(z.int()).optional(),
|
|
28
|
-
settings_tokens: z.nullable(z.int()).optional(),
|
|
29
|
-
truncated: z.boolean().default(false),
|
|
30
|
-
usage_count: z.int().default(1),
|
|
31
|
-
}).transform((v) => {
|
|
32
|
-
return remap$(v, {
|
|
33
|
-
"total_tokens": "totalTokens",
|
|
34
|
-
"settings_tokens": "settingsTokens",
|
|
35
|
-
"usage_count": "usageCount",
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export function messageTokensFromJSON(
|
|
40
|
-
jsonString: string,
|
|
41
|
-
): SafeParseResult<MessageTokens, SDKValidationError> {
|
|
42
|
-
return safeParse(
|
|
43
|
-
jsonString,
|
|
44
|
-
(x) => MessageTokens$inboundSchema.parse(JSON.parse(x)),
|
|
45
|
-
`Failed to parse 'MessageTokens' from JSON`,
|
|
46
|
-
);
|
|
47
|
-
}
|