symposium 2.2.2 → 2.2.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 +7 -2
- package/README.md +12 -4
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -256,7 +256,8 @@ export default class Agent {
|
|
|
256
256
|
for (let message of completion) {
|
|
257
257
|
if (message.role === 'assistant' && message.content.some(c => c.type === 'reasoning')) {
|
|
258
258
|
const reasoning = message.content.find(c => c.type === 'reasoning').content;
|
|
259
|
-
|
|
259
|
+
if (reasoning)
|
|
260
|
+
emitter.emit('reasoning', reasoning);
|
|
260
261
|
}
|
|
261
262
|
}
|
|
262
263
|
|
|
@@ -410,7 +411,11 @@ export default class Agent {
|
|
|
410
411
|
return {type: 'response', value: this.afterHandle(thread, completion, JSON.parse(m.content))};
|
|
411
412
|
}
|
|
412
413
|
|
|
413
|
-
emitter.emit('output', m
|
|
414
|
+
emitter.emit('output', m);
|
|
415
|
+
break;
|
|
416
|
+
|
|
417
|
+
case 'image':
|
|
418
|
+
emitter.emit('output', m);
|
|
414
419
|
break;
|
|
415
420
|
|
|
416
421
|
case 'function':
|
package/README.md
CHANGED
|
@@ -129,15 +129,23 @@ async function main() {
|
|
|
129
129
|
|
|
130
130
|
const emitter = await agent.message('Hello, who are you?');
|
|
131
131
|
|
|
132
|
-
emitter.on('output',
|
|
133
|
-
|
|
132
|
+
emitter.on('output', message => {
|
|
133
|
+
switch (message.type) {
|
|
134
|
+
case 'text':
|
|
135
|
+
process.stdout.write(message.content);
|
|
136
|
+
break;
|
|
137
|
+
|
|
138
|
+
case 'image':
|
|
139
|
+
// Process image
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
134
142
|
});
|
|
135
143
|
|
|
136
|
-
emitter.on('error',
|
|
144
|
+
emitter.on('error', error => {
|
|
137
145
|
console.error(`\nAn error occurred: ${error.message}`);
|
|
138
146
|
});
|
|
139
147
|
|
|
140
|
-
emitter.on('tool',
|
|
148
|
+
emitter.on('tool', tool => {
|
|
141
149
|
console.log(`\n> Using tool: ${tool.name} with arguments ${JSON.stringify(tool.arguments)}\n`);
|
|
142
150
|
});
|
|
143
151
|
|