@stablekernel/pi-bifrost 0.5.0 → 0.5.1
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/package.json +1 -1
- package/src/datasheet.test.ts +17 -0
- package/src/datasheet.ts +3 -0
- package/src/index.ts +8 -1
- package/src/plugin.test.ts +20 -0
package/package.json
CHANGED
package/src/datasheet.test.ts
CHANGED
|
@@ -54,6 +54,23 @@ describe("parseDatasheet", () => {
|
|
|
54
54
|
} satisfies SupplementalModel);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
test("maps supports_image_input to image_input only when true", () => {
|
|
58
|
+
const out = parseDatasheet({
|
|
59
|
+
"fireworks_ai/accounts/fireworks/models/glm-5p3-flash": {
|
|
60
|
+
...glmFlash,
|
|
61
|
+
supports_image_input: true,
|
|
62
|
+
},
|
|
63
|
+
"fireworks_ai/accounts/fireworks/models/glm-5p2": {
|
|
64
|
+
...glmFlash,
|
|
65
|
+
supports_image_input: false,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
expect(out).toHaveLength(2);
|
|
69
|
+
const byId = new Map(out.map((m) => [m.id, m]));
|
|
70
|
+
expect(byId.get("accounts/fireworks/models/glm-5p3-flash")?.image_input).toBe(true);
|
|
71
|
+
expect(byId.get("accounts/fireworks/models/glm-5p2")?.image_input).toBeUndefined();
|
|
72
|
+
});
|
|
73
|
+
|
|
57
74
|
test("drops non-chat entries, unknown providers, and rows without limits", () => {
|
|
58
75
|
const out = parseDatasheet({
|
|
59
76
|
"fireworks_ai/accounts/fireworks/models/qwen3-embedding-8b": {
|
package/src/datasheet.ts
CHANGED
|
@@ -35,6 +35,7 @@ export type DatasheetEntry = {
|
|
|
35
35
|
cache_read_input_token_cost?: number;
|
|
36
36
|
cache_write_input_token_cost?: number;
|
|
37
37
|
supports_reasoning?: boolean;
|
|
38
|
+
supports_image_input?: boolean;
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
/** A model in the same shape `gateway-cli models` emits (structural subset). */
|
|
@@ -52,6 +53,7 @@ export type SupplementalModel = {
|
|
|
52
53
|
cache_write: number;
|
|
53
54
|
};
|
|
54
55
|
reasoning?: boolean;
|
|
56
|
+
image_input?: boolean;
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
/** Datasheet provider prefixes whose entries this module understands. */
|
|
@@ -237,6 +239,7 @@ export function parseDatasheet(
|
|
|
237
239
|
}
|
|
238
240
|
: {}),
|
|
239
241
|
...(e.supports_reasoning === true ? { reasoning: true } : {}),
|
|
242
|
+
...(e.supports_image_input === true ? { image_input: true } : {}),
|
|
240
243
|
});
|
|
241
244
|
}
|
|
242
245
|
return out;
|
package/src/index.ts
CHANGED
|
@@ -118,6 +118,10 @@ export type CliModel = {
|
|
|
118
118
|
reasoning?: boolean;
|
|
119
119
|
reasoning_efforts?: string[];
|
|
120
120
|
reasoning_budget_min?: number;
|
|
121
|
+
/** True when the model accepts image content blocks (from the catalog's
|
|
122
|
+
* modalities.input). Absent means text-only, so a harness never guesses a
|
|
123
|
+
* capability from silence. */
|
|
124
|
+
image_input?: boolean;
|
|
121
125
|
};
|
|
122
126
|
|
|
123
127
|
export type CliModels = { models?: CliModel[] };
|
|
@@ -216,7 +220,10 @@ export function toPiModels(
|
|
|
216
220
|
id: m.id,
|
|
217
221
|
name: priced ? m.name : `${m.name}${UNPRICED_SUFFIX}`,
|
|
218
222
|
reasoning,
|
|
219
|
-
input
|
|
223
|
+
// pi strips image blocks for any model whose input lacks "image".
|
|
224
|
+
// Hardcoding ["text"] here silently blinded every gateway model;
|
|
225
|
+
// the capability must come from the CLI, like reasoning does.
|
|
226
|
+
input: m.image_input ? ["text", "image"] : ["text"],
|
|
220
227
|
cost: {
|
|
221
228
|
input: m.cost?.input ?? 0,
|
|
222
229
|
output: m.cost?.output ?? 0,
|
package/src/plugin.test.ts
CHANGED
|
@@ -334,6 +334,26 @@ describe("disabled models", () => {
|
|
|
334
334
|
});
|
|
335
335
|
});
|
|
336
336
|
|
|
337
|
+
describe("image input", () => {
|
|
338
|
+
test("declares image input when the CLI advertises it", async () => {
|
|
339
|
+
// Pi strips image blocks for any model whose input does not include
|
|
340
|
+
// "image". The extension used to hardcode ["text"], which silently
|
|
341
|
+
// blinded every gateway-provided model in pi.
|
|
342
|
+
const { toPiModels } = await import("./index.js");
|
|
343
|
+
const [model] = toPiModels(
|
|
344
|
+
{ models: [{ ...NOVA, image_input: true }] },
|
|
345
|
+
"openai-completions",
|
|
346
|
+
);
|
|
347
|
+
expect(model?.input).toEqual(["text", "image"]);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
test("stays text-only when the CLI is silent", async () => {
|
|
351
|
+
const { toPiModels } = await import("./index.js");
|
|
352
|
+
const [model] = toPiModels({ models: [NOVA] }, "openai-completions");
|
|
353
|
+
expect(model?.input).toEqual(["text"]);
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
|
|
337
357
|
describe("reasoning", () => {
|
|
338
358
|
const KIMI: CliModel = {
|
|
339
359
|
id: "fireworks/models/kimi-k3",
|