@kaana.ai/contracts 8.14.0 → 8.15.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/internal/request.d.ts +5 -0
- package/dist/internal/request.js +17 -1
- package/dist/public/messages.d.ts +11 -0
- package/dist/public/messages.js +15 -0
- package/dist/public/version.d.ts +11 -1
- package/dist/public/version.js +11 -1
- package/openapi.json +27 -1
- package/package.json +1 -1
|
@@ -351,6 +351,11 @@ export declare const inferenceRequestSchema: z.ZodObject<{
|
|
|
351
351
|
b64_json: "b64_json";
|
|
352
352
|
}>>;
|
|
353
353
|
}, z.core.$strict>>;
|
|
354
|
+
rerank: z.ZodOptional<z.ZodObject<{
|
|
355
|
+
documents: z.ZodArray<z.ZodString>;
|
|
356
|
+
topN: z.ZodOptional<z.ZodNumber>;
|
|
357
|
+
returnDocuments: z.ZodOptional<z.ZodBoolean>;
|
|
358
|
+
}, z.core.$strict>>;
|
|
354
359
|
transcription: z.ZodOptional<z.ZodObject<{
|
|
355
360
|
language: z.ZodOptional<z.ZodString>;
|
|
356
361
|
prompt: z.ZodOptional<z.ZodString>;
|
package/dist/internal/request.js
CHANGED
|
@@ -8,7 +8,7 @@ import { maxUtf16Length, minUtf16Length } from '../stringBounds.js';
|
|
|
8
8
|
import { inferenceApiFormatSchema, inferenceModalitySchema } from '../public/catalogue.js';
|
|
9
9
|
import { decisionInputSchema } from '../public/decisions.js';
|
|
10
10
|
import { idempotencyKeySchema, inferenceTimestampSchema } from '../public/identifiers.js';
|
|
11
|
-
import { inferenceAudioOutputParametersSchema, inferenceMessageSchema, inferenceReasoningSchema, inferenceImageParametersSchema, inferenceSpeechParametersSchema, inferenceTranscriptionParametersSchema, responseFormatSchema, samplingParametersSchema, toolChoiceSchema, toolDefinitionSchema, } from '../public/messages.js';
|
|
11
|
+
import { inferenceAudioOutputParametersSchema, inferenceMessageSchema, inferenceReasoningSchema, inferenceImageParametersSchema, inferenceRerankParametersSchema, inferenceSpeechParametersSchema, inferenceTranscriptionParametersSchema, responseFormatSchema, samplingParametersSchema, toolChoiceSchema, toolDefinitionSchema, } from '../public/messages.js';
|
|
12
12
|
import { routingPolicyReferenceSchema } from '../public/policy.js';
|
|
13
13
|
import { inferenceAttributionSchema } from './attribution.js';
|
|
14
14
|
import { authorizedRouteSchema, routingTargetSchema } from './routing.js';
|
|
@@ -95,6 +95,8 @@ const inferenceRequestObjectSchema = z.object({
|
|
|
95
95
|
speech: inferenceSpeechParametersSchema.optional(),
|
|
96
96
|
/** Text-to-image controls. Contract set 8.12.0. */
|
|
97
97
|
image: inferenceImageParametersSchema.optional(),
|
|
98
|
+
/** The documents and controls of a rerank request. Contract set 8.15.0. */
|
|
99
|
+
rerank: inferenceRerankParametersSchema.optional(),
|
|
98
100
|
/** File transcription parameters. Contract set 4.5.0. */
|
|
99
101
|
transcription: inferenceTranscriptionParametersSchema.optional(),
|
|
100
102
|
/** Spoken output from a conversational model. Contract set 3.2.0. */
|
|
@@ -171,6 +173,7 @@ export const inferenceRequestSchema = inferenceRequestObjectSchema.superRefine((
|
|
|
171
173
|
request.reasoning !== undefined ||
|
|
172
174
|
request.speech !== undefined ||
|
|
173
175
|
request.image !== undefined ||
|
|
176
|
+
request.rerank !== undefined ||
|
|
174
177
|
request.transcription !== undefined ||
|
|
175
178
|
request.audioOutput !== undefined) {
|
|
176
179
|
ctx.addIssue({
|
|
@@ -209,6 +212,19 @@ export const inferenceRequestSchema = inferenceRequestObjectSchema.superRefine((
|
|
|
209
212
|
message: 'image parameters require the images_generations API format with image modality and text input',
|
|
210
213
|
});
|
|
211
214
|
}
|
|
215
|
+
if ((request.rerank !== undefined || request.client.apiFormat === 'rerank') &&
|
|
216
|
+
(request.rerank === undefined ||
|
|
217
|
+
request.client.apiFormat !== 'rerank' ||
|
|
218
|
+
request.modality !== 'text' ||
|
|
219
|
+
request.input.format !== 'text' ||
|
|
220
|
+
request.input.text.length === 0 ||
|
|
221
|
+
request.stream)) {
|
|
222
|
+
ctx.addIssue({
|
|
223
|
+
code: 'custom',
|
|
224
|
+
path: ['rerank'],
|
|
225
|
+
message: 'a rerank request needs the rerank API format, text modality, a non-empty text query, no streaming and rerank parameters',
|
|
226
|
+
});
|
|
227
|
+
}
|
|
212
228
|
if (request.transcription !== undefined &&
|
|
213
229
|
(request.client.apiFormat !== 'audio_transcriptions' ||
|
|
214
230
|
request.modality !== 'audio' ||
|
|
@@ -361,6 +361,16 @@ export declare const inferenceImageParametersSchema: z.ZodObject<{
|
|
|
361
361
|
b64_json: "b64_json";
|
|
362
362
|
}>>;
|
|
363
363
|
}, z.core.$strict>;
|
|
364
|
+
/**
|
|
365
|
+
* The documents and controls of a rerank request (contract set 8.15.0), carried
|
|
366
|
+
* in the signed envelope beside the query (the envelope's text input). Strings
|
|
367
|
+
* only, as on the public request. Customer data: never logged or persisted.
|
|
368
|
+
*/
|
|
369
|
+
export declare const inferenceRerankParametersSchema: z.ZodObject<{
|
|
370
|
+
documents: z.ZodArray<z.ZodString>;
|
|
371
|
+
topN: z.ZodOptional<z.ZodNumber>;
|
|
372
|
+
returnDocuments: z.ZodOptional<z.ZodBoolean>;
|
|
373
|
+
}, z.core.$strict>;
|
|
364
374
|
/**
|
|
365
375
|
* Parameters for a file transcription, preserved in the signed request
|
|
366
376
|
* (contract set 4.5.0). `language` is the caller's statement of what is spoken,
|
|
@@ -404,6 +414,7 @@ export declare const inferenceAudioOutputParametersSchema: z.ZodObject<{
|
|
|
404
414
|
* Moved from the Oxy edge (`packages/api/src/schemas/inferenceEdge.schemas.ts`).
|
|
405
415
|
*/
|
|
406
416
|
export declare const requestLabelsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
417
|
+
export type InferenceRerankParameters = z.infer<typeof inferenceRerankParametersSchema>;
|
|
407
418
|
export type InferenceImageParameters = z.infer<typeof inferenceImageParametersSchema>;
|
|
408
419
|
export type InferenceSpeechParameters = z.infer<typeof inferenceSpeechParametersSchema>;
|
|
409
420
|
export type InferenceTranscriptionParameters = z.infer<typeof inferenceTranscriptionParametersSchema>;
|
package/dist/public/messages.js
CHANGED
|
@@ -429,6 +429,21 @@ export const inferenceImageParametersSchema = z
|
|
|
429
429
|
responseFormat: z.enum(['url', 'b64_json']).optional(),
|
|
430
430
|
})
|
|
431
431
|
.strict();
|
|
432
|
+
/**
|
|
433
|
+
* The documents and controls of a rerank request (contract set 8.15.0), carried
|
|
434
|
+
* in the signed envelope beside the query (the envelope's text input). Strings
|
|
435
|
+
* only, as on the public request. Customer data: never logged or persisted.
|
|
436
|
+
*/
|
|
437
|
+
export const inferenceRerankParametersSchema = z
|
|
438
|
+
.object({
|
|
439
|
+
documents: z
|
|
440
|
+
.array(z.string().check(minUtf16Length(1)))
|
|
441
|
+
.min(1)
|
|
442
|
+
.max(1000),
|
|
443
|
+
topN: z.number().int().min(1).optional(),
|
|
444
|
+
returnDocuments: z.boolean().optional(),
|
|
445
|
+
})
|
|
446
|
+
.strict();
|
|
432
447
|
/**
|
|
433
448
|
* Parameters for a file transcription, preserved in the signed request
|
|
434
449
|
* (contract set 4.5.0). `language` is the caller's statement of what is spoken,
|
package/dist/public/version.d.ts
CHANGED
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
* change to, say, the catalogue reject every in-flight inference request; the
|
|
101
101
|
* per-shape `schemaVersion` is what a message is validated against.
|
|
102
102
|
*/
|
|
103
|
-
export declare const INFERENCE_CONTRACT_VERSION = "8.
|
|
103
|
+
export declare const INFERENCE_CONTRACT_VERSION = "8.15.0";
|
|
104
104
|
/**
|
|
105
105
|
* Contract set 4.0.0 (Kaana ADR 0002) is the first published as
|
|
106
106
|
* `@kaana.ai/contracts`. MAJOR because the set changed hands and split in two:
|
|
@@ -255,6 +255,16 @@ export declare const INFERENCE_CONTRACT_VERSION = "8.14.0";
|
|
|
255
255
|
* public inference shapes are unchanged; publishing does not activate native
|
|
256
256
|
* economic authorization or enroll any customer.
|
|
257
257
|
*/
|
|
258
|
+
/**
|
|
259
|
+
* Contract set 8.15.0 is additive: the signed envelope's optional `rerank`
|
|
260
|
+
* member (`inferenceRerankParametersSchema`: `documents`, `topN`,
|
|
261
|
+
* `returnDocuments`), which carries a rerank request's documents and controls to
|
|
262
|
+
* the adapter beside the query (the envelope's text input). It is valid only
|
|
263
|
+
* with the `rerank` API format, text modality and text input. The public
|
|
264
|
+
* request and response shapes and the grant are unchanged; Kaana now serves
|
|
265
|
+
* `POST /v1/rerank` and emits the `rerank` operation for a model some deployment
|
|
266
|
+
* can serve.
|
|
267
|
+
*/
|
|
258
268
|
/** The public API's one origin and version. */
|
|
259
269
|
export declare const KAANA_API_BASE_URL = "https://kaana.ai/v1";
|
|
260
270
|
/** The response header that carries the request id. */
|
package/dist/public/version.js
CHANGED
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
* change to, say, the catalogue reject every in-flight inference request; the
|
|
101
101
|
* per-shape `schemaVersion` is what a message is validated against.
|
|
102
102
|
*/
|
|
103
|
-
export const INFERENCE_CONTRACT_VERSION = '8.
|
|
103
|
+
export const INFERENCE_CONTRACT_VERSION = '8.15.0';
|
|
104
104
|
/**
|
|
105
105
|
* Contract set 4.0.0 (Kaana ADR 0002) is the first published as
|
|
106
106
|
* `@kaana.ai/contracts`. MAJOR because the set changed hands and split in two:
|
|
@@ -255,6 +255,16 @@ export const INFERENCE_CONTRACT_VERSION = '8.14.0';
|
|
|
255
255
|
* public inference shapes are unchanged; publishing does not activate native
|
|
256
256
|
* economic authorization or enroll any customer.
|
|
257
257
|
*/
|
|
258
|
+
/**
|
|
259
|
+
* Contract set 8.15.0 is additive: the signed envelope's optional `rerank`
|
|
260
|
+
* member (`inferenceRerankParametersSchema`: `documents`, `topN`,
|
|
261
|
+
* `returnDocuments`), which carries a rerank request's documents and controls to
|
|
262
|
+
* the adapter beside the query (the envelope's text input). It is valid only
|
|
263
|
+
* with the `rerank` API format, text modality and text input. The public
|
|
264
|
+
* request and response shapes and the grant are unchanged; Kaana now serves
|
|
265
|
+
* `POST /v1/rerank` and emits the `rerank` operation for a model some deployment
|
|
266
|
+
* can serve.
|
|
267
|
+
*/
|
|
258
268
|
/** The public API's one origin and version. */
|
|
259
269
|
export const KAANA_API_BASE_URL = 'https://kaana.ai/v1';
|
|
260
270
|
/** The response header that carries the request id. */
|
package/openapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"openapi": "3.1.0",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Kaana API",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.15.0",
|
|
6
6
|
"description": "Kaana inference API. Generated from @kaana.ai/contracts; the Zod source is the authority. Accounts, applications, oxy_sk_ keys, limits and billing are managed in Oxy Console: https://console.oxy.so"
|
|
7
7
|
},
|
|
8
8
|
"servers": [
|
|
@@ -4440,6 +4440,32 @@
|
|
|
4440
4440
|
"failed"
|
|
4441
4441
|
]
|
|
4442
4442
|
},
|
|
4443
|
+
"InferenceRerankParameters": {
|
|
4444
|
+
"type": "object",
|
|
4445
|
+
"properties": {
|
|
4446
|
+
"documents": {
|
|
4447
|
+
"minItems": 1,
|
|
4448
|
+
"maxItems": 1000,
|
|
4449
|
+
"type": "array",
|
|
4450
|
+
"items": {
|
|
4451
|
+
"type": "string",
|
|
4452
|
+
"minLength": 1
|
|
4453
|
+
}
|
|
4454
|
+
},
|
|
4455
|
+
"topN": {
|
|
4456
|
+
"type": "integer",
|
|
4457
|
+
"minimum": 1,
|
|
4458
|
+
"maximum": 9007199254740991
|
|
4459
|
+
},
|
|
4460
|
+
"returnDocuments": {
|
|
4461
|
+
"type": "boolean"
|
|
4462
|
+
}
|
|
4463
|
+
},
|
|
4464
|
+
"required": [
|
|
4465
|
+
"documents"
|
|
4466
|
+
],
|
|
4467
|
+
"additionalProperties": false
|
|
4468
|
+
},
|
|
4443
4469
|
"InferenceSpeechParameters": {
|
|
4444
4470
|
"type": "object",
|
|
4445
4471
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaana.ai/contracts",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.15.0",
|
|
4
4
|
"description": "Kaana inference contract: the Zod schemas of the public API at https://kaana.ai/v1 and, under /internal, of the Oxy-Kaana grant, settlement and signed lane.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|