@demicodes/provider-openai-api 0.7.2 → 0.8.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.
- package/dist/index.mjs +17 -2
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -544,14 +544,29 @@ function inferenceItemsToOpenAIMessages(systemPrompt, items) {
|
|
|
544
544
|
}
|
|
545
545
|
});
|
|
546
546
|
break;
|
|
547
|
-
case "tool_result":
|
|
547
|
+
case "tool_result": {
|
|
548
548
|
flushAssistant();
|
|
549
549
|
messages.push({
|
|
550
550
|
role: "tool",
|
|
551
551
|
tool_call_id: item.toolUseId,
|
|
552
552
|
content: toolResultContentToText(item.output)
|
|
553
553
|
});
|
|
554
|
+
const media = item.output.filter((block) => block.type !== "text");
|
|
555
|
+
if (media.length > 0) messages.push({
|
|
556
|
+
role: "user",
|
|
557
|
+
content: [{
|
|
558
|
+
type: "text",
|
|
559
|
+
text: `[media returned by tool call ${item.toolUseId}]`
|
|
560
|
+
}, ...media.map((block) => ({
|
|
561
|
+
type: "image_url",
|
|
562
|
+
image_url: {
|
|
563
|
+
url: `data:${block.source.mediaType};base64,${block.source.data}`,
|
|
564
|
+
detail: "auto"
|
|
565
|
+
}
|
|
566
|
+
}))]
|
|
567
|
+
});
|
|
554
568
|
break;
|
|
569
|
+
}
|
|
555
570
|
case "assistant_thinking":
|
|
556
571
|
case "assistant_redacted_thinking": break;
|
|
557
572
|
}
|
|
@@ -669,7 +684,7 @@ function inferenceItemToOpenAIResponseInput(item, index, options) {
|
|
|
669
684
|
call_id: callId,
|
|
670
685
|
output: toolResultContentToText(item.output)
|
|
671
686
|
}];
|
|
672
|
-
const images = item.output.filter((block) => block.type
|
|
687
|
+
const images = item.output.filter((block) => block.type !== "text");
|
|
673
688
|
if (images.length > 0) items.push({
|
|
674
689
|
role: "user",
|
|
675
690
|
content: [{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@demicodes/provider-openai-api",
|
|
3
3
|
"description": "OpenAI API provider adapter for Demi.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@demicodes/core": "^0.
|
|
15
|
-
"@demicodes/provider": "^0.
|
|
16
|
-
"@demicodes/utils": "^0.
|
|
14
|
+
"@demicodes/core": "^0.8.0",
|
|
15
|
+
"@demicodes/provider": "^0.8.0",
|
|
16
|
+
"@demicodes/utils": "^0.8.0"
|
|
17
17
|
},
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"main": "./dist/index.mjs",
|