@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.
package/README.md CHANGED
@@ -433,20 +433,32 @@ console.log(res.sources); // scored sources
433
433
  ```
434
434
 
435
435
  Pick the model that writes the answer with `model` — the default is Gemma 4
436
- 26B (`"gemma-4-26b"`, included on every plan; `"llama-3.3-70b"` is also
437
- included). Premium models like
438
- `"kimi-k2.5"` and `"kimi-k2.6"` use extra ask credits and need a paid plan,
439
- and `"byok"` answers with your own linked provider model (configured in the
440
- dashboard, billed to your provider):
436
+ 26B (`"gemma-4-26b"`, 1 Ask credit, on every plan). Larger models use more
437
+ Ask credits per answer — `"llama-3.3-70b"` uses 2 on every plan; `"qwen3.8-27b"`
438
+ (3) and `"glm-5.3"` (5) need a paid plan — and `"byok"` answers with your own
439
+ linked provider model (configured in the dashboard, billed to your provider,
440
+ 1 Ask credit). The dashboard's model picker shows each model's credits.
441
441
 
442
442
  ```typescript
443
443
  const res = await client.ask("blue widgets under $50", {
444
444
  answer: true,
445
- model: "llama-3.3-70b", // or "kimi-k2.5" / "byok" on paid plans
445
+ model: "llama-3.3-70b", // or "glm-5.3" / "byok" on paid plans
446
446
  });
447
- console.log(res.model); // slug actually used (reveals fallbacks)
447
+ console.log(res.model); // slug actually used
448
+ console.log(res.credits); // Ask credits this ask used
449
+ console.log(res.fallback); // "busy" | "unavailable" when the default answered instead
448
450
  ```
449
451
 
452
+ If the model you picked is busy or unavailable, the default model answers
453
+ instead and `fallback` says why; you're charged the default's credits.
454
+
455
+ With `model: "byok"` (your own linked model), FetchBrain never answers with
456
+ its own models. If your provider fails, you get the `sources` without an
457
+ `answer`, `fallback: "provider_error"`, and a `code`: `BYOK_KEY_INVALID`
458
+ (update your key), `BYOK_PROVIDER_BUSY` (rate-limited) or
459
+ `BYOK_PROVIDER_FAILED`. The ask still costs 1 credit. Your question and the
460
+ matching sources are sent to your provider under your agreement with them.
461
+
450
462
  An answer can take tens of seconds, so `ask()` waits up to 60s by default.
451
463
  Change that for every call with the `askTimeout` option, or for one call
452
464
  with `timeout` (ms), which wins over `askTimeout`. Both accept 1 to 2147483647 ms
@@ -837,7 +849,7 @@ It depends on where they run. Memory is always private to your account.
837
849
  `FETCHBRAIN_SCRAPER_ID` (see [Name your scraper](#name-your-scraper-scraper)).
838
850
  - **A named scraper** (anywhere, including Apify) only sees its own memory.
839
851
  - **Ask Your Brain in the dashboard** (and `ask()` calls with no platform
840
- context) answers across everything your account has indexed.
852
+ context) answers across every page Ask can read in your account.
841
853
 
842
854
  **What leaves my process?**
843
855
  Your requests (minus `Authorization`, `Cookie` and `Set-Cookie` headers),
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FetchBrainConfig, R as RawRequest, a as RecallResult, L as LearnedData, b as LearnResponse, S as StatsResponse, A as AskResponse, C as ChangeStats, c as RunReport, d as RunFlag, e as CircuitState, T as TelemetryData, f as TelemetryConfig, g as CircuitBreakerConfig, h as Logger, B as BatchConfig, i as LogLevel } from './types-BCbMwaYW.mjs';
2
- export { p as ChangeDetectionConfig, D as DriftItem, m as LearnRequest, o as LogUrlRequest, M as MemoryDepth, j as RecallRequest, k as RecallResponse, l as RecallResultItem, n as RecalledEvent, q as TelemetryRequest, r as TelemetryResponse } from './types-BCbMwaYW.mjs';
1
+ import { F as FetchBrainConfig, R as RawRequest, a as RecallResult, L as LearnedData, b as LearnResponse, S as StatsResponse, A as AskResponse, C as ChangeStats, c as RunReport, d as RunFlag, e as CircuitState, T as TelemetryData, f as TelemetryConfig, g as CircuitBreakerConfig, h as Logger, B as BatchConfig, i as LogLevel } from './types-BgqTjfAN.mjs';
2
+ export { p as ChangeDetectionConfig, D as DriftItem, m as LearnRequest, o as LogUrlRequest, M as MemoryDepth, j as RecallRequest, k as RecallResponse, l as RecallResultItem, n as RecalledEvent, q as TelemetryRequest, r as TelemetryResponse } from './types-BgqTjfAN.mjs';
3
3
 
4
4
  declare class FetchBrainClient {
5
5
  private config;
@@ -67,7 +67,7 @@ declare class FetchBrainClient {
67
67
  * Ask a natural-language question, answered from everything the account has learned
68
68
  *
69
69
  * `model` picks the generation model for answer mode from the server's
70
- * menu (e.g. "llama-3.3-70b", "kimi-k2.5" — premium models cost extra ask
70
+ * menu (e.g. "llama-3.3-70b", "glm-5.3" — larger models use more Ask
71
71
  * credits), or "byok" to answer with your own linked provider model.
72
72
  * Omit it for the default model.
73
73
  *
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FetchBrainConfig, R as RawRequest, a as RecallResult, L as LearnedData, b as LearnResponse, S as StatsResponse, A as AskResponse, C as ChangeStats, c as RunReport, d as RunFlag, e as CircuitState, T as TelemetryData, f as TelemetryConfig, g as CircuitBreakerConfig, h as Logger, B as BatchConfig, i as LogLevel } from './types-BCbMwaYW.js';
2
- export { p as ChangeDetectionConfig, D as DriftItem, m as LearnRequest, o as LogUrlRequest, M as MemoryDepth, j as RecallRequest, k as RecallResponse, l as RecallResultItem, n as RecalledEvent, q as TelemetryRequest, r as TelemetryResponse } from './types-BCbMwaYW.js';
1
+ import { F as FetchBrainConfig, R as RawRequest, a as RecallResult, L as LearnedData, b as LearnResponse, S as StatsResponse, A as AskResponse, C as ChangeStats, c as RunReport, d as RunFlag, e as CircuitState, T as TelemetryData, f as TelemetryConfig, g as CircuitBreakerConfig, h as Logger, B as BatchConfig, i as LogLevel } from './types-BgqTjfAN.js';
2
+ export { p as ChangeDetectionConfig, D as DriftItem, m as LearnRequest, o as LogUrlRequest, M as MemoryDepth, j as RecallRequest, k as RecallResponse, l as RecallResultItem, n as RecalledEvent, q as TelemetryRequest, r as TelemetryResponse } from './types-BgqTjfAN.js';
3
3
 
4
4
  declare class FetchBrainClient {
5
5
  private config;
@@ -67,7 +67,7 @@ declare class FetchBrainClient {
67
67
  * Ask a natural-language question, answered from everything the account has learned
68
68
  *
69
69
  * `model` picks the generation model for answer mode from the server's
70
- * menu (e.g. "llama-3.3-70b", "kimi-k2.5" — premium models cost extra ask
70
+ * menu (e.g. "llama-3.3-70b", "glm-5.3" — larger models use more Ask
71
71
  * credits), or "byok" to answer with your own linked provider model.
72
72
  * Omit it for the default model.
73
73
  *
package/dist/index.js CHANGED
@@ -701,7 +701,7 @@ var FetchBrainClient = class {
701
701
  * Ask a natural-language question, answered from everything the account has learned
702
702
  *
703
703
  * `model` picks the generation model for answer mode from the server's
704
- * menu (e.g. "llama-3.3-70b", "kimi-k2.5" — premium models cost extra ask
704
+ * menu (e.g. "llama-3.3-70b", "glm-5.3" — larger models use more Ask
705
705
  * credits), or "byok" to answer with your own linked provider model.
706
706
  * Omit it for the default model.
707
707
  *