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 +1 -1
- package/src/LLM.js +1 -0
- package/src/LLMSession.js +3 -2
package/package.json
CHANGED
package/src/LLM.js
CHANGED
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 <
|
|
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
|
|
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
|
);
|