symposium 0.15.3 → 0.15.4
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 +6 -9
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -164,8 +164,6 @@ export default class Agent {
|
|
|
164
164
|
switch (this.type) {
|
|
165
165
|
case 'chat':
|
|
166
166
|
emitter.emit('error', e.message);
|
|
167
|
-
if (!existing_emitter)
|
|
168
|
-
emitter.emit('end');
|
|
169
167
|
return emitter;
|
|
170
168
|
|
|
171
169
|
case 'utility':
|
|
@@ -182,8 +180,6 @@ export default class Agent {
|
|
|
182
180
|
|
|
183
181
|
switch (this.type) {
|
|
184
182
|
case 'utility':
|
|
185
|
-
if (!existing_emitter)
|
|
186
|
-
emitter.emit('end');
|
|
187
183
|
return response;
|
|
188
184
|
|
|
189
185
|
case 'chat':
|
|
@@ -320,7 +316,7 @@ export default class Agent {
|
|
|
320
316
|
return this.afterHandle(thread, completion, 'return', JSON.parse(m.content));
|
|
321
317
|
}
|
|
322
318
|
|
|
323
|
-
emitter.emit('
|
|
319
|
+
emitter.emit('output', m.content);
|
|
324
320
|
break;
|
|
325
321
|
|
|
326
322
|
case 'function':
|
|
@@ -392,16 +388,16 @@ export default class Agent {
|
|
|
392
388
|
|
|
393
389
|
const func = functions.get(function_call.name);
|
|
394
390
|
const partialOutput = func.partialOutput ? ((typeof func.partialOutput) === 'text' ? func.partialOutput : func.partialOutput.call(this, function_call.arguments)) : 'Uso lo strumento ' + function_call.name + '...';
|
|
395
|
-
emitter.emit('
|
|
391
|
+
emitter.emit('partial', partialOutput);
|
|
396
392
|
|
|
397
393
|
await this.log('function_call', function_call);
|
|
398
394
|
|
|
399
395
|
try {
|
|
400
396
|
const response = await func.tool.callFunction(thread, function_call.name, function_call.arguments);
|
|
401
|
-
emitter.emit('
|
|
397
|
+
emitter.emit('partial', 'Risposta ricevuta da ' + func.tool.name);
|
|
402
398
|
return response;
|
|
403
399
|
} catch (error) {
|
|
404
|
-
emitter.emit('
|
|
400
|
+
emitter.emit('partial', 'Ricevuto errore da ' + func.tool.name);
|
|
405
401
|
return {error};
|
|
406
402
|
}
|
|
407
403
|
}
|
|
@@ -423,6 +419,7 @@ export default class Agent {
|
|
|
423
419
|
return [this.name];
|
|
424
420
|
}
|
|
425
421
|
|
|
422
|
+
// Currently specific for OpenAI Realtime API
|
|
426
423
|
async createRealtimeSession(thread_id = null, options = {}) {
|
|
427
424
|
options = {
|
|
428
425
|
include_thread: true,
|
|
@@ -430,7 +427,7 @@ export default class Agent {
|
|
|
430
427
|
...options,
|
|
431
428
|
};
|
|
432
429
|
|
|
433
|
-
//
|
|
430
|
+
// If a thread is passed, it is used, otherwise a temporary thread is created
|
|
434
431
|
const thread = await this.getThread(thread_id || uuid());
|
|
435
432
|
|
|
436
433
|
const system_message = [], conversation = [];
|