@fetchbrain.com/sdk 0.10.0 → 0.11.0

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.
@@ -1,4 +1,4 @@
1
- import { R as RawRequest, a as RecallResult, b as LearnResponse, S as StatsResponse, A as AskResponse, F as FetchBrainConfig } from '../types-BCbMwaYW.mjs';
1
+ import { R as RawRequest, a as RecallResult, b as LearnResponse, S as StatsResponse, A as AskResponse, F as FetchBrainConfig } from '../types-BgqTjfAN.mjs';
2
2
 
3
3
  /**
4
4
  * Mock FetchBrain for unit testing
@@ -1,4 +1,4 @@
1
- import { R as RawRequest, a as RecallResult, b as LearnResponse, S as StatsResponse, A as AskResponse, F as FetchBrainConfig } from '../types-BCbMwaYW.js';
1
+ import { R as RawRequest, a as RecallResult, b as LearnResponse, S as StatsResponse, A as AskResponse, F as FetchBrainConfig } from '../types-BgqTjfAN.js';
2
2
 
3
3
  /**
4
4
  * Mock FetchBrain for unit testing
@@ -300,6 +300,17 @@ interface AskResponse {
300
300
  error?: string;
301
301
  /** Slug of the generation model actually used (answer mode; reveals fallbacks). */
302
302
  model?: string;
303
+ /** Ask credits this ask used (present when status is "ok"). */
304
+ credits?: number;
305
+ /**
306
+ * Why `model` isn't the one you asked for: "busy" — it was at capacity;
307
+ * "unavailable" — it failed. The default model answered, at its own credits.
308
+ * "provider_error" — your linked model (`model: "byok"`) didn't answer: no
309
+ * `answer`, the `sources` are still returned, and `code` says why.
310
+ */
311
+ fallback?: "busy" | "unavailable" | "provider_error";
312
+ /** With `fallback: "provider_error"`: why your linked model didn't answer. */
313
+ code?: "BYOK_KEY_INVALID" | "BYOK_PROVIDER_BUSY" | "BYOK_PROVIDER_FAILED";
303
314
  }
304
315
  /** Circuit breaker states */
305
316
  type CircuitState = "closed" | "open" | "half-open";
@@ -300,6 +300,17 @@ interface AskResponse {
300
300
  error?: string;
301
301
  /** Slug of the generation model actually used (answer mode; reveals fallbacks). */
302
302
  model?: string;
303
+ /** Ask credits this ask used (present when status is "ok"). */
304
+ credits?: number;
305
+ /**
306
+ * Why `model` isn't the one you asked for: "busy" — it was at capacity;
307
+ * "unavailable" — it failed. The default model answered, at its own credits.
308
+ * "provider_error" — your linked model (`model: "byok"`) didn't answer: no
309
+ * `answer`, the `sources` are still returned, and `code` says why.
310
+ */
311
+ fallback?: "busy" | "unavailable" | "provider_error";
312
+ /** With `fallback: "provider_error"`: why your linked model didn't answer. */
313
+ code?: "BYOK_KEY_INVALID" | "BYOK_PROVIDER_BUSY" | "BYOK_PROVIDER_FAILED";
303
314
  }
304
315
  /** Circuit breaker states */
305
316
  type CircuitState = "closed" | "open" | "half-open";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fetchbrain.com/sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "FetchBrain SDK — make your Crawlee scrapers smarter with every run; recall before you fetch, teach what you learn.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",