Skip to content

Commit a679b57

Browse files
committed
typos
1 parent 3d91814 commit a679b57

File tree

10 files changed

+175
-97
lines changed

10 files changed

+175
-97
lines changed

docs/assets/invariant.css

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
:root {
1515
--primary-blue: #3d3affac;
1616
--primary-red: #ff6678;
17+
--primary-sand: #f5e9d7;
18+
--primary-teal: #00b4a2;
1719
}
1820

1921

@@ -443,14 +445,15 @@ span.parser-badge::before {
443445
position: relative;
444446
top: -3pt;
445447
margin-left: 3pt;
446-
background-color: #3A99FF;
448+
background-color: var(--primary-teal);
447449
display: inline-block;
448450
height: 18pt;
449451

450452
padding: 2pt 4pt;
451453
border-radius: 4pt;
452454
}
453455

456+
454457
.builtin-badge::before {
455458
content: "Builtin";
456459
color: #eef2ff;
@@ -492,20 +495,21 @@ span.parser-badge::before {
492495
content: 'Detectors allow you to detect the presence of certain patterns and types of data in an input.';
493496
}
494497

495-
.high-latency {
498+
499+
.parser-badge {
496500
position: relative;
497501
}
498502

499-
.high-latency:hover::after {
500-
content: 'High-Latency checks may significantly increase the time it takes to process a request. Non-blocking checks are recommended.';
503+
.parser-badge:hover::after {
504+
content: 'Parsers allow you to extract specific types of data from an input.';
501505
}
502506

503-
.parser-badge {
507+
.high-latency {
504508
position: relative;
505509
}
506510

507-
.parser-badge:hover::after {
508-
content: 'Parsers allow you to extract specific types of data from an input.';
511+
.high-latency:hover::after {
512+
content: 'High-Latency checks may significantly increase the time it takes to process a request. Non-blocking checks are recommended.';
509513
}
510514

511515
.builtin-badge {
@@ -521,7 +525,6 @@ span.parser-badge::before {
521525
padding-top: 0pt !important;
522526
}
523527

524-
eb279c8597c001a60e752
525528
.parser-badge:hover::after,
526529
.detector-badge:hover::after,
527530
.llm-badge:hover::after,

docs/guardrails/copyright.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,39 @@ It is important to ensure that content generated by agentic systems respects int
1212
!!! danger "Copyright Risks"
1313
Agents that generate code or other copyrighted material without proper authorization are at risk of violating copyright laws. This could expose your agentic system to legal liability:
1414

15-
* You agent may handle, process and reproduce copyrighted material without permission
15+
* Your agent may handle, process, and reproduce copyrighted material without permission.
1616

17-
* You may unknowingly host copyrighted material without permission
17+
* You may unknowingly host copyrighted material without permission.
1818

19-
* You may unknowingly expose copyrighted material to users
19+
* You may unknowingly expose copyrighted material to users.
2020

2121

22-
Guardrails provides the `copyright` function to detect if any licenses are present in a given piece of text, to protect against exactly this.
22+
Invariant provides the `copyright` function to detect if any licenses are present in a given piece of text, to protect against exactly this.
2323

2424
## copyright <span class="detector-badge"></span>
2525
```python
2626
def copyright(
27-
data: Union[str, List[str]],
28-
) -> List[str]
27+
data: str | list[str],
28+
) -> list[str]
2929
```
3030
Detects copyrighted text material if it is in `data` and returns the detected licenses.
3131

3232
**Parameters**
3333

3434
| Name | Type | Description |
3535
|-------------|--------|----------------------------------------|
36-
| `data` | `str | List[str]` | A single message or a list of messages. |
36+
| `data` | `str | list[str]` | A single message or a list of messages. |
3737

3838
**Returns**
3939

4040
| Type | Description |
4141
|--------|----------------------------------------|
42-
| `List[str]` | List of detected copyright types. For example, `["GNU_AGPL_V3", "MIT_LICENSE", ...]`|
42+
| `list[str]` | List of detected copyright types. For example, `["GNU_AGPL_V3", "MIT_LICENSE", ...]`|
4343

4444
### Detecting copyrighted content
4545
The simplest use-case of the `copyright` function is to apply it to all messages, as seen below.
4646

47-
**Example:** Detecting copyrighted content
47+
**Example:** Detecting copyrighted content.
4848
```guardrail
4949
from invariant.detectors import copyright
5050

docs/guardrails/explorer.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Learn how to configure and manage your guardrailing rules in Explorer.
1212

1313
[Explorer](../explorer/index.md) is Invariant's configuration and observability tool. It allows you to configure guardrails, inspect and debug your agent traces and analyze your agentic system for novel failure modes.
1414

15-
It exposes a simple configuration interface, that allows you to configure, test and deploy guardrails to your agentic system, as well as inspect guardrail failures in detail.
15+
It exposes a simple configuration interface that allows you to configure, test, and deploy guardrails to your agentic system, as well as inspect guardrail failures in detail.
1616

1717
<figure class="styled-figure">
1818
<img src="site:/guardrails/guardrails-configuration-explorer.png" alt="Explorer Landing" class="invariant-architecture" style="display: block; margin: 0 auto; width: 100%; max-width: 650pt;"/>
@@ -41,7 +41,6 @@ import os
4141
from openai import OpenAI
4242

4343
# 1. Explorer+Gateway Integration
44-
4544
client = OpenAI(
4645
default_headers={
4746
"Invariant-Authorization": "Bearer " + os.getenv("INVARIANT_API_KEY")
@@ -94,8 +93,8 @@ Here, you can configure the following parameters:
9493
| Action | Description |
9594
|---------------|----------------------------------------|
9695
| Block | Blocks the request outright, returning an HTTP error to the client. |
97-
| Log | Let's the request pass, but logs the violation in Explorer via designated Guardrail violation annotations in the resulting agent traces. This is useful to monitor your agent's violation patterns, without disrupting the agentic process. |
98-
| Paused | Pauses the enforcement of the guardrail, allowing all request to pass through without evaluating it. This is useful to temporarily disable a guardrail. |
96+
| Log | Lets the request pass, but logs the violation in Explorer via designated Guardrail violation annotations in the resulting agent traces. This is useful to monitor your agent's violation patterns, without disrupting the agentic process. |
97+
| Paused | Pauses the enforcement of the guardrail, allowing all requests to pass through without evaluating it. This is useful to temporarily disable a guardrail. |
9998

10099

101100
**Guardrailing Rule**: The guardrailing rules that need to be matched for the overall guardrail to be triggered. This is an editor of the Guardrails rule language, providing Invariant's full expressive power as described in this documentation.
@@ -105,7 +104,7 @@ Here, you can configure the following parameters:
105104

106105
To use a pre-defined guardrail, navigate to the bottom part of the Guardrails configuration page.
107106

108-
Here, you will see a list of pre-defined guardrails, along with a short description of the guardrail. These preconfigured rules, are meant to be a starting point for your guardrail configuration.
107+
Here, you will see a list of pre-defined guardrails, along with a short description of the guardrail. These preconfigured rules are meant to be a starting point for your guardrail configuration.
109108

110109
Click on the `Details` button to review and modify any preconfigured rule before deploying it to your project. Each guardrail suggestion comes with comments explaining its functionality.
111110

@@ -115,9 +114,9 @@ Click on the `Details` button to review and modify any preconfigured rule before
115114

116115
All changes made in Explorer are automatically deployed to your Gateway instance, enabling you to deploy new guardrails and security policies within seconds.
117116

118-
This means, even though your agentic system may be running in a slow-to-update production environment, you can quickly respond to new security threats and update your guardrails to your liking, without having to manually update your agent system or re-deploy.
117+
This means, that even though your agentic system may be running in a slow-to-update production environment, you can quickly respond to new security threats and update your guardrails to your liking, without having to manually update your agent system or re-deploy.
119118

120-
It also enables quick experimentation with new guardrails, without having to worry about the underlying infrastructure. Gateway will automatically pull the latest guardrail configuration from Explorer once a new version is deployed, updating your agent's behavior in real-time.
119+
It also enables quick experimentation with new guardrails, without having to worry about the underlying infrastructure. Gateway will automatically pull the latest guardrail configuration from Explorer once a new version is deployed, updating your agent's behavior in real time.
121120

122121
## Inspecting Guardrail Failures
123122

docs/guardrails/gateway.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ icon: bootstrap/hdd-network
1010
Learn how Invariant guardrailing rules are enforced and deployed.
1111
</div>
1212

13-
Invariant is a guardrailing layer, located between you and your LLM and MCP servers. This means, it intercepts, analyzes and secures every LLM and tool interaction of your agentic system, without you having to change your code.
13+
Invariant is a guardrailing layer, located between you and your LLM and MCP servers. This means it intercepts, analyzes, and, secures every LLM and tool interaction of your agentic system, without you having to change your code.
1414

1515
<br/><br/>
1616
<img src="site:/guardrails/gateway-integration.svg" alt="Invariant Architecture" class="invariant-architecture" style="display: block; margin: 0 auto; width: 100%; max-width: 300pt;"/>
@@ -20,13 +20,13 @@ To use Invariant, you need to integrate [Invariant Gateway](../gateway/index.md)
2020

2121
## LLM Proxying and Guardrails
2222

23-
In the case of LLM proxying, gateway will intercept every LLM call of you agent system (including the current agent context), apply the configured guardrailing rules to the input, and then invoke the actual LLM provider.
23+
In the case of LLM proxying, gateway will intercept every LLM call of your agent system (including the current agent context), apply the configured guardrailing rules to the input, and then invoke the actual LLM provider.
2424

2525
Once the LLM provider returns the response, the gateway will again apply your guardrailing rules to the LLM response, and ensure that the response and its consequence (e.g. tool calls) are safe to execute, according to your guardrails.
2626

2727
**Handling Failure:** In case any of the checks fail, Gateway will return an HTTP error response instead of the LLM response, allowing your agent system to handle the guardrail violation gracefully.
2828

29-
To help with that, the error response will include information on the violated guardrail, including the specified error message, the violated rule, and the address of the violating components in your agent's context (e.g. messages indices, contents and sub-ranges).
29+
To help with that, the error response will include information on the violated guardrail, including the specified error message, the violated rule, and the address of the violating components in your agent's context (e.g. messages indices, contents, and sub-ranges).
3030

3131
<br/><br/>
3232
<img src="site:/guardrails/gateway-llm.svg" alt="LLM Proxying and Guardrails" class="llm-proxying-guardrails" style="display: block; margin: 0 auto; width: 100%; max-width: 400pt;"/>
@@ -39,15 +39,15 @@ In contrast to traditional guardrailing system, Guardrails follows a pipelined a
3939
<img src="site:/guardrails/pipelined.svg" alt="Pipelining and Incremental Guardrailing" class="pipelining-incremental-guardrails" style="display: block; margin: 0 auto; width: 100%;"/>
4040
<br/><br/>
4141

42-
As illustrated above, input latency can oftentimes be entirely eliminated by our pipelined execution approach, whereas output latency is greatly reduced, because of Invariant's stateful, cached and pre-computed rule evaluation. Guardrails' rule engine will eagerly pre-compute all matching parts of a rule, such that once the LLM response arrives, only very little checking remains. To achieve this, Guardrails automatically orchestrates rule evaluation, including ML model inference, using an optimized execution graph.
42+
As illustrated above, input latency can oftentimes be entirely eliminated by our pipelined execution approach, whereas output latency is greatly reduced, because of Invariant's stateful, cached, and pre-computed rule evaluation. Guardrails' rule engine will eagerly pre-compute all matching parts of a rule, such that once the LLM response arrives, only very little checking remains. To achieve this, Guardrails automatically orchestrates rule evaluation, including ML model inference, using an optimized execution graph.
4343

4444
## Deploying your Guardrails
4545

4646
To deploy your guardrailing rules, you have two options:
4747

48-
<!-- 1. **Stateless via Header**: You can send your guardrailing rules with every LLM call in a desiganted `Invariant-Guardrails` header field.
48+
<!-- 1. **Stateless via Header**: You can send your guardrailing rules with every LLM call in a designated `Invariant-Guardrails` header field.
4949
50-
2. **Managed Via Exlorer**: You can manage your guardrailing rules via Invariant Explorer. This decouples guardrail management from your agent code, but allows for centralized management of guardrails. -->
50+
2. **Managed Via Exlorer**: You can manage your guardrailing rules via Invariant Explorer. This decouples guardrail management from your agent code but allows for centralized management of guardrails. -->
5151

5252
<div class='tiles'>
5353
<a href="#via-header" class='tile primary'>
@@ -105,11 +105,11 @@ This snippet demonstrates how to use the managed instance of Gateway, accessible
105105

106106
Apart from this, you can also use a local instance of Gateway, by setting the `base_url` to your local instance. See the [Gateway documentation](../gateway/self-hosted.md) for more details on local deployment.
107107

108-
Passing via header is a stateless approach, meaning that every request will need to include the guardrailing rules. This is useful for quick testing and prototyping, but means that your agentic system must define and send its own guardrailing rules with every request.
108+
Passing via header is a stateless approach, meaning that every request will need to include the guardrailing rules. This is useful for quick testing and prototyping but means that your agentic system must define and send its own guardrailing rules with every request.
109109

110110
<h3 id="via-explorer">Configuring Guardrails via Explorer</h3>
111111

112-
To configure guardrailing rules outside of the actual agentic system, you can use [Invariant Explorer](https://explorer.invariantlabs.ai). This allows you to manage your guardrailing rules in a centralized way, and decouples guardrail management from your agent code. It is also useful, if you do not control the code of the agentic system itself, but want to constrain its behavior.
112+
To configure guardrailing rules outside of the actual agentic system, you can use [Invariant Explorer](https://explorer.invariantlabs.ai). This allows you to manage your guardrailing rules in a centralized way and decouples guardrail management from your agent code. It is also useful, if you do not control the code of the agentic system itself, but want to constrain its behavior.
113113

114114
Explorer provides a comprehensive user interface to manage and configure your guardrailing rules, including a list of suggested rules, a rule editor, and a rule testing interface.
115115

docs/guardrails/images.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: Images
3-
description: Secure images given to, or produced by, your agentic system.
3+
description: Secure images given to, or produced by your agentic system.
44
---
55

66
# Images
77

88
<div class='subtitle'>
9-
Secure images given to, or produced by your agentic system.
9+
Secure images given to or produced by your agentic system.
1010
</div>
1111

1212
At the core of computer vision agents is the ability to perceive their environment through images, typically by taking screenshots to assess the current state. This visual perception allows agents to understand interfaces, identify interactive elements, and make decisions based on what they "see."
@@ -19,41 +19,41 @@ Additionally, some systems may allow users to submit images, posing additional r
1919
2020
> * Capture **personally identifiable information (PII)** like names or addresses.
2121
>
22-
> * View credentials such as **passwords, API keys, or access tokens** like present in passport images or other documents.
22+
> * View credentials such as **passwords, API keys, or access tokens** present in passport images or other documents.
2323
>
2424
> * Get **prompt injected or jailbroken** from text in an image.
2525
>
2626
> * Generate images with **explicit or harmful content**.
2727
2828

29-
Guardrails provide you a powerful way to enforce visual security policies, and to limit the agent's perception to only the visual information that is necessary and appropriate for the task at hand.
29+
Guardrails provide a powerful way to enforce visual security policies, and to limit the agent's perception to only the visual information that is necessary and appropriate for the task at hand.
3030

3131

3232
## ocr <span class="parser-badge"/>
3333
```python
3434
def ocr(
35-
data: str, List[str],
36-
config: Optional[dict]
37-
) -> List[str]
35+
data: str | list[str],
36+
config: dict | None = None
37+
) -> list[str]
3838
```
3939
Given an image as input, this parser extracts and returns the text in the image using [Tesseract](https://github.com/tesseract-ocr/tesseract).
4040

4141
**Parameters**
4242

4343
| Name | Type | Description |
4444
|-------------|--------|----------------------------------------|
45-
| `data` | `str, List[str]` | A single base64 encoded image or a list of base64 encoded images. |
45+
| `data` | `str | list[str]` | A single base64 encoded image or a list of base64 encoded images. |
4646

4747
**Returns**
4848

4949
| Type | Description |
5050
|--------|----------------------------------------|
51-
| `List[str]` | A list of extracted pieces of text from `data`. |
51+
| `list[str]` | A list of extracted pieces of text from `data`. |
5252

5353
### Analyzing Text in Images
5454
The `ocr` function is a <span class="parser-badge" size-mod="small"></span> so it returns the data found from parsing its content; in this case, any text present in an image will be extracted. The extracted text can then be used for further detection, for example detecting a prompt injection in an image, like the example below.
5555

56-
**Example:** Image Prompt Injection Detection.
56+
**Example:** Image prompt injection detection.
5757
```python
5858
from invariant.detectors import prompt_injection
5959
from invariant.parsers import ocr
@@ -70,10 +70,10 @@ raise "Found Prompt Injection in Image" if:
7070

7171
```python
7272
def image(
73-
content: Content | List[Content]
74-
) -> List[Image]
73+
content: Content | list[Content]
74+
) -> list[ImageContent]
7575
```
76-
Given some `Content`, this <span class="builtin-badge" size-mod="small"></span> extracts all images. This is useful when messages may contain mixed content.
76+
Given some [`Content`](/docs-guardrails/guardrails/basics/#message), this <span class="builtin-badge" size-mod="small"></span> extracts all [`ImageContent`](/docs-guardrails/guardrails/basics/#message). This is useful when messages may contain mixed content.
7777

7878
**Parameters**
7979

0 commit comments

Comments
 (0)