wingbot 3.76.4-alpha.6 → 3.76.4-alpha.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.76.4-alpha.6",
3
+ "version": "3.76.4-alpha.8",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/LLM.js CHANGED
@@ -160,6 +160,7 @@ const LLMSession = require('./LLMSession');
160
160
  * @prop {LLMMessage} result
161
161
  * @prop {VectorSearchResult} [vectorSearchResult]
162
162
  * @prop {ToolFunction[]} [tools]
163
+ * @prop {number} [durationMs]
163
164
  */
164
165
 
165
166
  /**
@@ -425,8 +426,10 @@ class LLM {
425
426
  async generate (session, preset = {}, logOptions = {}) {
426
427
  const opts = this.llmOptions(preset);
427
428
  const prompt = await session.toArray(true);
429
+ const startTime = Date.now();
428
430
  const result = await this._provider.requestChat(prompt, opts, session.tools);
429
- this.logPrompt(prompt, result, logOptions.vectorSearchResult, session.tools);
431
+ const durationMs = Date.now() - startTime;
432
+ this.logPrompt(prompt, result, logOptions.vectorSearchResult, session.tools, durationMs);
430
433
  return result;
431
434
  }
432
435
 
@@ -436,11 +439,12 @@ class LLM {
436
439
  * @param {LLMMessage} result
437
440
  * @param {VectorSearchResult} [vectorSearchResult]
438
441
  * @param {ToolFunction[]} [tools]
442
+ * @param {number} [durationMs]
439
443
  */
440
- logPrompt (prompt, result, vectorSearchResult, tools) {
444
+ logPrompt (prompt, result, vectorSearchResult, tools, durationMs) {
441
445
  this._lastResult = result;
442
446
  this._configuration.logger.logPrompt({
443
- prompt, result, vectorSearchResult, tools
447
+ prompt, result, vectorSearchResult, tools, durationMs
444
448
  });
445
449
  }
446
450
 
package/src/LLMSession.js CHANGED
@@ -93,6 +93,7 @@ const stateData = require('./utils/stateData');
93
93
  * @prop {string[]} [enum] - Allowed values for this parameter
94
94
  * @prop {number} [minimum] - Minimum value for numeric parameters
95
95
  * @prop {number} [maximum] - Maximum value for numeric parameters
96
+ * @prop {string} [format] - JSON Schema string format, e.g. 'date-time', 'email', 'uuid'
96
97
  */
97
98
 
98
99
  /** @typedef {{ [key: string]: JsonSchemaProp }} SimpleJsonSchema */
package/src/LLMType.js CHANGED
@@ -25,6 +25,7 @@ class LLMType {
25
25
  this._name = name;
26
26
 
27
27
  this._description = null;
28
+ this._format = null;
28
29
  this._min = null;
29
30
  this._max = null;
30
31
 
@@ -155,6 +156,24 @@ class LLMType {
155
156
  return this;
156
157
  }
157
158
 
159
+ /**
160
+ * Sets the JSON Schema `format` for a string property.
161
+ *
162
+ * Supported values: `'date-time'`, `'time'`, `'date'`, `'duration'`,
163
+ * `'email'`, `'hostname'`, `'ipv4'`, `'ipv6'`, `'uuid'`.
164
+ *
165
+ * @example
166
+ * const createdAt = LLMType.string().format('date-time').description('Creation timestamp');
167
+ *
168
+ * @param {'date-time'|'time'|'date'|'duration'|'email'|
169
+ * 'hostname'|'ipv4'|'ipv6'|'uuid'|string} value
170
+ * @returns {this}
171
+ */
172
+ format (value) {
173
+ this._format = value;
174
+ return this;
175
+ }
176
+
158
177
  /**
159
178
  * Sets minimum boundary and maps it to a type-specific JSON Schema keyword.
160
179
  *
@@ -282,7 +301,8 @@ class LLMType {
282
301
  _baseSchema () {
283
302
  return /** @type {object} */ ({
284
303
  ...(this._description !== null && { description: this._description }),
285
- ...(this._name !== null && { name: this._name })
304
+ ...(this._name !== null && { name: this._name }),
305
+ ...(this._format !== null && { format: this._format })
286
306
  });
287
307
  }
288
308
 
@@ -134,6 +134,7 @@ type PromptInfo {
134
134
  result: LLMMessage!
135
135
  vectorSearchResult: VectorSearchResult
136
136
  tools: [ToolFunction!]
137
+ durationMs: Float
137
138
  }
138
139
 
139
140
  type UserInteraction {