@skydiveai/pi-server 0.1.0-beta.635 → 0.1.0-beta.766

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.
Files changed (2) hide show
  1. package/dist/index.mjs +2 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -877,6 +877,7 @@ function classifyCode(status, message, code) {
877
877
  if (status === 429 || code === "rate_limit_exceeded" || /rate[_ ]limit|too many requests|resource[_ ]exhausted/i.test(message)) return "rate_limited";
878
878
  if (status === 529 || code === "provider_overloaded" || /overloaded/i.test(message)) return "provider_overloaded";
879
879
  if (status === 503 || status === 504 || code === "provider_unavailable" || /no healthy upstream|upstream request timeout|stream timeout|service unavailable|unavailable|gateway/i.test(message)) return "provider_unavailable";
880
+ if (code === "content_filter" || /finish_reason:\s*content_filter|content[_ ]filter|content[_ ]management[_ ]policy/i.test(message)) return "content_filter";
880
881
  return "provider_error";
881
882
  }
882
883
  /**
@@ -891,7 +892,7 @@ function isModelProviderError(err) {
891
892
  if (numericStatus(e) !== null) return true;
892
893
  if (e.error && typeof e.error === "object") return true;
893
894
  const msg = messageText(err);
894
- return /prompt is too long|context[_ ]length[_ ]exceeded|exceeds maximum token limit|input token count|rate[_ ]limit|overloaded|no healthy upstream|upstream request timeout|insufficient credits|requires more credits|credit balance is too low|payment required|purchase more credits/i.test(msg);
895
+ return /prompt is too long|context[_ ]length[_ ]exceeded|exceeds maximum token limit|input token count|rate[_ ]limit|overloaded|no healthy upstream|upstream request timeout|insufficient credits|requires more credits|credit balance is too low|payment required|purchase more credits|finish_reason:\s*content_filter|content[_ ]filter|content[_ ]management[_ ]policy/i.test(msg);
895
896
  }
896
897
  /** Build the structured, forwardable error from a thrown model-provider error. */
897
898
  function toModelProviderError(err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skydiveai/pi-server",
3
- "version": "0.1.0-beta.635",
3
+ "version": "0.1.0-beta.766",
4
4
  "homepage": "https://skydive.com",
5
5
  "license": "MIT",
6
6
  "author": "Create, Inc.",
@@ -16,13 +16,13 @@
16
16
  }
17
17
  },
18
18
  "publishConfig": {
19
- "access": "public",
20
19
  "exports": {
21
20
  ".": {
22
21
  "types": "./dist/index.d.mts",
23
22
  "default": "./dist/index.mjs"
24
23
  }
25
24
  },
25
+ "access": "public",
26
26
  "registry": "https://registry.npmjs.org"
27
27
  },
28
28
  "scripts": {