@oxyhq/contracts 0.29.0 → 0.30.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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/identity.js +33 -1
- package/dist/cjs/index.js +20 -7
- package/dist/cjs/inference/aliaModelRelease.js +250 -0
- package/dist/cjs/inference/catalogue.js +1 -4
- package/dist/cjs/inference/identifiers.js +23 -3
- package/dist/cjs/inference/request.js +188 -5
- package/dist/cjs/inference/routingPolicy.js +81 -2
- package/dist/cjs/inference/streamEvents.js +27 -0
- package/dist/cjs/inference/usage.js +32 -1
- package/dist/cjs/inference/version.js +15 -2
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/identity.js +32 -0
- package/dist/esm/index.js +8 -3
- package/dist/esm/inference/aliaModelRelease.js +247 -0
- package/dist/esm/inference/catalogue.js +2 -5
- package/dist/esm/inference/identifiers.js +22 -2
- package/dist/esm/inference/request.js +189 -6
- package/dist/esm/inference/routingPolicy.js +81 -2
- package/dist/esm/inference/streamEvents.js +27 -0
- package/dist/esm/inference/usage.js +32 -1
- package/dist/esm/inference/version.js +15 -2
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/identity.d.ts +59 -1
- package/dist/types/index.d.ts +7 -5
- package/dist/types/inference/accountBilling.d.ts +26 -26
- package/dist/types/inference/aliaModelRelease.d.ts +597 -0
- package/dist/types/inference/catalogue.d.ts +6 -6
- package/dist/types/inference/entitlement.d.ts +4 -4
- package/dist/types/inference/identifiers.d.ts +20 -2
- package/dist/types/inference/money.d.ts +4 -4
- package/dist/types/inference/priceVersion.d.ts +14 -14
- package/dist/types/inference/providerConnection.d.ts +4 -4
- package/dist/types/inference/request.d.ts +291 -5
- package/dist/types/inference/routingPolicy.d.ts +109 -13
- package/dist/types/inference/streamEvents.d.ts +53 -26
- package/dist/types/inference/usage.d.ts +103 -79
- package/dist/types/inference/version.d.ts +15 -2
- package/dist/types/keyRecovery.d.ts +4 -4
- package/package.json +1 -1
|
@@ -22,7 +22,14 @@
|
|
|
22
22
|
* REJECTED, rather than being quietly resolved by whichever field the executor
|
|
23
23
|
* happens to read first. That rejection is `routingPolicySchema`'s refinement.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* **The policy itself never crosses to the data plane.** What crosses is
|
|
26
|
+
* {@link authorizedRouteSchema} — the candidate routes that SURVIVED these
|
|
27
|
+
* controls, in preference order — plus {@link routingPolicyReferenceSchema} as
|
|
28
|
+
* provenance for the receipt. The data plane holds no control value and needs
|
|
29
|
+
* none: it fails over by taking the next entry. See ADR 0017.
|
|
30
|
+
*
|
|
31
|
+
* Decided in: docs/adr/0008-catalogue-concept-separation.md,
|
|
32
|
+
* docs/adr/0017-authorized-routes-in-the-envelope.md, issue #972 workstream 6.
|
|
26
33
|
*/
|
|
27
34
|
import { z } from 'zod';
|
|
28
35
|
/**
|
|
@@ -170,13 +177,13 @@ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
170
177
|
per: z.ZodNumber;
|
|
171
178
|
currency: z.ZodString;
|
|
172
179
|
}, "strict", z.ZodTypeAny, {
|
|
173
|
-
amount: string & z.BRAND<"ExactDecimal">;
|
|
174
180
|
currency: string;
|
|
181
|
+
amount: string & z.BRAND<"ExactDecimal">;
|
|
175
182
|
unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
|
|
176
183
|
per: number;
|
|
177
184
|
}, {
|
|
178
|
-
amount: string;
|
|
179
185
|
currency: string;
|
|
186
|
+
amount: string;
|
|
180
187
|
unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
|
|
181
188
|
per: number;
|
|
182
189
|
}>, "many">>;
|
|
@@ -184,11 +191,11 @@ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
184
191
|
amount: z.ZodBranded<z.ZodString, "ExactDecimal">;
|
|
185
192
|
currency: z.ZodString;
|
|
186
193
|
}, "strict", z.ZodTypeAny, {
|
|
187
|
-
amount: string & z.BRAND<"ExactDecimal">;
|
|
188
194
|
currency: string;
|
|
195
|
+
amount: string & z.BRAND<"ExactDecimal">;
|
|
189
196
|
}, {
|
|
190
|
-
amount: string;
|
|
191
197
|
currency: string;
|
|
198
|
+
amount: string;
|
|
192
199
|
}>>;
|
|
193
200
|
/** What to optimise for among the routes that qualify. */
|
|
194
201
|
optimiseFor: z.ZodEnum<["price", "latency", "throughput", "balanced"]>;
|
|
@@ -237,8 +244,8 @@ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
237
244
|
requireZeroDataRetention: boolean;
|
|
238
245
|
prohibitTrainingOnCustomerData: boolean;
|
|
239
246
|
maxPricePerUnit: {
|
|
240
|
-
amount: string & z.BRAND<"ExactDecimal">;
|
|
241
247
|
currency: string;
|
|
248
|
+
amount: string & z.BRAND<"ExactDecimal">;
|
|
242
249
|
unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
|
|
243
250
|
per: number;
|
|
244
251
|
}[];
|
|
@@ -259,8 +266,8 @@ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
259
266
|
routingProfile: string;
|
|
260
267
|
} | undefined;
|
|
261
268
|
maxPricePerRequest?: {
|
|
262
|
-
amount: string & z.BRAND<"ExactDecimal">;
|
|
263
269
|
currency: string;
|
|
270
|
+
amount: string & z.BRAND<"ExactDecimal">;
|
|
264
271
|
} | undefined;
|
|
265
272
|
}, {
|
|
266
273
|
updatedAt: string;
|
|
@@ -299,14 +306,14 @@ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
299
306
|
allowedRegions?: string[] | undefined;
|
|
300
307
|
deniedRegions?: string[] | undefined;
|
|
301
308
|
maxPricePerUnit?: {
|
|
302
|
-
amount: string;
|
|
303
309
|
currency: string;
|
|
310
|
+
amount: string;
|
|
304
311
|
unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
|
|
305
312
|
per: number;
|
|
306
313
|
}[] | undefined;
|
|
307
314
|
maxPricePerRequest?: {
|
|
308
|
-
amount: string;
|
|
309
315
|
currency: string;
|
|
316
|
+
amount: string;
|
|
310
317
|
} | undefined;
|
|
311
318
|
allowedLicenseIds?: string[] | undefined;
|
|
312
319
|
}>, {
|
|
@@ -331,8 +338,8 @@ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
331
338
|
requireZeroDataRetention: boolean;
|
|
332
339
|
prohibitTrainingOnCustomerData: boolean;
|
|
333
340
|
maxPricePerUnit: {
|
|
334
|
-
amount: string & z.BRAND<"ExactDecimal">;
|
|
335
341
|
currency: string;
|
|
342
|
+
amount: string & z.BRAND<"ExactDecimal">;
|
|
336
343
|
unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
|
|
337
344
|
per: number;
|
|
338
345
|
}[];
|
|
@@ -353,8 +360,8 @@ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
353
360
|
routingProfile: string;
|
|
354
361
|
} | undefined;
|
|
355
362
|
maxPricePerRequest?: {
|
|
356
|
-
amount: string & z.BRAND<"ExactDecimal">;
|
|
357
363
|
currency: string;
|
|
364
|
+
amount: string & z.BRAND<"ExactDecimal">;
|
|
358
365
|
} | undefined;
|
|
359
366
|
}, {
|
|
360
367
|
updatedAt: string;
|
|
@@ -393,14 +400,14 @@ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
|
|
|
393
400
|
allowedRegions?: string[] | undefined;
|
|
394
401
|
deniedRegions?: string[] | undefined;
|
|
395
402
|
maxPricePerUnit?: {
|
|
396
|
-
amount: string;
|
|
397
403
|
currency: string;
|
|
404
|
+
amount: string;
|
|
398
405
|
unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
|
|
399
406
|
per: number;
|
|
400
407
|
}[] | undefined;
|
|
401
408
|
maxPricePerRequest?: {
|
|
402
|
-
amount: string;
|
|
403
409
|
currency: string;
|
|
410
|
+
amount: string;
|
|
404
411
|
} | undefined;
|
|
405
412
|
allowedLicenseIds?: string[] | undefined;
|
|
406
413
|
}>;
|
|
@@ -419,8 +426,97 @@ export declare const routingPolicyReferenceSchema: z.ZodObject<{
|
|
|
419
426
|
routingPolicyId: string;
|
|
420
427
|
policyVersion: number;
|
|
421
428
|
}>;
|
|
429
|
+
/**
|
|
430
|
+
* One route the control plane has already authorized for one request.
|
|
431
|
+
*
|
|
432
|
+
* **Authorization is an ENTRY, never a boolean.** The same stance
|
|
433
|
+
* `inference_routing_policy_fallbacks` takes in storage: being allowed to serve
|
|
434
|
+
* a route IS appearing here, and every entry names its destination. A flag
|
|
435
|
+
* saying "substitution allowed" without naming the destination is exactly the
|
|
436
|
+
* silent substitution the platform forbids, and it invents a "flag set, list
|
|
437
|
+
* empty" state somebody then has to decide what to do with.
|
|
438
|
+
*
|
|
439
|
+
* Discriminated on `substitution`, relative to the FIRST entry — the primary
|
|
440
|
+
* route Oxy resolved:
|
|
441
|
+
*
|
|
442
|
+
* - `same_model` serves the same model line as the primary. This is
|
|
443
|
+
* availability failover between deployments of one model.
|
|
444
|
+
* - `cross_model` serves a DIFFERENT model line, and is expressible only with
|
|
445
|
+
* `authorizedByPolicy: true` as a literal. So "a model was substituted
|
|
446
|
+
* without the customer authorizing it" is not a sentence this contract can
|
|
447
|
+
* say — the same construction `inferenceRouteSwitchDetailSchema` uses to make
|
|
448
|
+
* the resulting route-switch event unreportable.
|
|
449
|
+
*/
|
|
450
|
+
export declare const authorizedRouteSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"substitution", [z.ZodObject<{
|
|
451
|
+
deploymentId: z.ZodString;
|
|
452
|
+
modelReference: z.ZodString;
|
|
453
|
+
provider: z.ZodString;
|
|
454
|
+
regions: z.ZodArray<z.ZodString, "many">;
|
|
455
|
+
substitution: z.ZodLiteral<"same_model">;
|
|
456
|
+
}, "strict", z.ZodTypeAny, {
|
|
457
|
+
provider: string;
|
|
458
|
+
modelReference: string;
|
|
459
|
+
regions: string[];
|
|
460
|
+
deploymentId: string;
|
|
461
|
+
substitution: "same_model";
|
|
462
|
+
}, {
|
|
463
|
+
provider: string;
|
|
464
|
+
modelReference: string;
|
|
465
|
+
regions: string[];
|
|
466
|
+
deploymentId: string;
|
|
467
|
+
substitution: "same_model";
|
|
468
|
+
}>, z.ZodObject<{
|
|
469
|
+
/** Literal `true`: an unauthorized substitution cannot be expressed. */
|
|
470
|
+
authorizedByPolicy: z.ZodLiteral<true>;
|
|
471
|
+
deploymentId: z.ZodString;
|
|
472
|
+
modelReference: z.ZodString;
|
|
473
|
+
provider: z.ZodString;
|
|
474
|
+
regions: z.ZodArray<z.ZodString, "many">;
|
|
475
|
+
substitution: z.ZodLiteral<"cross_model">;
|
|
476
|
+
}, "strict", z.ZodTypeAny, {
|
|
477
|
+
provider: string;
|
|
478
|
+
modelReference: string;
|
|
479
|
+
regions: string[];
|
|
480
|
+
deploymentId: string;
|
|
481
|
+
substitution: "cross_model";
|
|
482
|
+
authorizedByPolicy: true;
|
|
483
|
+
}, {
|
|
484
|
+
provider: string;
|
|
485
|
+
modelReference: string;
|
|
486
|
+
regions: string[];
|
|
487
|
+
deploymentId: string;
|
|
488
|
+
substitution: "cross_model";
|
|
489
|
+
authorizedByPolicy: true;
|
|
490
|
+
}>]>, {
|
|
491
|
+
provider: string;
|
|
492
|
+
modelReference: string;
|
|
493
|
+
regions: string[];
|
|
494
|
+
deploymentId: string;
|
|
495
|
+
substitution: "same_model";
|
|
496
|
+
} | {
|
|
497
|
+
provider: string;
|
|
498
|
+
modelReference: string;
|
|
499
|
+
regions: string[];
|
|
500
|
+
deploymentId: string;
|
|
501
|
+
substitution: "cross_model";
|
|
502
|
+
authorizedByPolicy: true;
|
|
503
|
+
}, {
|
|
504
|
+
provider: string;
|
|
505
|
+
modelReference: string;
|
|
506
|
+
regions: string[];
|
|
507
|
+
deploymentId: string;
|
|
508
|
+
substitution: "same_model";
|
|
509
|
+
} | {
|
|
510
|
+
provider: string;
|
|
511
|
+
modelReference: string;
|
|
512
|
+
regions: string[];
|
|
513
|
+
deploymentId: string;
|
|
514
|
+
substitution: "cross_model";
|
|
515
|
+
authorizedByPolicy: true;
|
|
516
|
+
}>;
|
|
422
517
|
export type RoutingTarget = z.infer<typeof routingTargetSchema>;
|
|
423
518
|
export type RoutingPolicyScope = z.infer<typeof routingPolicyScopeSchema>;
|
|
424
519
|
export type RoutingFallbackPolicy = z.infer<typeof routingFallbackPolicySchema>;
|
|
425
520
|
export type RoutingPolicy = z.infer<typeof routingPolicySchema>;
|
|
426
521
|
export type RoutingPolicyReference = z.infer<typeof routingPolicyReferenceSchema>;
|
|
522
|
+
export type AuthorizedRoute = z.infer<typeof authorizedRouteSchema>;
|
|
@@ -43,19 +43,19 @@ export declare const inferenceStreamStartEventSchema: z.ZodObject<{
|
|
|
43
43
|
}, "strip", z.ZodTypeAny, {
|
|
44
44
|
type: "start";
|
|
45
45
|
requestId: string;
|
|
46
|
-
schemaVersion: 1;
|
|
47
|
-
sequence: number;
|
|
48
46
|
resolvedModelReference: string;
|
|
49
47
|
servingProvider: string;
|
|
48
|
+
schemaVersion: 1;
|
|
49
|
+
sequence: number;
|
|
50
50
|
startedAt: string;
|
|
51
51
|
generationId?: string | undefined;
|
|
52
52
|
}, {
|
|
53
53
|
type: "start";
|
|
54
54
|
requestId: string;
|
|
55
|
-
schemaVersion: 1;
|
|
56
|
-
sequence: number;
|
|
57
55
|
resolvedModelReference: string;
|
|
58
56
|
servingProvider: string;
|
|
57
|
+
schemaVersion: 1;
|
|
58
|
+
sequence: number;
|
|
59
59
|
startedAt: string;
|
|
60
60
|
generationId?: string | undefined;
|
|
61
61
|
}>;
|
|
@@ -77,7 +77,7 @@ export declare const inferenceStreamDeltaEventSchema: z.ZodObject<{
|
|
|
77
77
|
channel: z.ZodEnum<["output_text", "reasoning", "refusal"]>;
|
|
78
78
|
text: z.ZodString;
|
|
79
79
|
}, "strip", z.ZodTypeAny, {
|
|
80
|
-
channel: "reasoning" | "
|
|
80
|
+
channel: "reasoning" | "refusal" | "output_text";
|
|
81
81
|
type: "delta";
|
|
82
82
|
requestId: string;
|
|
83
83
|
schemaVersion: 1;
|
|
@@ -85,7 +85,7 @@ export declare const inferenceStreamDeltaEventSchema: z.ZodObject<{
|
|
|
85
85
|
sequence: number;
|
|
86
86
|
outputIndex: number;
|
|
87
87
|
}, {
|
|
88
|
-
channel: "reasoning" | "
|
|
88
|
+
channel: "reasoning" | "refusal" | "output_text";
|
|
89
89
|
type: "delta";
|
|
90
90
|
requestId: string;
|
|
91
91
|
schemaVersion: 1;
|
|
@@ -136,6 +136,33 @@ export declare const inferenceStreamToolCallEventSchema: z.ZodObject<{
|
|
|
136
136
|
* derived from these units and a price version at settlement; a cost quoted by
|
|
137
137
|
* the data plane would be a second, unauthoritative answer to the same
|
|
138
138
|
* question.
|
|
139
|
+
*
|
|
140
|
+
* ## This event is MEASUREMENT EVIDENCE, never a settleable record
|
|
141
|
+
*
|
|
142
|
+
* `normalizedUsageReportSchema` is the only shape a settlement is written from,
|
|
143
|
+
* and this event is deliberately NOT a subset of it that could be widened into
|
|
144
|
+
* one. It carries units and a source; a report additionally carries the
|
|
145
|
+
* attribution block, the outcome, the resolved route, the route-switch count and
|
|
146
|
+
* the two timestamps. Every one of those is knowable only by one END of the
|
|
147
|
+
* request rather than by the frame: the outcome only by the edge, which is the
|
|
148
|
+
* only party that knows whether the CLIENT cancelled, and the route record only
|
|
149
|
+
* by the data plane.
|
|
150
|
+
*
|
|
151
|
+
* So the event is not widened, and that is a decision rather than an omission.
|
|
152
|
+
* Adding the route record and the attribution block here would repeat both on
|
|
153
|
+
* EVERY usage frame of every stream, and each repetition is one more place two
|
|
154
|
+
* frames of one stream could disagree about which route served it — a second
|
|
155
|
+
* source of truth per frame, for fields no consumer of a progress signal reads.
|
|
156
|
+
*
|
|
157
|
+
* **What the edge may do with it, and what it may not.** The units are exact and
|
|
158
|
+
* may be settled; the record around them may not be inferred. When no terminal
|
|
159
|
+
* report arrives — the ordinary case for a client disconnect, since the report
|
|
160
|
+
* frame can no longer be delivered to a connection that is gone — the edge
|
|
161
|
+
* settles the units from the last such event and takes the OUTCOME from itself,
|
|
162
|
+
* never from the event. Its outcome is then `cancelled`, `partial` or `failed`;
|
|
163
|
+
* it is never `completed`, because nothing here can witness that the customer
|
|
164
|
+
* received the whole answer. Zero units marked `estimated` is the arm for no
|
|
165
|
+
* evidence at ALL, not for a disconnect that reported some.
|
|
139
166
|
*/
|
|
140
167
|
export declare const inferenceStreamUsageEventSchema: z.ZodObject<{
|
|
141
168
|
/** See `version.ts`: each stream event is a whole message on the wire. */
|
|
@@ -216,18 +243,18 @@ export declare const inferenceRouteSwitchDetailSchema: z.ZodDiscriminatedUnion<"
|
|
|
216
243
|
authorizedByPolicy: z.ZodLiteral<true>;
|
|
217
244
|
}, "strict", z.ZodTypeAny, {
|
|
218
245
|
scope: "model";
|
|
246
|
+
authorizedByPolicy: true;
|
|
219
247
|
toProvider: string;
|
|
220
248
|
requestedModelId: string;
|
|
221
249
|
fromModelReference: string;
|
|
222
250
|
toModelReference: string;
|
|
223
|
-
authorizedByPolicy: true;
|
|
224
251
|
}, {
|
|
225
252
|
scope: "model";
|
|
253
|
+
authorizedByPolicy: true;
|
|
226
254
|
toProvider: string;
|
|
227
255
|
requestedModelId: string;
|
|
228
256
|
fromModelReference: string;
|
|
229
257
|
toModelReference: string;
|
|
230
|
-
authorizedByPolicy: true;
|
|
231
258
|
}>]>;
|
|
232
259
|
/** Why a route changed mid-request. */
|
|
233
260
|
export declare const inferenceRouteSwitchReasonSchema: z.ZodEnum<["deployment_unavailable", "provider_error", "provider_timeout", "provider_overloaded", "rate_limited", "capacity", "policy_preference"]>;
|
|
@@ -277,18 +304,18 @@ export declare const inferenceStreamRouteSwitchEventSchema: z.ZodObject<{
|
|
|
277
304
|
authorizedByPolicy: z.ZodLiteral<true>;
|
|
278
305
|
}, "strict", z.ZodTypeAny, {
|
|
279
306
|
scope: "model";
|
|
307
|
+
authorizedByPolicy: true;
|
|
280
308
|
toProvider: string;
|
|
281
309
|
requestedModelId: string;
|
|
282
310
|
fromModelReference: string;
|
|
283
311
|
toModelReference: string;
|
|
284
|
-
authorizedByPolicy: true;
|
|
285
312
|
}, {
|
|
286
313
|
scope: "model";
|
|
314
|
+
authorizedByPolicy: true;
|
|
287
315
|
toProvider: string;
|
|
288
316
|
requestedModelId: string;
|
|
289
317
|
fromModelReference: string;
|
|
290
318
|
toModelReference: string;
|
|
291
|
-
authorizedByPolicy: true;
|
|
292
319
|
}>]>;
|
|
293
320
|
occurredAt: z.ZodString;
|
|
294
321
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -304,11 +331,11 @@ export declare const inferenceStreamRouteSwitchEventSchema: z.ZodObject<{
|
|
|
304
331
|
toDeploymentId?: string | undefined;
|
|
305
332
|
} | {
|
|
306
333
|
scope: "model";
|
|
334
|
+
authorizedByPolicy: true;
|
|
307
335
|
toProvider: string;
|
|
308
336
|
requestedModelId: string;
|
|
309
337
|
fromModelReference: string;
|
|
310
338
|
toModelReference: string;
|
|
311
|
-
authorizedByPolicy: true;
|
|
312
339
|
};
|
|
313
340
|
sequence: number;
|
|
314
341
|
}, {
|
|
@@ -324,11 +351,11 @@ export declare const inferenceStreamRouteSwitchEventSchema: z.ZodObject<{
|
|
|
324
351
|
toDeploymentId?: string | undefined;
|
|
325
352
|
} | {
|
|
326
353
|
scope: "model";
|
|
354
|
+
authorizedByPolicy: true;
|
|
327
355
|
toProvider: string;
|
|
328
356
|
requestedModelId: string;
|
|
329
357
|
fromModelReference: string;
|
|
330
358
|
toModelReference: string;
|
|
331
|
-
authorizedByPolicy: true;
|
|
332
359
|
};
|
|
333
360
|
sequence: number;
|
|
334
361
|
}>;
|
|
@@ -506,8 +533,8 @@ export declare const inferenceStreamDoneEventSchema: z.ZodObject<{
|
|
|
506
533
|
sequence: number;
|
|
507
534
|
finishReason: "length" | "cancelled" | "content_filter" | "refusal" | "stop" | "tool_calls";
|
|
508
535
|
completedAt: string;
|
|
509
|
-
generationId?: string | undefined;
|
|
510
536
|
receiptId?: string | undefined;
|
|
537
|
+
generationId?: string | undefined;
|
|
511
538
|
}, {
|
|
512
539
|
type: "done";
|
|
513
540
|
requestId: string;
|
|
@@ -515,8 +542,8 @@ export declare const inferenceStreamDoneEventSchema: z.ZodObject<{
|
|
|
515
542
|
sequence: number;
|
|
516
543
|
finishReason: "length" | "cancelled" | "content_filter" | "refusal" | "stop" | "tool_calls";
|
|
517
544
|
completedAt: string;
|
|
518
|
-
generationId?: string | undefined;
|
|
519
545
|
receiptId?: string | undefined;
|
|
546
|
+
generationId?: string | undefined;
|
|
520
547
|
}>;
|
|
521
548
|
/**
|
|
522
549
|
* Every event a normalized stream can carry.
|
|
@@ -538,19 +565,19 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
|
|
|
538
565
|
}, "strip", z.ZodTypeAny, {
|
|
539
566
|
type: "start";
|
|
540
567
|
requestId: string;
|
|
541
|
-
schemaVersion: 1;
|
|
542
|
-
sequence: number;
|
|
543
568
|
resolvedModelReference: string;
|
|
544
569
|
servingProvider: string;
|
|
570
|
+
schemaVersion: 1;
|
|
571
|
+
sequence: number;
|
|
545
572
|
startedAt: string;
|
|
546
573
|
generationId?: string | undefined;
|
|
547
574
|
}, {
|
|
548
575
|
type: "start";
|
|
549
576
|
requestId: string;
|
|
550
|
-
schemaVersion: 1;
|
|
551
|
-
sequence: number;
|
|
552
577
|
resolvedModelReference: string;
|
|
553
578
|
servingProvider: string;
|
|
579
|
+
schemaVersion: 1;
|
|
580
|
+
sequence: number;
|
|
554
581
|
startedAt: string;
|
|
555
582
|
generationId?: string | undefined;
|
|
556
583
|
}>, z.ZodObject<{
|
|
@@ -564,7 +591,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
|
|
|
564
591
|
channel: z.ZodEnum<["output_text", "reasoning", "refusal"]>;
|
|
565
592
|
text: z.ZodString;
|
|
566
593
|
}, "strip", z.ZodTypeAny, {
|
|
567
|
-
channel: "reasoning" | "
|
|
594
|
+
channel: "reasoning" | "refusal" | "output_text";
|
|
568
595
|
type: "delta";
|
|
569
596
|
requestId: string;
|
|
570
597
|
schemaVersion: 1;
|
|
@@ -572,7 +599,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
|
|
|
572
599
|
sequence: number;
|
|
573
600
|
outputIndex: number;
|
|
574
601
|
}, {
|
|
575
|
-
channel: "reasoning" | "
|
|
602
|
+
channel: "reasoning" | "refusal" | "output_text";
|
|
576
603
|
type: "delta";
|
|
577
604
|
requestId: string;
|
|
578
605
|
schemaVersion: 1;
|
|
@@ -684,18 +711,18 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
|
|
|
684
711
|
authorizedByPolicy: z.ZodLiteral<true>;
|
|
685
712
|
}, "strict", z.ZodTypeAny, {
|
|
686
713
|
scope: "model";
|
|
714
|
+
authorizedByPolicy: true;
|
|
687
715
|
toProvider: string;
|
|
688
716
|
requestedModelId: string;
|
|
689
717
|
fromModelReference: string;
|
|
690
718
|
toModelReference: string;
|
|
691
|
-
authorizedByPolicy: true;
|
|
692
719
|
}, {
|
|
693
720
|
scope: "model";
|
|
721
|
+
authorizedByPolicy: true;
|
|
694
722
|
toProvider: string;
|
|
695
723
|
requestedModelId: string;
|
|
696
724
|
fromModelReference: string;
|
|
697
725
|
toModelReference: string;
|
|
698
|
-
authorizedByPolicy: true;
|
|
699
726
|
}>]>;
|
|
700
727
|
occurredAt: z.ZodString;
|
|
701
728
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -711,11 +738,11 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
|
|
|
711
738
|
toDeploymentId?: string | undefined;
|
|
712
739
|
} | {
|
|
713
740
|
scope: "model";
|
|
741
|
+
authorizedByPolicy: true;
|
|
714
742
|
toProvider: string;
|
|
715
743
|
requestedModelId: string;
|
|
716
744
|
fromModelReference: string;
|
|
717
745
|
toModelReference: string;
|
|
718
|
-
authorizedByPolicy: true;
|
|
719
746
|
};
|
|
720
747
|
sequence: number;
|
|
721
748
|
}, {
|
|
@@ -731,11 +758,11 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
|
|
|
731
758
|
toDeploymentId?: string | undefined;
|
|
732
759
|
} | {
|
|
733
760
|
scope: "model";
|
|
761
|
+
authorizedByPolicy: true;
|
|
734
762
|
toProvider: string;
|
|
735
763
|
requestedModelId: string;
|
|
736
764
|
fromModelReference: string;
|
|
737
765
|
toModelReference: string;
|
|
738
|
-
authorizedByPolicy: true;
|
|
739
766
|
};
|
|
740
767
|
sequence: number;
|
|
741
768
|
}>, z.ZodObject<{
|
|
@@ -890,8 +917,8 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
|
|
|
890
917
|
sequence: number;
|
|
891
918
|
finishReason: "length" | "cancelled" | "content_filter" | "refusal" | "stop" | "tool_calls";
|
|
892
919
|
completedAt: string;
|
|
893
|
-
generationId?: string | undefined;
|
|
894
920
|
receiptId?: string | undefined;
|
|
921
|
+
generationId?: string | undefined;
|
|
895
922
|
}, {
|
|
896
923
|
type: "done";
|
|
897
924
|
requestId: string;
|
|
@@ -899,8 +926,8 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
|
|
|
899
926
|
sequence: number;
|
|
900
927
|
finishReason: "length" | "cancelled" | "content_filter" | "refusal" | "stop" | "tool_calls";
|
|
901
928
|
completedAt: string;
|
|
902
|
-
generationId?: string | undefined;
|
|
903
929
|
receiptId?: string | undefined;
|
|
930
|
+
generationId?: string | undefined;
|
|
904
931
|
}>]>;
|
|
905
932
|
export type InferenceStreamStartEvent = z.infer<typeof inferenceStreamStartEventSchema>;
|
|
906
933
|
export type InferenceStreamDeltaEvent = z.infer<typeof inferenceStreamDeltaEventSchema>;
|