wingbot 3.76.4-alpha.8 → 3.76.4-alpha.9

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.8",
3
+ "version": "3.76.4-alpha.9",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/src/LLM.js CHANGED
@@ -107,6 +107,7 @@ 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]
110
111
  */
111
112
 
112
113
  /**
package/src/LLMSession.js CHANGED
@@ -973,12 +973,13 @@ class LLMSession {
973
973
  * @returns {Promise<LLMMessage<any>>}
974
974
  */
975
975
  async _generate (providerOptions = this._preset, logOptions = {}) {
976
+ const { maxToolCallRounds = MAX_TOOL_CALL_ROUNDS } = this._llm.llmOptions(providerOptions);
976
977
  let result = await this._llm.generate(this, providerOptions, logOptions);
977
978
 
978
979
  // the model may chain several rounds of tool calls before it produces
979
980
  // a final text answer - keep resolving them until it stops (bounded)
980
981
  let rounds = 0;
981
- while (result.toolCalls?.length && rounds < MAX_TOOL_CALL_ROUNDS) {
982
+ while (result.toolCalls?.length && rounds < maxToolCallRounds) {
982
983
  rounds += 1;
983
984
  const toolCalls = [];
984
985
  const results = await Promise.all(
@@ -1017,7 +1018,7 @@ class LLMSession {
1017
1018
  // a tool-call message (content === null) to the send pipeline
1018
1019
  if (result.toolCalls?.length) {
1019
1020
  this._llm.log.error(
1020
- `LLMSession: reached MAX_TOOL_CALL_ROUNDS (${MAX_TOOL_CALL_ROUNDS}), `
1021
+ `LLMSession: reached maxToolCallRounds (${maxToolCallRounds}), `
1021
1022
  + 'dropping pending tool calls and forcing a tool-less final answer',
1022
1023
  { toolCalls: result.toolCalls }
1023
1024
  );