@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.
@@ -1719,15 +1719,29 @@ async function surfaceErrorBody(response, input) {
1719
1719
  `[vertex-openai] ${response.status} ${response.statusText} from ${url}: ${body || "(empty body)"}${hint}`
1720
1720
  );
1721
1721
  }
1722
+ const normalizedBody = unwrapVertexErrorArray(body) + hint;
1722
1723
  const headers = new Headers(response.headers);
1723
1724
  headers.delete("content-encoding");
1724
1725
  headers.delete("content-length");
1725
- return new Response(body + hint, {
1726
+ return new Response(normalizedBody, {
1726
1727
  status: response.status,
1727
1728
  statusText: response.statusText,
1728
1729
  headers
1729
1730
  });
1730
1731
  }
1732
+ function unwrapVertexErrorArray(body) {
1733
+ if (!body) return body;
1734
+ const trimmed = body.trim();
1735
+ if (!trimmed.startsWith("[")) return body;
1736
+ try {
1737
+ const parsed = JSON.parse(trimmed);
1738
+ if (Array.isArray(parsed) && parsed.length === 1 && parsed[0]?.error) {
1739
+ return JSON.stringify(parsed[0]);
1740
+ }
1741
+ } catch {
1742
+ }
1743
+ return body;
1744
+ }
1731
1745
 
1732
1746
  // src/adapters/vertex-openai/factory.ts
1733
1747
  var vertexOpenAIFactory = {
@@ -1865,7 +1879,8 @@ var BEDROCK_KNOWN_MODELS = [
1865
1879
  vision: false,
1866
1880
  systemPrompt: true,
1867
1881
  maxContextTokens: 128e3
1868
- }
1882
+ },
1883
+ deprecated: true
1869
1884
  }
1870
1885
  ];
1871
1886
  var BEDROCK_REGIONS = [