@jambonz/llm 0.3.2 → 0.3.4
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.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/test-kit/index.cjs +17 -2
- package/dist/test-kit/index.cjs.map +1 -1
- package/dist/test-kit/index.js +17 -2
- package/dist/test-kit/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1731,15 +1731,29 @@ async function surfaceErrorBody(response, input) {
|
|
|
1731
1731
|
`[vertex-openai] ${response.status} ${response.statusText} from ${url}: ${body || "(empty body)"}${hint}`
|
|
1732
1732
|
);
|
|
1733
1733
|
}
|
|
1734
|
+
const normalizedBody = unwrapVertexErrorArray(body) + hint;
|
|
1734
1735
|
const headers = new Headers(response.headers);
|
|
1735
1736
|
headers.delete("content-encoding");
|
|
1736
1737
|
headers.delete("content-length");
|
|
1737
|
-
return new Response(
|
|
1738
|
+
return new Response(normalizedBody, {
|
|
1738
1739
|
status: response.status,
|
|
1739
1740
|
statusText: response.statusText,
|
|
1740
1741
|
headers
|
|
1741
1742
|
});
|
|
1742
1743
|
}
|
|
1744
|
+
function unwrapVertexErrorArray(body) {
|
|
1745
|
+
if (!body) return body;
|
|
1746
|
+
const trimmed = body.trim();
|
|
1747
|
+
if (!trimmed.startsWith("[")) return body;
|
|
1748
|
+
try {
|
|
1749
|
+
const parsed = JSON.parse(trimmed);
|
|
1750
|
+
if (Array.isArray(parsed) && parsed.length === 1 && parsed[0]?.error) {
|
|
1751
|
+
return JSON.stringify(parsed[0]);
|
|
1752
|
+
}
|
|
1753
|
+
} catch {
|
|
1754
|
+
}
|
|
1755
|
+
return body;
|
|
1756
|
+
}
|
|
1743
1757
|
|
|
1744
1758
|
// src/adapters/vertex-openai/factory.ts
|
|
1745
1759
|
var vertexOpenAIFactory = {
|
|
@@ -1877,7 +1891,8 @@ var BEDROCK_KNOWN_MODELS = [
|
|
|
1877
1891
|
vision: false,
|
|
1878
1892
|
systemPrompt: true,
|
|
1879
1893
|
maxContextTokens: 128e3
|
|
1880
|
-
}
|
|
1894
|
+
},
|
|
1895
|
+
deprecated: true
|
|
1881
1896
|
}
|
|
1882
1897
|
];
|
|
1883
1898
|
var BEDROCK_REGIONS = [
|