llm-output-guard 1.11.2 → 1.11.3
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 +10 -2
- package/dist/ai-sdk.cjs.map +1 -1
- package/dist/ai-sdk.d.cts +1 -1
- package/dist/ai-sdk.d.ts +1 -1
- package/dist/ai-sdk.js.map +1 -1
- package/dist/anthropic.cjs.map +1 -1
- package/dist/anthropic.d.cts +1 -1
- package/dist/anthropic.d.ts +1 -1
- package/dist/anthropic.js.map +1 -1
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/google.cjs.map +1 -1
- package/dist/google.d.cts +1 -1
- package/dist/google.d.ts +1 -1
- package/dist/google.js.map +1 -1
- package/dist/openai.cjs.map +1 -1
- package/dist/openai.d.cts +1 -1
- package/dist/openai.d.ts +1 -1
- package/dist/openai.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -90,9 +90,15 @@ a boolean** — you pick the line.
|
|
|
90
90
|
import OpenAI from 'openai';
|
|
91
91
|
import { withOutputGuard } from 'llm-output-guard/openai';
|
|
92
92
|
|
|
93
|
-
const client = withOutputGuard(new OpenAI(), { ...presets.chat, onDegenerate: '
|
|
93
|
+
const client = withOutputGuard(new OpenAI(), { ...presets.chat, onDegenerate: 'throw' });
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
+
`onDegenerate` decides what a failed check does: **`'throw'`** (the default)
|
|
97
|
+
fails the call, and on a stream also cancels the request. `'abort'` is the
|
|
98
|
+
streaming-only alternative — it ends the stream and keeps what arrived, and on a
|
|
99
|
+
non-streaming call it stops nothing. `'ignore'` reports and changes nothing,
|
|
100
|
+
which is how to roll out.
|
|
101
|
+
|
|
96
102
|
Adapters for the **OpenAI SDK** (both `chat.completions` and `responses`),
|
|
97
103
|
**Anthropic**, **Google Gemini** and the **Vercel AI SDK** — plus anything
|
|
98
104
|
speaking OpenAI's protocol: Groq, Together, OpenRouter, Fireworks, vLLM,
|
|
@@ -207,7 +213,9 @@ withOutputGuard(new OpenAI(), { ...presets.chat, checkPromptEcho: true });
|
|
|
207
213
|
```
|
|
208
214
|
|
|
209
215
|
Not for rewrite, translate or summarise endpoints, where copying the input is
|
|
210
|
-
the job.
|
|
216
|
+
the job. Abstains under 40 words, so a one-line prompt echoed perfectly still
|
|
217
|
+
scores 0.000.
|
|
218
|
+
[More →](docs/detectors.md#returning-the-prompt-instead-of-an-answer)
|
|
211
219
|
|
|
212
220
|
## The verdict
|
|
213
221
|
|