@genai-fi/nanogpt 1.0.2 → 1.0.4

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.
@@ -103,7 +103,7 @@ var r = class {
103
103
  callback: t
104
104
  };
105
105
  if (this._responses.set(r, a), this._busyCount > 0 && !e.background) {
106
- if (this._jobQueue.length > 10) throw Error("Job queue is too long, rejecting new job");
106
+ if (this._jobQueue.length > 10) throw Error("queue_too_long");
107
107
  return new Promise((n, i) => {
108
108
  this._jobQueue.push({
109
109
  id: r,
@@ -121,7 +121,7 @@ var r = class {
121
121
  if (n) {
122
122
  let r = n.generator.getConversation();
123
123
  if (t !== void 0 && t >= 0 && t < r.length && r.splice(t), n.done = !1, n.timestamp = Date.now(), this._busyCount > 0 && !n.options.background) {
124
- if (this._jobQueue.length > 10) throw Error("Job queue is too long, rejecting new job");
124
+ if (this._jobQueue.length > 10) throw Error("queue_too_long");
125
125
  return new Promise((t, r) => {
126
126
  this._jobQueue.push({
127
127
  id: e,
@@ -134,7 +134,7 @@ var r = class {
134
134
  }
135
135
  return this._runForRecord(e, n.options, n.callback);
136
136
  }
137
- throw Error(`No response found for id: ${e}`);
137
+ throw Error("response_not_found");
138
138
  }
139
139
  getResponse(e) {
140
140
  let t = this._responses.get(e);
@@ -139,7 +139,11 @@ var o = class {
139
139
  };
140
140
  if (!u) throw Error("invalid_previous_job_id");
141
141
  if (this._jobs.set(u.id, u), this.setState(u, "pending"), o instanceof t) {
142
- if (u.datasetId && o.datasetId !== u.datasetId && console.warn("TokenStore dataset ID does not match job dataset ID, proceeding anyway"), o.tokeniserId !== this._tokeniser.id) {
142
+ if (u.datasetId && o.datasetId !== u.datasetId) {
143
+ let e = /* @__PURE__ */ Error("dataset_mismatch");
144
+ throw this.setState(u, "error", e), e;
145
+ }
146
+ if (o.tokeniserId !== this._tokeniser.id) {
143
147
  let e = /* @__PURE__ */ Error("tokeniser_mismatch");
144
148
  throw this.setState(u, "error", e), e;
145
149
  }
@@ -191,7 +195,7 @@ var o = class {
191
195
  }
192
196
  dispose() {
193
197
  for (let e of this._jobs.values()) {
194
- if (e.state === "running") throw Error(`Cannot dispose training while job ${e.id} is still running`);
198
+ if (e.state === "running") throw Error("job_still_running");
195
199
  e.trainer.dispose();
196
200
  }
197
201
  this._jobs.clear(), this.ee.removeAllListeners();