@ornncompute/cli 1.0.347 → 1.0.349
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/vendor/capabilities/cli.js +35 -19
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ charges, and provider catalog reads and listing management through the shared ca
|
|
|
63
63
|
the standard staff preflight. Both use native gateway routes and existing auth.
|
|
64
64
|
|
|
65
65
|
See the [Inference guide](https://docs.ornn.com/inference#cli-and-mcp) for customer
|
|
66
|
-
examples and [staff reference](../../docs/cli.md#inference) for administration.
|
|
66
|
+
examples and generation routing options, and the [staff reference](../../docs/cli.md#inference) for administration.
|
|
67
67
|
|
|
68
68
|
## Command map
|
|
69
69
|
|
package/package.json
CHANGED
|
@@ -63,22 +63,31 @@ function getInferenceListing(request, listingId2, signal) {
|
|
|
63
63
|
signal
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
var inferenceRoutingHeaders = {
|
|
67
|
+
listing_id: "X-Ornn-Listing-Id",
|
|
68
|
+
max_input_usd_per_million_tokens: "X-Ornn-Max-Input-USD-Per-Million-Tokens",
|
|
69
|
+
max_cached_input_usd_per_million_tokens: "X-Ornn-Max-Cached-Input-USD-Per-Million-Tokens",
|
|
70
|
+
max_output_usd_per_million_tokens: "X-Ornn-Max-Output-USD-Per-Million-Tokens"
|
|
71
|
+
};
|
|
72
|
+
function postInference(fetcher, path6, body2, routing = {}, signal) {
|
|
73
|
+
const headers = { "Content-Type": "application/json" };
|
|
74
|
+
for (const key of Object.keys(inferenceRoutingHeaders)) {
|
|
75
|
+
const value = routing[key];
|
|
76
|
+
if (value !== void 0)
|
|
77
|
+
headers[inferenceRoutingHeaders[key]] = value;
|
|
78
|
+
}
|
|
67
79
|
return fetcher(path6, {
|
|
68
80
|
method: "POST",
|
|
69
|
-
headers
|
|
70
|
-
"Content-Type": "application/json",
|
|
71
|
-
...listingId2 !== void 0 && { "X-Ornn-Listing-Id": listingId2 }
|
|
72
|
-
},
|
|
81
|
+
headers,
|
|
73
82
|
body: JSON.stringify(body2),
|
|
74
83
|
signal
|
|
75
84
|
});
|
|
76
85
|
}
|
|
77
|
-
function createChatCompletion(fetcher, body2,
|
|
78
|
-
return postInference(fetcher, "/v1/inference/chat/completions", body2,
|
|
86
|
+
function createChatCompletion(fetcher, body2, routing, signal) {
|
|
87
|
+
return postInference(fetcher, "/v1/inference/chat/completions", body2, routing, signal);
|
|
79
88
|
}
|
|
80
|
-
function createDecision(fetcher, body2,
|
|
81
|
-
return postInference(fetcher, "/v1/inference/decisions", body2,
|
|
89
|
+
function createDecision(fetcher, body2, routing, signal) {
|
|
90
|
+
return postInference(fetcher, "/v1/inference/decisions", body2, routing, signal);
|
|
82
91
|
}
|
|
83
92
|
function queryString(query3) {
|
|
84
93
|
const params = new URLSearchParams();
|
|
@@ -246,7 +255,14 @@ var apiType = z2.enum(inferenceApiTypes).optional();
|
|
|
246
255
|
var timestamp = z2.iso.datetime({ offset: true });
|
|
247
256
|
var limit = z2.coerce.number().int().min(1).max(100).optional();
|
|
248
257
|
var listingId = z2.strictObject({ listing_id: z2.uuid() });
|
|
249
|
-
var
|
|
258
|
+
var priceCeiling = z2.string().min(1).optional().describe("Inclusive maximum in USD per million tokens, as a nonnegative decimal string.");
|
|
259
|
+
var generationRouting = {
|
|
260
|
+
listing_id: z2.uuid().optional().describe("Pin an exact offer. Omit to choose by lowest input price, then lowest output price."),
|
|
261
|
+
max_input_usd_per_million_tokens: priceCeiling,
|
|
262
|
+
max_cached_input_usd_per_million_tokens: priceCeiling.describe("Inclusive cached-input ceiling. An offer without a cached rate uses its ordinary input rate."),
|
|
263
|
+
max_output_usd_per_million_tokens: priceCeiling
|
|
264
|
+
};
|
|
265
|
+
var generationUsage = "--body JSON [--listing-id UUID] [--max-input-usd-per-million-tokens RATE] [--max-cached-input-usd-per-million-tokens RATE] [--max-output-usd-per-million-tokens RATE]";
|
|
250
266
|
var page = z2.strictObject({ after: text.optional(), limit });
|
|
251
267
|
var rates = {
|
|
252
268
|
provider_input_usd_per_million_tokens: z2.string().nullable().optional(),
|
|
@@ -406,20 +422,20 @@ var inferenceCapabilities = [
|
|
|
406
422
|
operation({
|
|
407
423
|
command: ["completions", "create"],
|
|
408
424
|
description: "Call an inference model using a Chat Completions body. Generation parameters pass through unchanged. Spends the organization's credits; returns the upstream JSON response. MCP uses non-streaming responses.",
|
|
409
|
-
input: z2.strictObject({
|
|
425
|
+
input: z2.strictObject({ ...generationRouting, body: completionBody }),
|
|
410
426
|
mcpInput: z2.strictObject({
|
|
411
|
-
|
|
427
|
+
...generationRouting,
|
|
412
428
|
body: completionBody.extend({ stream: z2.literal(false).nullable().optional() })
|
|
413
429
|
}),
|
|
414
|
-
usage:
|
|
430
|
+
usage: generationUsage,
|
|
415
431
|
write: true,
|
|
416
|
-
execute: async (ctx, { body: body2,
|
|
432
|
+
execute: async (ctx, { body: body2, ...routing }) => {
|
|
417
433
|
if (body2.stream && ctx.cli?.interaction?.format !== "human") {
|
|
418
434
|
throw new Error("Streaming returns raw SSE. Use --format human in the CLI, or stream=false in MCP.");
|
|
419
435
|
}
|
|
420
436
|
if (!ctx.fetchResponse)
|
|
421
437
|
throw new Error("This client does not support completion responses.");
|
|
422
|
-
const response = await createChatCompletion(ctx.fetchResponse, body2,
|
|
438
|
+
const response = await createChatCompletion(ctx.fetchResponse, body2, routing);
|
|
423
439
|
return body2.stream ? response : response.json();
|
|
424
440
|
}
|
|
425
441
|
}),
|
|
@@ -427,19 +443,19 @@ var inferenceCapabilities = [
|
|
|
427
443
|
command: ["decisions", "create"],
|
|
428
444
|
description: "Ask questions about input using a Decisions model. Returns the provider's answers and spends the organization's credits at the listing's rates.",
|
|
429
445
|
input: z2.strictObject({
|
|
430
|
-
|
|
446
|
+
...generationRouting,
|
|
431
447
|
body: z2.looseObject({
|
|
432
448
|
model: text,
|
|
433
449
|
input: z2.union([z2.string(), z2.array(z2.looseObject({}))]),
|
|
434
450
|
questions: z2.array(z2.looseObject({}))
|
|
435
451
|
})
|
|
436
452
|
}),
|
|
437
|
-
usage:
|
|
453
|
+
usage: generationUsage,
|
|
438
454
|
write: true,
|
|
439
|
-
execute: async (ctx, { body: body2,
|
|
455
|
+
execute: async (ctx, { body: body2, ...routing }) => {
|
|
440
456
|
if (!ctx.fetchResponse)
|
|
441
457
|
throw new Error("This client does not support decision responses.");
|
|
442
|
-
const response = await createDecision(ctx.fetchResponse, body2,
|
|
458
|
+
const response = await createDecision(ctx.fetchResponse, body2, routing);
|
|
443
459
|
return response.json();
|
|
444
460
|
}
|
|
445
461
|
}),
|