wingbot 3.73.9 → 3.73.11

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.9",
3
+ "version": "3.73.11",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/ChatGpt.js CHANGED
@@ -36,6 +36,7 @@ const LLM = require('./LLM');
36
36
  /**
37
37
  * @typedef {object} DefaultRequestOptions
38
38
  * @prop {ChatGPTModel} [model]
39
+ * @prop {'node'|'low'|'medium'|'high'} [reasoningEffort]
39
40
  * @prop {number} [presencePenalty=0.0]
40
41
  * @prop {number} [requestTokens]
41
42
  * @prop {number} [tokensLimit]
@@ -195,6 +196,7 @@ class ChatGpt {
195
196
  temperature: 1.0,
196
197
  model: 'gpt-4o-mini',
197
198
  transcriptLength: -5,
199
+ reasoningEffort: null,
198
200
  ...rest
199
201
  };
200
202
 
@@ -285,6 +287,7 @@ class ChatGpt {
285
287
  model,
286
288
  presencePenalty,
287
289
  temperature,
290
+ reasoningEffort,
288
291
  functions = []
289
292
  } = {
290
293
  ...this._options,
@@ -323,6 +326,9 @@ class ChatGpt {
323
326
  frequency_penalty: 0,
324
327
  presence_penalty: presencePenalty,
325
328
  ...(requestTokens ? { max_completion_tokens: requestTokens } : {}),
329
+ ...(reasoningEffort ? {
330
+ reasoning: { effort: reasoningEffort }
331
+ } : {}),
326
332
  temperature,
327
333
  messages
328
334
  };
@@ -3,6 +3,10 @@
3
3
  * @author David Menger
4
4
  */
5
5
  'use strict';
6
+ const {
7
+ OverlappingFieldsCanBeMergedRule,
8
+ UniqueDirectivesPerLocationRule
9
+ } = require('graphql');
6
10
 
7
11
  /** @typedef {import('graphql').ValidationRule} ValidationRule */
8
12
 
@@ -29,6 +33,8 @@ function gqlRules (variables, isProduction, hideVerboseErrors, log = console) {
29
33
  return [
30
34
  ...(hideVerboseErrors ? [NoSchemaIntrospectionCustomRule] : []),
31
35
  depthLimit(10),
36
+ OverlappingFieldsCanBeMergedRule,
37
+ UniqueDirectivesPerLocationRule,
32
38
  createComplexityRule({
33
39
  // The maximum allowed query complexity, queries above this threshold will be rejected
34
40
  maximumComplexity: 1000,
@@ -449,14 +449,25 @@ function message (params, context = {}) {
449
449
  if (params.type === 'prompt' && !res.llm.configuration.disableLLM) {
450
450
  res.typingOn()
451
451
  .wait(1000);
452
- const session = await res.llmSessionWithHistory(params.llmContextType);
453
452
 
454
- await session.systemPrompt(text)
455
- .generate();
453
+ let session;
454
+ let evaluation;
455
+ let discard;
456
456
 
457
- const evaluation = await res.llmEvaluate(session, params.llmContextType);
457
+ try {
458
+ session = await res.llmSessionWithHistory(params.llmContextType);
458
459
 
459
- if (evaluation.discard) {
460
+ await session.systemPrompt(text)
461
+ .generate();
462
+
463
+ evaluation = await res.llmEvaluate(session, params.llmContextType);
464
+ ({ discard } = evaluation);
465
+ } catch (e) {
466
+ (context.log || console).error(`LLM ERR: ${e.message} [${req.senderId}]`, e);
467
+ discard = true;
468
+ }
469
+
470
+ if (discard) {
460
471
  canaryLog(context.log, context.canaryLogs, 'LLM discarded', {
461
472
  evaluation,
462
473
  session