@crewdle/mist-connector-openai 1.0.15 → 1.0.17
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({
|
|
@@ -140,6 +141,7 @@ export class OpenAIGenerativeAIWorkerConnector {
|
|
|
140
141
|
temperature: parameters.temperature,
|
|
141
142
|
text: responseFormat,
|
|
142
143
|
tools,
|
|
144
|
+
store: parameters.privacy,
|
|
143
145
|
});
|
|
144
146
|
console.log('OpenAIGenerativeAIWorkerConnector.processJob response');
|
|
145
147
|
inputTokens += response.usage?.input_tokens ?? 0;
|
|
@@ -153,6 +155,9 @@ export class OpenAIGenerativeAIWorkerConnector {
|
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
}
|
|
158
|
+
if (content.type === 'image_generation_call' && content.result) {
|
|
159
|
+
resultFile = `data:image/png;base64,${content.result}`;
|
|
160
|
+
}
|
|
156
161
|
if (content.type === 'function_call') {
|
|
157
162
|
promises.push(this.processToolCall(parameters, messages, content.name, content.call_id, content.arguments));
|
|
158
163
|
}
|
|
@@ -164,6 +169,7 @@ export class OpenAIGenerativeAIWorkerConnector {
|
|
|
164
169
|
return {
|
|
165
170
|
type: "prompt" /* GenerativeAIJobType.Prompt */,
|
|
166
171
|
output,
|
|
172
|
+
resultFile,
|
|
167
173
|
inputTokens,
|
|
168
174
|
outputTokens,
|
|
169
175
|
};
|
|
@@ -277,6 +283,7 @@ export class OpenAIGenerativeAIWorkerConnector {
|
|
|
277
283
|
text: responseFormat,
|
|
278
284
|
tools,
|
|
279
285
|
stream: true,
|
|
286
|
+
store: parameters.privacy,
|
|
280
287
|
});
|
|
281
288
|
console.log('OpenAIGenerativeAIWorkerConnector.processJobStream response');
|
|
282
289
|
const promises = [];
|
|
@@ -301,6 +308,15 @@ export class OpenAIGenerativeAIWorkerConnector {
|
|
|
301
308
|
if (chunk.item.type === 'function_call') {
|
|
302
309
|
promises.push(this.processToolCall(parameters, messages, chunk.item.name, chunk.item.call_id, chunk.item.arguments));
|
|
303
310
|
}
|
|
311
|
+
if (chunk.item.type === 'image_generation_call' && chunk.item.result) {
|
|
312
|
+
yield {
|
|
313
|
+
type: "prompt" /* GenerativeAIJobType.Prompt */,
|
|
314
|
+
output: '',
|
|
315
|
+
resultFile: `data:image/png;base64,${chunk.item.result}`,
|
|
316
|
+
inputTokens: 0,
|
|
317
|
+
outputTokens: 0,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
304
320
|
}
|
|
305
321
|
}
|
|
306
322
|
if (promises.length > 0) {
|
|
@@ -419,6 +435,18 @@ export class OpenAIGenerativeAIWorkerConnector {
|
|
|
419
435
|
}
|
|
420
436
|
const tools = [];
|
|
421
437
|
for (const [name, func] of parameters.functions) {
|
|
438
|
+
if (func.type === 'mcp') {
|
|
439
|
+
tools.push(func);
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
if (func.type === 'code_interpreter') {
|
|
443
|
+
tools.push(func);
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
if (func.type === 'image_generation') {
|
|
447
|
+
tools.push(func);
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
422
450
|
let params = null;
|
|
423
451
|
if (func.params) {
|
|
424
452
|
params = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewdle/mist-connector-openai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
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.
|
|
18
|
+
"@crewdle/web-sdk-types": "^1.0.51",
|
|
19
19
|
"@types/node": "^22.13.9",
|
|
20
20
|
"typescript": "^5.8.2"
|
|
21
21
|
},
|