You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-114Lines changed: 5 additions & 114 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,17 @@
1
1
# OpenAI Guardrails
2
2
3
-
> **Choose your language:**
4
-
> -[Python](#python)
5
-
> -[TypeScript](#typescript)
6
-
7
-
---
8
-
9
-
# Python
10
-
11
3
## Overview
12
4
13
5
OpenAI Guardrails is a Python package for adding robust, configurable safety and compliance guardrails to LLM applications. It provides a drop-in wrapper for OpenAI's Python client, enabling automatic input/output validation and moderation using a wide range of guardrails.
14
6
15
7
## Documentation
16
8
17
-
For full details, advanced usage, and API reference, see here: [OpenAI Guardrails Alpha Documentation](https://oaig-whisper-yonder-xnjpy2.vercel.app/docs/).
9
+
For full details, advanced usage, and API reference, see here: [OpenAI Guardrails Documentation](https://openai.github.io/openai-guardrails-python/).
18
10
19
11
## Quick Start: Using OpenAI Guardrails (Python)
20
12
21
13
1.**Generate your guardrail spec JSON**
22
-
- Use the [Guardrails web UI](https://oaig-whisper-yonder-xnjpy2.vercel.app/) (pw: guardrails) to create a JSON configuration file describing which guardrails to apply and how to configure them.
14
+
- Use the [Guardrails web UI](https://platform.openai.com/guardrails) to create a JSON configuration file describing which guardrails to apply and how to configure them.
23
15
- The wizard outputs a file like `guardrail_specs.json`.
24
16
25
17
2.**Install dependencies**
@@ -65,7 +57,7 @@ For full details, advanced usage, and API reference, see here: [OpenAI Guardrail
65
57
- The client will automatically apply all configured guardrails to inputs and outputs.
66
58
- If a guardrail is triggered, a `GuardrailTripwireTriggered` exception will be raised. You should handle this exception to gracefully manage blocked or flagged content.
67
59
68
-
>**Note:** The Guardrails web UI (in `frontend/`) is hosted [here](https://oaig-whisper-yonder-xnjpy2.vercel.app/). You do not need to run the web UI yourself to use the Python package.
60
+
>**Note:** The Guardrails web UI is hosted [here](https://platform.openai.com/guardrails). You do not need to run the web UI yourself to use the Python package.
69
61
70
62
---
71
63
@@ -79,107 +71,6 @@ For full details, advanced usage, and API reference, see here: [OpenAI Guardrail
79
71
80
72
---
81
73
82
-
# TypeScript
83
-
84
-
## Overview
85
-
86
-
Guardrails TypeScript is a Node.js/TypeScript framework for secure AI calls with OpenAI Guardrails. It provides a port of the Python Guardrails framework with enhanced type safety, Node.js integration, and a high-level client API mirroring the Python version.
87
-
88
-
> **Note:** The TypeScript package is currently in development and not yet published to npm. Use the local installation methods below.
89
-
90
-
## Quick Start: Using OpenAI Guardrails (TypeScript)
91
-
92
-
### 1. Install Locally
93
-
94
-
Clone the repository and install dependencies:
95
-
```bash
96
-
# From the root of the repo
97
-
cd guardrails-ts
98
-
npm install
99
-
npm run build
100
-
```
101
-
102
-
You can also install it into your own project from the local path:
# Run example scripts (from guardrails-ts/examples)
165
-
cd examples
166
-
npx tsx simple-runtime-usage.ts
167
-
npx tsx guardrails-demo.ts
168
-
```
169
-
170
-
---
171
-
172
-
## What Does the TypeScript Package Provide?
173
-
174
-
- **GuardrailsOpenAI** and **GuardrailsAzureOpenAI**: Drop-in replacements for OpenAI's `OpenAI` and `AzureOpenAI` clients, with automatic guardrail enforcement (mirrors Python API).
175
-
- **Automatic input/output validation**: Guardrails are applied to all relevant API calls (e.g., `chat.completions.create`, `responses.create`, etc.).
176
-
- **Configurable guardrails**: Choose which checks to enable, and customize their parameters via the JSON spec.
177
-
- **Tripwire support**: Optionally block or mask unsafe content, or just log/flag it for review.
178
-
- **CLI tool**: Validate configs, run evaluations, and more from the command line.
179
-
- **Evaluation framework**: Test guardrail performance on datasets and measure metrics like precision, recall, and F1 scores.
180
-
181
-
---
182
-
183
74
## Available Guardrails
184
75
185
76
Below is a list of all built-in guardrails you can configure. Each can be enabled/disabled and customized in your JSON spec.
@@ -202,9 +93,9 @@ Below is a list of all built-in guardrails you can configure. Each can be enable
202
93
203
94
## License
204
95
205
-
For the duration of this early access alpha, `guardrails` (including both the Python and TypeScript packages) is distributed under the Alpha Evaluation Agreement that your organization signed with OpenAI.
96
+
For the duration of this early access alpha, `guardrails` is distributed under the Alpha Evaluation Agreement that your organization signed with OpenAI.
206
97
207
-
Both the Python and TypeScript packages are intended to be MIT-licensed in the future, subject to change.
98
+
The Python package is intended to be MIT-licensed in the future, subject to change.
Copy file name to clipboardExpand all lines: docs/evals.md
+14-6Lines changed: 14 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,17 +20,25 @@ python guardrail_evals.py \
20
20
--models gpt-5 gpt-5-mini gpt-5-nano
21
21
```
22
22
23
-
Test with included demo files in our [github repository](https://github.com/OpenAI-Early-Access/guardrails/tree/main/src/guardrails/evals/eval_demo)
23
+
Test with included demo files in our [github repository](https://github.com/openai/openai-guardrails-python/tree/main/src/guardrails/evals/eval_demo)
24
24
25
25
## Dependencies
26
26
27
-
The evals tool requires a few extra packages that are not installed with the core `guardrails` package. Please install the following before running evaluations or benchmarks:
27
+
### Benchmark Mode
28
+
When running benchmark mode (ROC curves, precision at recall thresholds, visualizations), you need additional packages:
Ready-to-run examples demonstrating Guardrails in various scenarios. See the [`guardrails/examples/`](https://github.com/OpenAI-Early-Access/guardrails/tree/main/guardrails/examples/) folder for complete implementations.
3
+
Ready-to-run examples demonstrating Guardrails in various scenarios. See the [`guardrails/examples/`](https://github.com/openai/openai-guardrails-python/tree/main/examples/) folder for complete implementations.
4
4
5
5
## Example Implementations
6
6
7
-
-[hello_world.py](https://github.com/OpenAI-Early-Access/guardrails/tree/main/guardrails/examples/basic/hello_world.py) — Basic pipeline configuration with input/output guardrails
8
-
-[agents_sdk.py](https://github.com/OpenAI-Early-Access/guardrails/tree/main/guardrails/examples/basic/agents_sdk.py) — Integration with OpenAI Agents SDK
9
-
-[pii_mask_example.py](https://github.com/OpenAI-Early-Access/guardrails/tree/main/guardrails/examples/basic/pii_mask_example.py) — PII detection and scrubbing
10
-
-[structured_outputs_example.py](https://github.com/OpenAI-Early-Access/guardrails/tree/main/guardrails/examples/basic/structured_outputs_example.py) — Using responses.parse with guardrails
11
-
-[Streaming (fast)](https://github.com/OpenAI-Early-Access/guardrails/tree/main/guardrails/examples/implementation_code/fast) — Stream output while guardrails run
12
-
-[Blocking (slow)](https://github.com/OpenAI-Early-Access/guardrails/tree/main/guardrails/examples/implementation_code/slow) — Validate fully before showing output
7
+
-[hello_world.py](https://github.com/openai/openai-guardrails-python/tree/main/examples/basic/hello_world.py) — Basic pipeline configuration with input/output guardrails
8
+
-[agents_sdk.py](https://github.com/openai/openai-guardrails-python/tree/main/examples/basic/agents_sdk.py) — Integration with OpenAI Agents SDK
9
+
-[pii_mask_example.py](https://github.com/openai/openai-guardrails-python/tree/main/examples/basic/pii_mask_example.py) — PII detection and scrubbing
10
+
-[structured_outputs_example.py](https://github.com/openai/openai-guardrails-python/tree/main/examples/basic/structured_outputs_example.py) — Using responses.parse with guardrails
11
+
-[Streaming](https://github.com/openai/openai-guardrails-python/tree/main/examples/implementation_code/streaming) — Stream output while guardrails run
12
+
-[Blocking](https://github.com/openai/openai-guardrails-python/tree/main/examples/implementation_code/blocking) — Validate fully before showing output
13
13
14
14
## Hallucination Detection Example
15
15
16
16
Complete implementation using real documents as knowledge sources:
Copy file name to clipboardExpand all lines: docs/index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Guardrails
2
2
3
-
**Guardrails** is a safety framework for LLM applications that automatically validates inputs and outputs using configurable checks. Use the [Guardrails Wizard](https://guardrails-vercel-git-main-openai.vercel.app/guardrails) to create configurations, then drop in our client classes for automatic validation.
3
+
**Guardrails** is a safety framework for LLM applications that automatically validates inputs and outputs using configurable checks. Use the [Guardrails Wizard](https://platform.openai.com/guardrails) to create configurations, then drop in our client classes for automatic validation.
Copy file name to clipboardExpand all lines: docs/quickstart.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ export OPENAI_API_KEY=sk-...
21
21
22
22
## Create Pipeline Configuration
23
23
24
-
The fastest way is using the [Guardrails Wizard](https://guardrails-vercel-git-main-openai.vercel.app/guardrails) - a no-code tool for creating configurations.
24
+
The fastest way is using the [Guardrails Wizard](https://platform.openai.com/guardrails) - a no-code tool for creating configurations.
See [`examples/hallucination_detection/`](https://github.com/OpenAI-Early-Access/guardrails/tree/main/guardrails/examples/hallucination_detection) for the full implementation.
82
+
See [`examples/hallucination_detection/`](https://github.com/openai/openai-guardrails-python/tree/main/examples/hallucination_detection) for the full implementation.
0 commit comments