bitgpu 0.13.0 → 0.13.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/README.md CHANGED
@@ -34,7 +34,7 @@ weights stream straight from the Hugging Face Hub. This runs as-is:
34
34
  import { createEngine } from 'bitgpu'
35
35
  import { createChat } from 'bitgpu/chat'
36
36
 
37
- const REPO = 'https://cdn.jsdelivr.net/gh/stfurkan/bitgpu@v0.13.0/models/bonsai-1.7b-gguf'
37
+ const REPO = 'https://cdn.jsdelivr.net/gh/stfurkan/bitgpu@v0.13.1/models/bonsai-1.7b-gguf'
38
38
  const TOK = 'https://huggingface.co/onnx-community/Bonsai-1.7B-ONNX/resolve/main'
39
39
  const engine = await createEngine({
40
40
  manifestUrl: `${REPO}/manifest.json`,
@@ -226,10 +226,15 @@ feasibility, so the model can never be trapped mid-number), and `oneOf` as a **d
226
226
  union** - object branches sharing one required property whose single-value `enum` differs per
227
227
  branch, e.g. a slide that is either `{type: 'bullets', ...}` or `{type: 'quote', ...}`; the
228
228
  machine tracks the live branches until the discriminator commits. All nested to any depth.
229
- Anything else (`pattern`, float ranges, general `oneOf`, `$ref`, ...) **throws up front** -
230
- never silently ignored. The guarantee is structural, not semantic: a schema makes the output
231
- parse into the right shape, not be true. Built on the engine's generic `candidateFilter` hook
232
- (see `GenerateOptions`), which is open for custom grammars.
229
+ Annotation-only keywords - `description`, `title`, `default`, `examples`, `$schema`, `$id`,
230
+ `deprecated`, `readOnly`, `writeOnly`, `$comment` - are **accepted and ignored** (they carry no
231
+ constraint), so a real MCP / OpenAI tool schema passes through unmodified and a property's
232
+ `description` still reaches the model via the chat template. Genuinely-constraining keywords the
233
+ enforcer does not implement (`pattern`, `format`, float ranges, general `oneOf`, `$ref`, ...)
234
+ **throw up front** - never silently ignored, because those would *look* enforced. The guarantee
235
+ is structural, not semantic: a schema makes the output parse into the right shape, not be true.
236
+ Built on the engine's generic `candidateFilter` hook (see `GenerateOptions`), which is open for
237
+ custom grammars.
233
238
 
234
239
  ### Confidence (`logprobs`)
235
240
 
package/dist/chat.d.ts CHANGED
@@ -76,6 +76,19 @@ interface JsonSchema {
76
76
  * combinable with enum (the literals already fix the length). */
77
77
  minLength?: number;
78
78
  maxLength?: number;
79
+ /** Human-readable docs. Ignored by the enforcer, but the chat template renders the tools list
80
+ * (parameters included) into the model's prompt, so a property `description` DOES reach the
81
+ * model - the reason MCP/OpenAI tool schemas pass through unmodified. */
82
+ description?: string;
83
+ title?: string;
84
+ default?: unknown;
85
+ examples?: unknown[];
86
+ deprecated?: boolean;
87
+ readOnly?: boolean;
88
+ writeOnly?: boolean;
89
+ $comment?: string;
90
+ $schema?: string;
91
+ $id?: string;
79
92
  }
80
93
  /** Validate a schema against the enforceable subset; throws listing anything unsupported. */
81
94
  declare function validateJsonSchema(schema: JsonSchema, path?: string, isRoot?: boolean): void;
package/dist/chat.js CHANGED
@@ -4415,6 +4415,18 @@ const SUPPORTED = /* @__PURE__ */ new Set([
4415
4415
  "minLength",
4416
4416
  "maxLength"
4417
4417
  ]);
4418
+ const ANNOTATIONS = /* @__PURE__ */ new Set([
4419
+ "description",
4420
+ "title",
4421
+ "default",
4422
+ "examples",
4423
+ "deprecated",
4424
+ "readOnly",
4425
+ "writeOnly",
4426
+ "$comment",
4427
+ "$schema",
4428
+ "$id"
4429
+ ]);
4418
4430
  const TYPES = /* @__PURE__ */ new Set([
4419
4431
  "object",
4420
4432
  "array",
@@ -4435,10 +4447,10 @@ function findDiscriminator(branches) {
4435
4447
  }
4436
4448
  /** Validate a schema against the enforceable subset; throws listing anything unsupported. */
4437
4449
  function validateJsonSchema(schema, path = "schema", isRoot = true) {
4438
- const unknown = Object.keys(schema).filter((k) => !SUPPORTED.has(k));
4439
- if (unknown.length) throw new Error(`bitgpu/chat: unsupported JSON Schema keyword(s) at ${path}: ${unknown.join(", ")} (enforceable subset: ${[...SUPPORTED].join(", ")})`);
4450
+ const unknown = Object.keys(schema).filter((k) => !SUPPORTED.has(k) && !ANNOTATIONS.has(k));
4451
+ if (unknown.length) throw new Error(`bitgpu/chat: unsupported JSON Schema keyword(s) at ${path}: ${unknown.join(", ")} (enforceable subset: ${[...SUPPORTED].join(", ")}; annotations accepted-and-ignored: ${[...ANNOTATIONS].join(", ")})`);
4440
4452
  if (schema.oneOf !== void 0) {
4441
- const extra = Object.keys(schema).filter((k) => k !== "oneOf");
4453
+ const extra = Object.keys(schema).filter((k) => k !== "oneOf" && !ANNOTATIONS.has(k));
4442
4454
  if (extra.length) throw new Error(`bitgpu/chat: oneOf at ${path} cannot combine with other keywords (got ${extra.join(", ")})`);
4443
4455
  if (!Array.isArray(schema.oneOf) || schema.oneOf.length < 2) throw new Error(`bitgpu/chat: oneOf at ${path} needs at least 2 branches`);
4444
4456
  schema.oneOf.forEach((b, i) => {