wingbot 3.76.4-alpha.10 → 3.76.4-alpha.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 +2 -2
- package/src/BuildRouter.js +11 -4
- package/src/LLM.js +3 -22
- package/src/LLMSession.js +2 -4
- package/src/LLMType.js +1 -21
- package/src/graphApi/schema.gql +0 -8
- package/.claude/settings.local.json +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wingbot",
|
|
3
|
-
"version": "3.76.4-alpha.
|
|
3
|
+
"version": "3.76.4-alpha.11",
|
|
4
4
|
"description": "Enterprise Messaging Bot Conversation Engine",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -76,4 +76,4 @@
|
|
|
76
76
|
"axios": "^1.6.4",
|
|
77
77
|
"handlebars": "^4.0.0"
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
}
|
package/src/BuildRouter.js
CHANGED
|
@@ -865,13 +865,20 @@ class BuildRouter extends Router {
|
|
|
865
865
|
_createBlockLlmRouter (block) {
|
|
866
866
|
const { llmRouting } = block;
|
|
867
867
|
|
|
868
|
-
if (!llmRouting
|
|
868
|
+
if (!llmRouting) {
|
|
869
869
|
return null;
|
|
870
870
|
}
|
|
871
871
|
|
|
872
|
-
const routeResolver =
|
|
873
|
-
|
|
874
|
-
|
|
872
|
+
const routeResolver = llmRouting.prompt && llmRouting.prompt.trim()
|
|
873
|
+
? LLMRouter.defaultRoute(
|
|
874
|
+
async (resolvedData) => compileWithState(
|
|
875
|
+
null,
|
|
876
|
+
null,
|
|
877
|
+
llmRouting.prompt,
|
|
878
|
+
resolvedData
|
|
879
|
+
)
|
|
880
|
+
)
|
|
881
|
+
: null;
|
|
875
882
|
const options = llmRouting.bounce === 'keepAllow'
|
|
876
883
|
? { keepUserInInteractionsWithBounceAllowed: true }
|
|
877
884
|
: {};
|
package/src/LLM.js
CHANGED
|
@@ -107,7 +107,6 @@ const LLMSession = require('./LLMSession');
|
|
|
107
107
|
* @prop {'low'|'medium'|'high'|string} [verbosity]
|
|
108
108
|
* @prop {'text'|SimpleJsonSchema} [responseFormat]
|
|
109
109
|
* @prop {number} [temperature]
|
|
110
|
-
* @prop {number} [maxToolCallRounds]
|
|
111
110
|
*/
|
|
112
111
|
|
|
113
112
|
/**
|
|
@@ -161,8 +160,6 @@ const LLMSession = require('./LLMSession');
|
|
|
161
160
|
* @prop {LLMMessage} result
|
|
162
161
|
* @prop {VectorSearchResult} [vectorSearchResult]
|
|
163
162
|
* @prop {ToolFunction[]} [tools]
|
|
164
|
-
* @prop {number} [durationMs]
|
|
165
|
-
* @prop {string} [toolChoice]
|
|
166
163
|
*/
|
|
167
164
|
|
|
168
165
|
/**
|
|
@@ -428,17 +425,8 @@ class LLM {
|
|
|
428
425
|
async generate (session, preset = {}, logOptions = {}) {
|
|
429
426
|
const opts = this.llmOptions(preset);
|
|
430
427
|
const prompt = await session.toArray(true);
|
|
431
|
-
const startTime = Date.now();
|
|
432
428
|
const result = await this._provider.requestChat(prompt, opts, session.tools);
|
|
433
|
-
|
|
434
|
-
this.logPrompt(
|
|
435
|
-
prompt,
|
|
436
|
-
result,
|
|
437
|
-
logOptions.vectorSearchResult,
|
|
438
|
-
session.tools,
|
|
439
|
-
durationMs,
|
|
440
|
-
opts.toolChoice
|
|
441
|
-
);
|
|
429
|
+
this.logPrompt(prompt, result, logOptions.vectorSearchResult, session.tools);
|
|
442
430
|
return result;
|
|
443
431
|
}
|
|
444
432
|
|
|
@@ -448,18 +436,11 @@ class LLM {
|
|
|
448
436
|
* @param {LLMMessage} result
|
|
449
437
|
* @param {VectorSearchResult} [vectorSearchResult]
|
|
450
438
|
* @param {ToolFunction[]} [tools]
|
|
451
|
-
* @param {number} [durationMs]
|
|
452
|
-
* @param {string} [toolChoice]
|
|
453
439
|
*/
|
|
454
|
-
logPrompt (prompt, result, vectorSearchResult, tools
|
|
440
|
+
logPrompt (prompt, result, vectorSearchResult, tools) {
|
|
455
441
|
this._lastResult = result;
|
|
456
442
|
this._configuration.logger.logPrompt({
|
|
457
|
-
prompt,
|
|
458
|
-
result,
|
|
459
|
-
vectorSearchResult,
|
|
460
|
-
tools,
|
|
461
|
-
durationMs,
|
|
462
|
-
...(toolChoice != null && { toolChoice })
|
|
443
|
+
prompt, result, vectorSearchResult, tools
|
|
463
444
|
});
|
|
464
445
|
}
|
|
465
446
|
|
package/src/LLMSession.js
CHANGED
|
@@ -93,7 +93,6 @@ 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'
|
|
97
96
|
*/
|
|
98
97
|
|
|
99
98
|
/** @typedef {{ [key: string]: JsonSchemaProp }} SimpleJsonSchema */
|
|
@@ -973,13 +972,12 @@ class LLMSession {
|
|
|
973
972
|
* @returns {Promise<LLMMessage<any>>}
|
|
974
973
|
*/
|
|
975
974
|
async _generate (providerOptions = this._preset, logOptions = {}) {
|
|
976
|
-
const { maxToolCallRounds = MAX_TOOL_CALL_ROUNDS } = this._llm.llmOptions(providerOptions);
|
|
977
975
|
let result = await this._llm.generate(this, providerOptions, logOptions);
|
|
978
976
|
|
|
979
977
|
// the model may chain several rounds of tool calls before it produces
|
|
980
978
|
// a final text answer - keep resolving them until it stops (bounded)
|
|
981
979
|
let rounds = 0;
|
|
982
|
-
while (result.toolCalls?.length && rounds <
|
|
980
|
+
while (result.toolCalls?.length && rounds < MAX_TOOL_CALL_ROUNDS) {
|
|
983
981
|
rounds += 1;
|
|
984
982
|
const toolCalls = [];
|
|
985
983
|
const results = await Promise.all(
|
|
@@ -1018,7 +1016,7 @@ class LLMSession {
|
|
|
1018
1016
|
// a tool-call message (content === null) to the send pipeline
|
|
1019
1017
|
if (result.toolCalls?.length) {
|
|
1020
1018
|
this._llm.log.error(
|
|
1021
|
-
`LLMSession: reached
|
|
1019
|
+
`LLMSession: reached MAX_TOOL_CALL_ROUNDS (${MAX_TOOL_CALL_ROUNDS}), `
|
|
1022
1020
|
+ 'dropping pending tool calls and forcing a tool-less final answer',
|
|
1023
1021
|
{ toolCalls: result.toolCalls }
|
|
1024
1022
|
);
|
package/src/LLMType.js
CHANGED
|
@@ -25,7 +25,6 @@ class LLMType {
|
|
|
25
25
|
this._name = name;
|
|
26
26
|
|
|
27
27
|
this._description = null;
|
|
28
|
-
this._format = null;
|
|
29
28
|
this._min = null;
|
|
30
29
|
this._max = null;
|
|
31
30
|
|
|
@@ -156,24 +155,6 @@ class LLMType {
|
|
|
156
155
|
return this;
|
|
157
156
|
}
|
|
158
157
|
|
|
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
|
-
|
|
177
158
|
/**
|
|
178
159
|
* Sets minimum boundary and maps it to a type-specific JSON Schema keyword.
|
|
179
160
|
*
|
|
@@ -301,8 +282,7 @@ class LLMType {
|
|
|
301
282
|
_baseSchema () {
|
|
302
283
|
return /** @type {object} */ ({
|
|
303
284
|
...(this._description !== null && { description: this._description }),
|
|
304
|
-
...(this._name !== null && { name: this._name })
|
|
305
|
-
...(this._format !== null && { format: this._format })
|
|
285
|
+
...(this._name !== null && { name: this._name })
|
|
306
286
|
});
|
|
307
287
|
}
|
|
308
288
|
|
package/src/graphApi/schema.gql
CHANGED
|
@@ -123,18 +123,10 @@ type VectorSearchResult {
|
|
|
123
123
|
resultDocuments: [VectorSearchDocument!]!
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
type ToolFunction {
|
|
127
|
-
name: String!
|
|
128
|
-
description: String
|
|
129
|
-
parameters: Any
|
|
130
|
-
}
|
|
131
|
-
|
|
132
126
|
type PromptInfo {
|
|
133
127
|
prompt: [LLMMessage!]!
|
|
134
128
|
result: LLMMessage!
|
|
135
129
|
vectorSearchResult: VectorSearchResult
|
|
136
|
-
tools: [ToolFunction!]
|
|
137
|
-
durationMs: Float
|
|
138
130
|
}
|
|
139
131
|
|
|
140
132
|
type UserInteraction {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(npx mocha:*)",
|
|
5
|
-
"Bash(npx tsc *)",
|
|
6
|
-
"Bash(npm test *)",
|
|
7
|
-
"Bash(node -e \"const p = require\\('./bot/plugins/BTMLLM'\\); console.log\\('factory type:', typeof p\\); console.log\\('factory name:', p.name\\);\")",
|
|
8
|
-
"Bash(grep -n \"prompt\\\\`\\\\|tagged\\\\|render\\\\|compile\\\\|hbs\" /Users/ondrejveres/Wingbot/wingbot-llm/src/prompt.js)"
|
|
9
|
-
]
|
|
10
|
-
}
|
|
11
|
-
}
|