@crewdle/mist-connector-openai 1.0.15 → 1.0.16

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.
@@ -131,6 +131,7 @@ export class OpenAIGenerativeAIWorkerConnector {
131
131
  let inputTokens = 0;
132
132
  let outputTokens = 0;
133
133
  let output = '';
134
+ let resultFile;
134
135
  while (true) {
135
136
  console.log('OpenAIGenerativeAIWorkerConnector.processJob', options.model.id);
136
137
  const response = await this.client.responses.create({
@@ -153,6 +154,9 @@ export class OpenAIGenerativeAIWorkerConnector {
153
154
  }
154
155
  }
155
156
  }
157
+ if (content.type === 'image_generation_call' && content.result) {
158
+ resultFile = `data:image/png;base64,${content.result}`;
159
+ }
156
160
  if (content.type === 'function_call') {
157
161
  promises.push(this.processToolCall(parameters, messages, content.name, content.call_id, content.arguments));
158
162
  }
@@ -164,6 +168,7 @@ export class OpenAIGenerativeAIWorkerConnector {
164
168
  return {
165
169
  type: "prompt" /* GenerativeAIJobType.Prompt */,
166
170
  output,
171
+ resultFile,
167
172
  inputTokens,
168
173
  outputTokens,
169
174
  };
@@ -301,6 +306,15 @@ export class OpenAIGenerativeAIWorkerConnector {
301
306
  if (chunk.item.type === 'function_call') {
302
307
  promises.push(this.processToolCall(parameters, messages, chunk.item.name, chunk.item.call_id, chunk.item.arguments));
303
308
  }
309
+ if (chunk.item.type === 'image_generation_call' && chunk.item.result) {
310
+ yield {
311
+ type: "prompt" /* GenerativeAIJobType.Prompt */,
312
+ output: '',
313
+ resultFile: `data:image/png;base64,${chunk.item.result}`,
314
+ inputTokens: 0,
315
+ outputTokens: 0,
316
+ };
317
+ }
304
318
  }
305
319
  }
306
320
  if (promises.length > 0) {
@@ -419,6 +433,18 @@ export class OpenAIGenerativeAIWorkerConnector {
419
433
  }
420
434
  const tools = [];
421
435
  for (const [name, func] of parameters.functions) {
436
+ if (func.type === 'mcp') {
437
+ tools.push(func);
438
+ continue;
439
+ }
440
+ if (func.type === 'code_interpreter') {
441
+ tools.push(func);
442
+ continue;
443
+ }
444
+ if (func.type === 'image_generation') {
445
+ tools.push(func);
446
+ continue;
447
+ }
422
448
  let params = null;
423
449
  if (func.params) {
424
450
  params = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewdle/mist-connector-openai",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "dist/"
16
16
  ],
17
17
  "devDependencies": {
18
- "@crewdle/web-sdk-types": "^1.0.48",
18
+ "@crewdle/web-sdk-types": "^1.0.50",
19
19
  "@types/node": "^22.13.9",
20
20
  "typescript": "^5.8.2"
21
21
  },