symposium 0.14.2 → 0.14.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 +20 -0
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -412,4 +412,24 @@ export default class Agent {
|
|
|
412
412
|
async getPromptWordsForTranscription(thread) {
|
|
413
413
|
return [this.name];
|
|
414
414
|
}
|
|
415
|
+
|
|
416
|
+
async createRealtimeSession() {
|
|
417
|
+
const model = Symposium.getModelByName(thread.state.model);
|
|
418
|
+
if(!model.hasOwnProperty('openai'))
|
|
419
|
+
throw new Error('Model does not support real-time sessions');
|
|
420
|
+
|
|
421
|
+
// Recupero il messaggio di sistema
|
|
422
|
+
const thread = new Thread('temp', 'default', this);
|
|
423
|
+
await this.resetState(thread);
|
|
424
|
+
await this.initThread(thread);
|
|
425
|
+
|
|
426
|
+
const instructions = thread.messages.filter(m => m.role === 'system').map(m => m.content.map(c => c.content).join("\n")).join("\n");
|
|
427
|
+
|
|
428
|
+
const openai = model.getOpenAi();
|
|
429
|
+
return openai.realtime.sessions.create({
|
|
430
|
+
model: 'gpt-4o-realtime-preview',
|
|
431
|
+
instructions,
|
|
432
|
+
tools: await this.getFunctions(),
|
|
433
|
+
});
|
|
434
|
+
}
|
|
415
435
|
}
|