wingbot 3.73.6 → 3.73.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.73.6",
3
+ "version": "3.73.8",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/ChatGpt.js CHANGED
@@ -37,8 +37,8 @@ const LLM = require('./LLM');
37
37
  * @typedef {object} DefaultRequestOptions
38
38
  * @prop {ChatGPTModel} [model]
39
39
  * @prop {number} [presencePenalty=0.0]
40
- * @prop {number} [requestTokens=256]
41
- * @prop {number} [tokensLimit=4096]
40
+ * @prop {number} [requestTokens]
41
+ * @prop {number} [tokensLimit]
42
42
  * @prop {number} [temperature=1.0]
43
43
  * @prop {number} [transcriptLength=-5]
44
44
  */
@@ -189,8 +189,8 @@ class ChatGpt {
189
189
 
190
190
  /** @type {Required<DefaultRequestOptions>} */
191
191
  this._options = {
192
- requestTokens: 256,
193
- tokensLimit: 128000,
192
+ requestTokens: null,
193
+ tokensLimit: null,
194
194
  presencePenalty: 0.0, // -2.0-2.0
195
195
  temperature: 1.0,
196
196
  model: 'gpt-4o-mini',
@@ -304,7 +304,7 @@ class ChatGpt {
304
304
  return (m.content ? 0 : m.content.length) + total;
305
305
  }, 0);
306
306
 
307
- if (totalTokens > tokensLimit) {
307
+ if (tokensLimit !== null && totalTokens > tokensLimit) {
308
308
  messages = messages.filter((m, i) => {
309
309
  if (m.role === LLM.ROLE_SYSTEM
310
310
  || i >= lastUserIndex
@@ -322,7 +322,7 @@ class ChatGpt {
322
322
  model,
323
323
  frequency_penalty: 0,
324
324
  presence_penalty: presencePenalty,
325
- max_tokens: requestTokens,
325
+ ...(requestTokens ? { max_completion_tokens: requestTokens } : {}),
326
326
  temperature,
327
327
  messages
328
328
  };
package/src/Responder.js CHANGED
@@ -448,16 +448,29 @@ class Responder {
448
448
  return resolved;
449
449
  }
450
450
 
451
- async llmSessionWithHistory (contextType = this.LLM_CTX_DEFAULT) {
451
+ async llmSessionWithHistory (
452
+ contextType = this.LLM_CTX_DEFAULT,
453
+ transcriptLength = undefined,
454
+ transcriptFlag = undefined
455
+ ) {
452
456
  const {
453
457
  transcriptAnonymize,
454
- transcriptFlag,
455
- transcriptLength
458
+ transcriptFlag: transcriptFlagCfg,
459
+ transcriptLength: transcriptLengthCfg
456
460
  } = this.llm.configuration;
457
461
 
462
+ const computedTranscriptLength = transcriptLength === undefined
463
+ ? transcriptLengthCfg
464
+ : transcriptLength;
465
+ const computedTranscriptFlag = transcriptFlag === undefined
466
+ ? transcriptFlagCfg : transcriptFlag;
467
+
458
468
  const [systems, transcript] = await Promise.all([
459
469
  this._getSystemContentForType(contextType),
460
- this.getTranscript(transcriptLength, transcriptFlag)
470
+ this.getTranscript(
471
+ computedTranscriptLength,
472
+ computedTranscriptFlag
473
+ )
461
474
  ]);
462
475
 
463
476
  const chat = [