symposium 1.3.1 → 1.3.3
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/Agent.js +7 -4
- package/Tool.js +3 -0
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -430,13 +430,13 @@ export default class Agent {
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
async confirmFunctions({thread, functions, completion, emitter}) {
|
|
434
|
-
const response = await this.callFunctions(thread, emitter, completion, functions, true);
|
|
433
|
+
async confirmFunctions({thread, functions, completion, emitter}, always = false) {
|
|
434
|
+
const response = await this.callFunctions(thread, emitter, completion, functions, true, always);
|
|
435
435
|
if (response?.type === 'continue')
|
|
436
436
|
return this.execute(thread, emitter);
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
-
async callFunctions(thread, emitter, completion, functions_to_call,
|
|
439
|
+
async callFunctions(thread, emitter, completion, functions_to_call, authorize = false, authorize_always = false) {
|
|
440
440
|
const functions = await this.getFunctions(false);
|
|
441
441
|
|
|
442
442
|
let is_authorized = true;
|
|
@@ -444,7 +444,10 @@ export default class Agent {
|
|
|
444
444
|
if (!functions.has(f.name))
|
|
445
445
|
throw new Error('Unrecognized function ' + f.name);
|
|
446
446
|
|
|
447
|
-
if (
|
|
447
|
+
if (authorize && authorize_always)
|
|
448
|
+
await functions.get(f.name).tool.authorizeAlways(thread, f.name, f.arguments);
|
|
449
|
+
|
|
450
|
+
if (!authorize && !(await functions.get(f.name).tool.authorize(thread, f.name, f.arguments))) {
|
|
448
451
|
is_authorized = false;
|
|
449
452
|
break;
|
|
450
453
|
}
|
package/Tool.js
CHANGED