@premai/api-sdk 1.0.48 → 1.0.49
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/anthropic/from-openai.d.ts +8 -1
- package/dist/cli.mjs +10 -0
- package/dist/index.cjs +10 -0
- package/dist/index.mjs +10 -0
- package/package.json +1 -1
|
@@ -14,7 +14,14 @@ export type AnthropicToolUseContentBlock = {
|
|
|
14
14
|
name: string;
|
|
15
15
|
input: unknown;
|
|
16
16
|
};
|
|
17
|
-
export type AnthropicAssistantContentBlock = AnthropicTextContentBlock | AnthropicToolUseContentBlock
|
|
17
|
+
export type AnthropicAssistantContentBlock = AnthropicTextContentBlock | AnthropicToolUseContentBlock | {
|
|
18
|
+
type: "thinking";
|
|
19
|
+
thinking: string;
|
|
20
|
+
signature: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: "redacted_thinking";
|
|
23
|
+
data: string;
|
|
24
|
+
};
|
|
18
25
|
export type AnthropicMessagePayload = {
|
|
19
26
|
id: string;
|
|
20
27
|
type: "message";
|
package/dist/cli.mjs
CHANGED
|
@@ -287,6 +287,9 @@ function anthropicAssistantContentToOpenAI(content) {
|
|
|
287
287
|
textParts.push(part.text);
|
|
288
288
|
continue;
|
|
289
289
|
}
|
|
290
|
+
if (part.type === "thinking" || part.type === "redacted_thinking") {
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
290
293
|
if (part.type === "tool_use") {
|
|
291
294
|
const p = part;
|
|
292
295
|
if (typeof p.id !== "string" || p.id.length === 0) {
|
|
@@ -460,6 +463,13 @@ function extractTextCharCount(body) {
|
|
|
460
463
|
continue;
|
|
461
464
|
if (part.type === "text" && typeof part.text === "string") {
|
|
462
465
|
len += part.text.length;
|
|
466
|
+
} else if (part.type === "thinking" && typeof part.thinking === "string") {
|
|
467
|
+
len += part.thinking.length;
|
|
468
|
+
} else if (part.type === "redacted_thinking") {
|
|
469
|
+
const d = part.data;
|
|
470
|
+
if (typeof d === "string") {
|
|
471
|
+
len += d.length;
|
|
472
|
+
}
|
|
463
473
|
} else if (part.type === "tool_result") {
|
|
464
474
|
const c = part.content;
|
|
465
475
|
if (typeof c === "string") {
|
package/dist/index.cjs
CHANGED
|
@@ -1931,6 +1931,9 @@ function anthropicAssistantContentToOpenAI(content) {
|
|
|
1931
1931
|
textParts.push(part.text);
|
|
1932
1932
|
continue;
|
|
1933
1933
|
}
|
|
1934
|
+
if (part.type === "thinking" || part.type === "redacted_thinking") {
|
|
1935
|
+
continue;
|
|
1936
|
+
}
|
|
1934
1937
|
if (part.type === "tool_use") {
|
|
1935
1938
|
const p = part;
|
|
1936
1939
|
if (typeof p.id !== "string" || p.id.length === 0) {
|
|
@@ -2104,6 +2107,13 @@ function extractTextCharCount(body) {
|
|
|
2104
2107
|
continue;
|
|
2105
2108
|
if (part.type === "text" && typeof part.text === "string") {
|
|
2106
2109
|
len += part.text.length;
|
|
2110
|
+
} else if (part.type === "thinking" && typeof part.thinking === "string") {
|
|
2111
|
+
len += part.thinking.length;
|
|
2112
|
+
} else if (part.type === "redacted_thinking") {
|
|
2113
|
+
const d = part.data;
|
|
2114
|
+
if (typeof d === "string") {
|
|
2115
|
+
len += d.length;
|
|
2116
|
+
}
|
|
2107
2117
|
} else if (part.type === "tool_result") {
|
|
2108
2118
|
const c = part.content;
|
|
2109
2119
|
if (typeof c === "string") {
|
package/dist/index.mjs
CHANGED
|
@@ -1851,6 +1851,9 @@ function anthropicAssistantContentToOpenAI(content) {
|
|
|
1851
1851
|
textParts.push(part.text);
|
|
1852
1852
|
continue;
|
|
1853
1853
|
}
|
|
1854
|
+
if (part.type === "thinking" || part.type === "redacted_thinking") {
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1854
1857
|
if (part.type === "tool_use") {
|
|
1855
1858
|
const p = part;
|
|
1856
1859
|
if (typeof p.id !== "string" || p.id.length === 0) {
|
|
@@ -2024,6 +2027,13 @@ function extractTextCharCount(body) {
|
|
|
2024
2027
|
continue;
|
|
2025
2028
|
if (part.type === "text" && typeof part.text === "string") {
|
|
2026
2029
|
len += part.text.length;
|
|
2030
|
+
} else if (part.type === "thinking" && typeof part.thinking === "string") {
|
|
2031
|
+
len += part.thinking.length;
|
|
2032
|
+
} else if (part.type === "redacted_thinking") {
|
|
2033
|
+
const d = part.data;
|
|
2034
|
+
if (typeof d === "string") {
|
|
2035
|
+
len += d.length;
|
|
2036
|
+
}
|
|
2027
2037
|
} else if (part.type === "tool_result") {
|
|
2028
2038
|
const c = part.content;
|
|
2029
2039
|
if (typeof c === "string") {
|