@zenmux/rosetta-ai 1.0.38 → 1.0.40
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/responses/gemini.js
CHANGED
|
@@ -509,6 +509,14 @@ class ResponsesToGeminiConverter {
|
|
|
509
509
|
else if (p.type === "refusal") {
|
|
510
510
|
parts.push({ text: p.refusal });
|
|
511
511
|
}
|
|
512
|
+
else if (p.type === "input_audio") {
|
|
513
|
+
parts.push({
|
|
514
|
+
inlineData: {
|
|
515
|
+
mimeType: `audio/${p.input_audio?.format || "*"}`,
|
|
516
|
+
data: p.input_audio?.data,
|
|
517
|
+
},
|
|
518
|
+
});
|
|
519
|
+
}
|
|
512
520
|
else if (p.type === "input_image") {
|
|
513
521
|
const url = p.image_url || "";
|
|
514
522
|
const match = url.match(/^data:([^;]+);base64,(.+)$/);
|
|
@@ -788,14 +788,18 @@ class ResponsesToMessagesConverter {
|
|
|
788
788
|
else if (typed.type === "function_call_output") {
|
|
789
789
|
flushAssistant();
|
|
790
790
|
const output = typed.output;
|
|
791
|
-
//
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
791
|
+
// Preserve native content parts while keeping legacy JSON outputs and strings as text.
|
|
792
|
+
const isContentArray = Array.isArray(output) &&
|
|
793
|
+
output.length > 0 &&
|
|
794
|
+
output.every(part => part != null && ["input_text", "input_image", "input_file"].includes(part.type));
|
|
795
|
+
let content = output;
|
|
796
|
+
if (!isContentArray && typeof output !== "string") {
|
|
797
|
+
content = output == null ? "" : JSON.stringify(output);
|
|
798
|
+
}
|
|
795
799
|
const toolResult = {
|
|
796
800
|
type: "tool_result",
|
|
797
801
|
tool_use_id: typed.call_id,
|
|
798
|
-
content:
|
|
802
|
+
content: this.convertInputContent(content),
|
|
799
803
|
};
|
|
800
804
|
// Anthropic requires parallel tool_results grouped in one user message,
|
|
801
805
|
// so append to the prior user message if it already holds tool_results.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenmux/rosetta-ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "Universal translator between AI provider protocols",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -60,4 +60,4 @@
|
|
|
60
60
|
"typescript": "^6.0.2",
|
|
61
61
|
"typescript-eslint": "^8.58.2"
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|