symposium 2.2.4 → 2.3.0

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.
@@ -21,4 +21,48 @@ export default class GrokModel extends LegacyOpenAIModel {
21
21
 
22
22
  return this.openai;
23
23
  }
24
+
25
+ async generate(model, thread, functions = [], options = {}) {
26
+ if (options.image_generation) {
27
+ functions.push({
28
+ name: 'generate_image',
29
+ description: 'Generate an image based on a detailed prompt that you provide',
30
+ parameters: {
31
+ type: 'object',
32
+ properties: {
33
+ prompt: {
34
+ type: 'string',
35
+ description: 'A detailed description of the image to generate',
36
+ },
37
+ },
38
+ required: ['prompt'],
39
+ },
40
+ });
41
+ }
42
+
43
+ const response = await super.generate(model, thread, functions, options);
44
+
45
+ // Check for image generation response
46
+ if (options.image_generation) {
47
+ const function_call = response[0].content.find(c => c.type === 'function');
48
+ if (function_call) {
49
+ const generation_call = function_call.content.find(f => f.name === 'generate_image');
50
+ if (generation_call) {
51
+ const response = await this.getOpenAi().images.generate({
52
+ model: 'grok-2-image',
53
+ prompt: generation_call.arguments.prompt,
54
+ });
55
+
56
+ function_call.type = 'image';
57
+ function_call.content = {
58
+ type: 'url',
59
+ mime: 'image/jpeg',
60
+ data: response.data[0].url,
61
+ };
62
+ }
63
+ }
64
+ }
65
+
66
+ return response;
67
+ }
24
68
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "2.2.4",
4
+ "version": "2.3.0",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",