symposium 0.14.2 → 0.14.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.
Files changed (2) hide show
  1. package/Agent.js +26 -0
  2. package/package.json +1 -1
package/Agent.js CHANGED
@@ -412,4 +412,30 @@ export default class Agent {
412
412
  async getPromptWordsForTranscription(thread) {
413
413
  return [this.name];
414
414
  }
415
+
416
+ async createRealtimeSession() {
417
+ // Thread fittizio
418
+ const thread = new Thread('temp', 'default', this);
419
+ await this.resetState(thread);
420
+ await this.initThread(thread);
421
+
422
+ const instructions = thread.messages.filter(m => m.role === 'system').map(m => m.content.map(c => c.content).join("\n")).join("\n");
423
+ const tools = (await this.getFunctions()).map(t => ({
424
+ type: 'function',
425
+ ...t,
426
+ }));
427
+
428
+ return fetch('https://api.openai.com/v1/realtime/sessions', {
429
+ method: 'POST',
430
+ headers: {
431
+ "Authorization": `Bearer ${process.env.OPENAI_API_KEY}`,
432
+ "Content-Type": 'application/json',
433
+ },
434
+ body: JSON.stringify({
435
+ model: 'gpt-4o-realtime-preview',
436
+ instructions,
437
+ tools,
438
+ }),
439
+ }).then(response => response.json());
440
+ }
415
441
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "0.14.2",
4
+ "version": "0.14.4",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",