@warlock.js/ai 4.12.0 → 4.14.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/llms-full.txt
CHANGED
|
@@ -1626,7 +1626,7 @@ const gpt = openai.image({ name: "gpt-image-1", pricing: { input: 5, output: 40
|
|
|
1626
1626
|
const dalle = openai.image({ name: "dall-e-3", pricing: { perImage: 0.04 } });
|
|
1627
1627
|
```
|
|
1628
1628
|
|
|
1629
|
-
|
|
1629
|
+
The model id is **not validated locally**. `openai.image({ name })` forwards the id to `client.images.generate` exactly as given, so a non-image id (`openai.image({ name: "gpt-4o" })`) constructs fine and fails at OpenAI — as a typed provider error on `result.error`, never as a local throw at construction.
|
|
1630
1630
|
|
|
1631
1631
|
## Google — Imagen (per-image)
|
|
1632
1632
|
|
|
@@ -1641,6 +1641,8 @@ const { data } = await ai.image({ model: imagen, prompt: "a watercolor lighthous
|
|
|
1641
1641
|
|
|
1642
1642
|
Imagen returns base64 bytes (no hosted URL). When every candidate is safety-filtered, `ai.image` surfaces a typed `ContentFilterError` on `result.error`.
|
|
1643
1643
|
|
|
1644
|
+
Like every adapter, Google does **not** guard the model id: `google.image({ name })` passes the id through to `ai.models.generateImages` exactly as given, so an id Google does not serve fails as a typed provider error on `result.error` — not with a local throw at construction.
|
|
1645
|
+
|
|
1644
1646
|
## Cost-truth — one rollup, two metering models
|
|
1645
1647
|
|
|
1646
1648
|
`ai.image` fills `usage.cost` (a `ModelPricing`-shaped USD breakdown) so image spend folds into the **same** `Usage.cost` rollup as text — no second accounting path:
|
|
@@ -1713,7 +1715,7 @@ if (error) {
|
|
|
1713
1715
|
}
|
|
1714
1716
|
```
|
|
1715
1717
|
|
|
1716
|
-
`SpeechModelContract` mirrors `EmbedderContract` / `ImageModelContract` — a peer primitive produced by the adapter's optional `speech?()` factory. An adapter without a TTS API simply doesn't define `speech()`, so calling it is a **compile-time** error, not a silent runtime failure.
|
|
1718
|
+
`SpeechModelContract` mirrors `EmbedderContract` / `ImageModelContract` — a peer primitive produced by the adapter's optional `speech?()` factory. An adapter without a TTS API simply doesn't define `speech()`, so calling it is a **compile-time** error, not a silent runtime failure. The model id itself is **not validated locally** — a non-TTS id (`openai.speech({ name: "gpt-4o" })`) constructs fine and is forwarded to the provider as given, so it fails as a typed provider error on `result.error`, never as a local throw at construction.
|
|
1717
1719
|
|
|
1718
1720
|
## The result envelope
|
|
1719
1721
|
|
|
@@ -5150,7 +5152,7 @@ if (error) console.warn(error.code); // typed AIError
|
|
|
5150
5152
|
else console.log(data.text); // the transcript
|
|
5151
5153
|
```
|
|
5152
5154
|
|
|
5153
|
-
`TranscriptionModelContract` mirrors `SpeechModelContract` — a peer primitive produced by the adapter's optional `transcribe?()` factory.
|
|
5155
|
+
`TranscriptionModelContract` mirrors `SpeechModelContract` — a peer primitive produced by the adapter's optional `transcribe?()` factory. The model id is **not validated locally** — a non-STT id (`openai.transcribe({ name: "gpt-4o" })`) constructs fine and is forwarded to the provider as given, so it fails as a typed provider error on `result.error`, never as a local throw at construction.
|
|
5154
5156
|
|
|
5155
5157
|
## The `AudioInput` shape + the two builders
|
|
5156
5158
|
|
package/package.json
CHANGED
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"@standard-schema/spec": "^1.0.0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@warlock.js/ai-openai": "4.
|
|
19
|
-
"@warlock.js/cache": "4.
|
|
20
|
-
"@warlock.js/logger": "4.
|
|
18
|
+
"@warlock.js/ai-openai": "4.14.0",
|
|
19
|
+
"@warlock.js/cache": "4.14.0",
|
|
20
|
+
"@warlock.js/logger": "4.14.0",
|
|
21
21
|
"langfuse": "*",
|
|
22
22
|
"openai": "*",
|
|
23
23
|
"pdf-parse": "*",
|
|
24
24
|
"pg": "*",
|
|
25
25
|
"redis": "*"
|
|
26
26
|
},
|
|
27
|
-
"version": "4.
|
|
27
|
+
"version": "4.14.0",
|
|
28
28
|
"main": "./cjs/index.cjs",
|
|
29
29
|
"module": "./esm/index.mjs",
|
|
30
30
|
"types": "./esm/index.d.mts",
|
|
@@ -81,7 +81,7 @@ const gpt = openai.image({ name: "gpt-image-1", pricing: { input: 5, output: 40
|
|
|
81
81
|
const dalle = openai.image({ name: "dall-e-3", pricing: { perImage: 0.04 } });
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
The model id is **not validated locally**. `openai.image({ name })` forwards the id to `client.images.generate` exactly as given, so a non-image id (`openai.image({ name: "gpt-4o" })`) constructs fine and fails at OpenAI — as a typed provider error on `result.error`, never as a local throw at construction.
|
|
85
85
|
|
|
86
86
|
## Google — Imagen (per-image)
|
|
87
87
|
|
|
@@ -96,6 +96,8 @@ const { data } = await ai.image({ model: imagen, prompt: "a watercolor lighthous
|
|
|
96
96
|
|
|
97
97
|
Imagen returns base64 bytes (no hosted URL). When every candidate is safety-filtered, `ai.image` surfaces a typed `ContentFilterError` on `result.error`.
|
|
98
98
|
|
|
99
|
+
Like every adapter, Google does **not** guard the model id: `google.image({ name })` passes the id through to `ai.models.generateImages` exactly as given, so an id Google does not serve fails as a typed provider error on `result.error` — not with a local throw at construction.
|
|
100
|
+
|
|
99
101
|
## Cost-truth — one rollup, two metering models
|
|
100
102
|
|
|
101
103
|
`ai.image` fills `usage.cost` (a `ModelPricing`-shaped USD breakdown) so image spend folds into the **same** `Usage.cost` rollup as text — no second accounting path:
|
|
@@ -26,7 +26,7 @@ if (error) {
|
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
`SpeechModelContract` mirrors `EmbedderContract` / `ImageModelContract` — a peer primitive produced by the adapter's optional `speech?()` factory. An adapter without a TTS API simply doesn't define `speech()`, so calling it is a **compile-time** error, not a silent runtime failure.
|
|
29
|
+
`SpeechModelContract` mirrors `EmbedderContract` / `ImageModelContract` — a peer primitive produced by the adapter's optional `speech?()` factory. An adapter without a TTS API simply doesn't define `speech()`, so calling it is a **compile-time** error, not a silent runtime failure. The model id itself is **not validated locally** — a non-TTS id (`openai.speech({ name: "gpt-4o" })`) constructs fine and is forwarded to the provider as given, so it fails as a typed provider error on `result.error`, never as a local throw at construction.
|
|
30
30
|
|
|
31
31
|
## The result envelope
|
|
32
32
|
|
|
@@ -33,7 +33,7 @@ if (error) console.warn(error.code); // typed AIError
|
|
|
33
33
|
else console.log(data.text); // the transcript
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
`TranscriptionModelContract` mirrors `SpeechModelContract` — a peer primitive produced by the adapter's optional `transcribe?()` factory.
|
|
36
|
+
`TranscriptionModelContract` mirrors `SpeechModelContract` — a peer primitive produced by the adapter's optional `transcribe?()` factory. The model id is **not validated locally** — a non-STT id (`openai.transcribe({ name: "gpt-4o" })`) constructs fine and is forwarded to the provider as given, so it fails as a typed provider error on `result.error`, never as a local throw at construction.
|
|
37
37
|
|
|
38
38
|
## The `AudioInput` shape + the two builders
|
|
39
39
|
|