floe-guard 0.16.0 → 0.17.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
@@ -12,9 +12,14 @@ your process.
12
12
  Works with both **AI SDK v4 and v5** (`ai@4` / `ai@5`).
13
13
 
14
14
  ```bash
15
- npm i floe-guard ai @ai-sdk/openai
15
+ npm i floe-guard ai@5 @ai-sdk/openai@2
16
16
  ```
17
17
 
18
+ This example uses AI SDK 5 with its compatible OpenAI provider, version 2.
19
+ For AI SDK 4, use `ai@4 @ai-sdk/openai@1`. Keep the SDK and provider major
20
+ versions compatible; installing the latest provider can select a model API
21
+ that this middleware does not support.
22
+
18
23
  ```ts
19
24
  import { wrapLanguageModel } from "ai";
20
25
  import { openai } from "@ai-sdk/openai";
@@ -44,7 +44,7 @@ var BudgetExceeded = class extends FloeGuardError {
44
44
  this.limitUsd = limitUsd;
45
45
  }
46
46
  };
47
- var UnpriceableVoiceError = class extends FloeGuardError {
47
+ var UnpriceableLegError = class extends FloeGuardError {
48
48
  vendor;
49
49
  mode;
50
50
  constructor(vendor, mode) {
@@ -1399,7 +1399,7 @@ function resolveVoiceRate(model, mode, override) {
1399
1399
  return { mode, unit: unitForMode[mode], rate: override, source: "override" };
1400
1400
  }
1401
1401
  const rate = lookupVoiceRate(model, mode);
1402
- if (rate === null) throw new UnpriceableVoiceError(model ?? null, mode);
1402
+ if (rate === null) throw new UnpriceableLegError(model ?? null, mode);
1403
1403
  return { mode, unit: unitForMode[mode], rate, source: "cost_map" };
1404
1404
  }
1405
1405
  function voiceLegCost(mode, quantity, rate) {