@genai-fi/nanogpt 1.0.2 → 1.0.3

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.
@@ -523,7 +523,7 @@ function d(e) {
523
523
  }
524
524
  async function f(e, t) {
525
525
  let u = e.type === "" ? e instanceof File ? d(e.name) : "application/zip" : e.type;
526
- if (u === "application/parquet") throw Error("Parquet loading is not currently supported in the browser. Please convert your data to JSONL format.");
526
+ if (u === "application/parquet") throw Error("unsupported_file_type");
527
527
  if (u === "application/pdf") return new i(await n(e, t?.maxSize));
528
528
  if (u === "application/vnd.openxmlformats-officedocument.wordprocessingml.document") return new i(await r(e));
529
529
  if (u === "application/json") {
@@ -538,7 +538,7 @@ async function f(e, t) {
538
538
  role: "text",
539
539
  content: JSON.stringify(e)
540
540
  }]));
541
- throw Error("Expected JSON array");
541
+ throw Error("bad_format");
542
542
  }
543
543
  if (u === "application/jsonl") return new o(e);
544
544
  if (u === "application/zip") return new a(e);
@@ -550,7 +550,7 @@ async function f(e, t) {
550
550
  skipEmptyLines: !0,
551
551
  delimiter: ",",
552
552
  complete: (n) => {
553
- if (n.errors.length > 0) console.error(n.errors), r(/* @__PURE__ */ Error("Error parsing file"));
553
+ if (n.errors.length > 0) console.error(n.errors), r(/* @__PURE__ */ Error("bad_format"));
554
554
  else {
555
555
  let r = c(n.data[0], t?.column || "text");
556
556
  e(new i((t?.hasHeader ?? l(n.data[0]) ? n.data.slice(1) : n.data).map((e) => [{
@@ -568,7 +568,7 @@ async function f(e, t) {
568
568
  role: "text",
569
569
  content: await e.text()
570
570
  }]]);
571
- throw Error(`Unsupported file type: ${u}`);
571
+ throw Error("unsupported_file_type");
572
572
  }
573
573
  //#endregion
574
574
  export { f as default };
@@ -7,7 +7,7 @@ async function e(e) {
7
7
  if (t) try {
8
8
  n = JSON.parse(t);
9
9
  } catch (e) {
10
- throw console.error(e), Error("Failed to parse meta.json in the zip archive", { cause: e });
10
+ throw console.error(e), Error("bad_format", { cause: e });
11
11
  }
12
12
  else console.warn("meta.json not found in the zip archive, using default metadata");
13
13
  return n;
@@ -31,7 +31,7 @@ function n(e) {
31
31
  if (e.windowSize !== void 0 && typeof e.windowSize != "string") throw Error("Invalid config: \"windowSize\" must be a string for GenAI_NanoGPT_v2.");
32
32
  return;
33
33
  }
34
- throw Error("Invalid config: \"modelType\" must be \"GenAI_NanoGPT_v1\" or \"GenAI_NanoGPT_v2\".");
34
+ throw Error("invalid_model_type");
35
35
  }
36
36
  //#endregion
37
37
  export { e as defaultConfig, n as validateConfig };