Documentation Index
Fetch the complete documentation index at: https://snowglobe.so/docs/llms.txt
Use this file to discover all available pages before exploring further.
Guardrails CRUD API. The server hosts the documenation on this page in an interactive swagger UI. Typically these are available at localhost:8000/docs if you are running the server locally with default configurations.
Authentication
- HTTP Authentication, scheme: bearer
- API Key (ApiKeyAuth)
- Parameter Name: authorization, in: header.
Service Health
get__health-check
GET /health-check
Example responses
200 Response
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Returns the status of the server | HealthCheck |
| default | Default | Unexpected error | HttpError |
guard
getGuards
GET /guards
Fetches the configuration for all Guards the user has access to.
Example responses
200 Response
Responses
Response Schema
Status Code 200| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [guard] | false | none | none |
| » Guard | guard | false | none | none |
| »» id | string(kebab-case) | true | none | The unique identifier for the Guard. |
| »» name | string | true | none | The name for the Guard. |
| »» description | string | false | none | A description that concisely states the expected behaviour or purpose of the Guard. |
| »» validators | [allOf] | false | none | none |
| »»» ValidatorReference | ValidatorReference | false | none | none |
| »»»» id | string | true | none | The unique identifier for this Validator. Often the hub id; e.g. guardrails/regex_match |
| »»»» on | any | false | none | A reference to the property this validator should be applied against. Can be a valid JSON path or a meta-property such as “messages” or “output” |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» anonymous | string | false | none | meta-property |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» anonymous | string | false | none | JSON path to property; e.g. $.foo.bar |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»» onFail | string | false | none | none |
| »» output_schema | schema | false | none | none |
| »»» definitions | object | false | none | none |
| »»»» additionalProperties | any | false | none | none |
| »»» dependencies | object | false | none | none |
| »»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» anonymous | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» anonymous | [string] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | core | false | none | none |
| »»»» $anchor | string | false | none | none |
| »»»» $ref | string(uri-reference) | false | none | none |
| »»»» $dynamicRef | string(uri-reference) | false | none | none |
| »»»» $dynamicAnchor | string | false | none | none |
| »»»» $vocabulary | object | false | none | none |
| »»»»» additionalProperties | boolean | false | none | none |
| »»»» $comment | string | false | none | none |
| »»»» $defs | object | false | none | none |
| »»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | applicator | false | none | none |
| »»»» prefixItems | [any] | false | none | none |
| »»»» items | any | false | none | none |
| »»»» contains | any | false | none | none |
| »»»» additionalProperties | any | false | none | none |
| »»»» properties | object | false | none | none |
| »»»»» additionalProperties | any | false | none | none |
| »»»» patternProperties | object | false | none | none |
| »»»»» additionalProperties | any | false | none | none |
| »»»» dependentSchemas | object | false | none | none |
| »»»»» additionalProperties | any | false | none | none |
| »»»» propertyNames | any | false | none | none |
| »»»» if | any | false | none | none |
| »»»» then | any | false | none | none |
| »»»» else | any | false | none | none |
| »»»» allOf | [any] | false | none | none |
| »»»» anyOf | [any] | false | none | none |
| »»»» oneOf | [any] | false | none | none |
| »»»» not | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | unevaluated | false | none | none |
| »»»» unevaluatedItems | any | false | none | none |
| »»»» unevaluatedProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | validation | false | none | none |
| »»»» multipleOf | number | false | none | none |
| »»»» maximum | number | false | none | none |
| »»»» exclusiveMaximum | number | false | none | none |
| »»»» minimum | number | false | none | none |
| »»»» exclusiveMinimum | number | false | none | none |
| »»»» maxLength | nonNegativeInteger | false | none | none |
| »»»» minLength | nonNegativeInteger | false | none | none |
| »»»» pattern | string(regex) | false | none | none |
| »»»» maxItems | nonNegativeInteger | false | none | none |
| »»»» minItems | nonNegativeInteger | false | none | none |
| »»»» uniqueItems | boolean | false | none | none |
| »»»» maxContains | nonNegativeInteger | false | none | none |
| »»»» minContains | nonNegativeInteger | false | none | none |
| »»»» maxProperties | nonNegativeInteger | false | none | none |
| »»»» minProperties | nonNegativeInteger | false | none | none |
| »»»» required | [string] | false | none | none |
| »»»» dependentRequired | object | false | none | none |
| »»»»» additionalProperties | [string] | false | none | none |
| »»»» const | any | false | none | none |
| »»»» enum | [any] | false | none | none |
| »»»» type | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» anonymous | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» anonymous | [simpleTypes] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | meta-data | false | none | none |
| »»»» title | string | false | none | none |
| »»»» description | string | false | none | none |
| »»»» default | any | false | none | none |
| »»»» deprecated | boolean | false | none | none |
| »»»» readOnly | boolean | false | none | none |
| »»»» writeOnly | boolean | false | none | none |
| »»»» examples | [any] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | format-annotation | false | none | none |
| »»»» format | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | content | false | none | none |
| »»»» contentMediaType | string | false | none | none |
| »»»» contentEncoding | string | false | none | none |
| »»»» contentSchema | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »» history | [call] | false | read-only | none |
| »»» Call | call | false | none | none |
| »»»» id | string | true | none | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| »»»» iterations | [iteration] | false | none | none |
| »»»»» Iteration | iteration | false | none | none |
| »»»»»» id | string | true | none | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| »»»»»» index | integer | true | none | The zero-based index of this iteration within the current Call. |
| »»»»»» callId | string | true | none | The unique identifier for the Call that this iteration is a part of. |
| »»»»»» inputs | inputs | false | none | none |
| »»»»»»» llmApi | string | false | none | The LLM resource targeted by the user. e.g. openai.chat.completions.create |
| »»»»»»» llmOutput | string | false | none | The string output from an external LLM call provided by the user via Guard.parse. |
| »»»»»»» messages | [object] | false | none | The message history for chat models. |
| »»»»»»»» additionalProperties | any | false | none | none |
| »»»»»»» promptParams | object | false | none | Parameters to be formatted into the prompt. |
| »»»»»»»» additionalProperties | any | false | none | none |
| »»»»»»» numReasks | integer | false | none | The total number of times the LLM can be called to correct output excluding the initial call. |
| »»»»»»» metadata | object | false | none | Additional data to be used by Validators during execution time. |
| »»»»»»»» additionalProperties | any | false | none | none |
| »»»»»»» fullSchemaReask | boolean | false | none | Whether to perform reasks for the entire schema rather than for individual fields. |
| »»»»»»» stream | boolean | false | none | Whether to use streaming. |
| »»»»»» outputs | outputs | false | none | none |
| »»»»»»» llmResponseInfo | LLMResponse | false | none | Information from the LLM response. |
| »»»»»»»» promptTokenCount | integer | false | none | none |
| »»»»»»»» responseTokenCount | integer | false | none | none |
| »»»»»»»» output | string | true | none | none |
| »»»»»»»» streamOutput | [string] | false | none | none |
| »»»»»»»» asyncStreamOutput | [string] | false | none | none |
| »»»»»»» rawOutput | string | false | none | The string content from the LLM response. |
| »»»»»»» parsedOutput | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | object | false | none | none |
| »»»»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | [anyOf] | false | none | none |
| »»»»»»»»» AnyType | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»» anonymous | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»»» anonymous | boolean | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»»» anonymous | integer | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»»» anonymous | null | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»»» anonymous | number | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»» anonymous | objects | false | none | none |
| »»»»»»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»» anonymous | [anyOf] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»»» anonymous | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»»» anonymous | objects | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»» validationResponse | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | reask | false | none | none |
| »»»»»»»»» additionalProperties | any | false | none | none |
| »»»»»»»»» incorrectValue | any | false | none | none |
| »»»»»»»»» failResults | [allOf] | false | none | none |
| »»»»»»»»»» FailResult | fail-result | false | none | The output from a single Validator. |
| »»»»»»»»»»» outcome | any | true | none | none |
| »»»»»»»»»»» errorMessage | string | true | none | none |
| »»»»»»»»»»» fixValue | any | false | none | none |
| »»»»»»»»»»» errorSpans | [error-span] | false | none | none |
| »»»»»»»»»»»» ErrorSpan | error-span | false | none | none |
| »»»»»»»»»»»»» start | integer | true | none | none |
| »»»»»»»»»»»»» end | integer | true | none | none |
| »»»»»»»»»»»»» reason | string | true | none | The reason validation failed, specific to this chunk. |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | object | false | none | none |
| »»»»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | [anyOf] | false | none | none |
| »»»»»»»»» AnyType | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»» guardedOutput | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | object | false | none | none |
| »»»»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | [anyOf] | false | none | none |
| »»»»»»»»» AnyType | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»» reasks | [reask] | false | none | none |
| »»»»»»»» ReAsk | reask | false | none | none |
| »»»»»»» validatorLogs | [validator-log] | false | none | none |
| »»»»»»»» ValidatorLog | validator-log | false | none | none |
| »»»»»»»»» validatorName | string(PascalCase) | true | none | The class name of the validator. |
| »»»»»»»»» registeredName | string(kebab-case) | true | none | The registry id of the validator. |
| »»»»»»»»» instanceId | any | false | none | A unique identifier for the validator that produced this log within the session. |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»» anonymous | integer | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» propertyPath | string | true | none | The JSON path to the property which was validated that produced this log. |
| »»»»»»»»» valueBeforeValidation | any | true | none | none |
| »»»»»»»»» valueAfterValidation | any | false | none | none |
| »»»»»»»»» validationResult | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»» anonymous | pass-result | false | none | The output from a single Validator. |
| »»»»»»»»»»» outcome | any | true | none | none |
| »»»»»»»»»»» valueOverride | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»»» anonymous | fail-result | false | none | The output from a single Validator. |
| »»»»»»»»»»» outcome | any | true | none | none |
| »»»»»»»»»»» errorMessage | string | true | none | none |
| »»»»»»»»»»» fixValue | any | false | none | none |
| »»»»»»»»»»» errorSpans | [error-span] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» startTime | string(date-time) | false | none | none |
| »»»»»»»»» endTime | string(date-time) | false | none | none |
| »»»»»»» error | string | false | none | The error message from any exception which interrupted the Guard execution process. |
| »»»» inputs | CallInputs | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» anonymous | inputs | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» anonymous | args-and-kwargs | false | none | none |
| »»»»»» args | [anyOf] | false | none | none |
| »»»»»»» AnyType | any | false | none | none |
| »»»»»» kwargs | object | false | none | none |
| »»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»» exception | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| anonymous | messages |
| anonymous | output |
| onFail | exception |
| onFail | filter |
| onFail | fix |
| onFail | fix_reask |
| onFail | noop |
| onFail | reask |
| onFail | refrain |
| onFail | custom |
| anonymous | array |
| anonymous | boolean |
| anonymous | integer |
| anonymous | null |
| anonymous | number |
| anonymous | object |
| anonymous | string |
createGuard
POST /guards
Creates a Guard
Body parameter
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | guard | true | none |
| » id | body | string(kebab-case) | true | The unique identifier for the Guard. |
| » name | body | string | true | The name for the Guard. |
| » description | body | string | false | A description that concisely states the expected behaviour or purpose of the Guard. |
| » validators | body | [allOf] | false | none |
| »» ValidatorReference | body | ValidatorReference | false | none |
| »»» id | body | string | true | The unique identifier for this Validator. Often the hub id; e.g. guardrails/regex_match |
| »»» on | body | any | false | A reference to the property this validator should be applied against. Can be a valid JSON path or a meta-property such as “prompt” or “output” |
| »»»» anonymous | body | string | false | meta-property |
| »»»» anonymous | body | string | false | JSON path to property; e.g. $.foo.bar |
| »»» onFail | body | string | false | none |
| » output_schema | body | schema | false | none |
| »» definitions | body | object | false | none |
| »»» additionalProperties | body | any | false | none |
| »» dependencies | body | object | false | none |
| »»» additionalProperties | body | any | false | none |
| »»»» anonymous | body | any | false | none |
| »»»» anonymous | body | [string] | false | none |
| »» anonymous | body | core | false | none |
| »»» $anchor | body | string | false | none |
| »»» $ref | body | string(uri-reference) | false | none |
| »»» $dynamicRef | body | string(uri-reference) | false | none |
| »»» $dynamicAnchor | body | string | false | none |
| »»» $vocabulary | body | object | false | none |
| »»»» additionalProperties | body | boolean | false | none |
| »»» $comment | body | string | false | none |
| »»» $defs | body | object | false | none |
| »»»» additionalProperties | body | any | false | none |
| »» anonymous | body | applicator | false | none |
| »»» prefixItems | body | [any] | false | none |
| »»» items | body | any | false | none |
| »»» contains | body | any | false | none |
| »»» additionalProperties | body | any | false | none |
| »»» properties | body | object | false | none |
| »»»» additionalProperties | body | any | false | none |
| »»» patternProperties | body | object | false | none |
| »»»» additionalProperties | body | any | false | none |
| »»» dependentSchemas | body | object | false | none |
| »»»» additionalProperties | body | any | false | none |
| »»» propertyNames | body | any | false | none |
| »»» if | body | any | false | none |
| »»» then | body | any | false | none |
| »»» else | body | any | false | none |
| »»» allOf | body | [any] | false | none |
| »»» anyOf | body | [any] | false | none |
| »»» oneOf | body | [any] | false | none |
| »»» not | body | any | false | none |
| »» anonymous | body | unevaluated | false | none |
| »»» unevaluatedItems | body | any | false | none |
| »»» unevaluatedProperties | body | any | false | none |
| »» anonymous | body | validation | false | none |
| »»» multipleOf | body | number | false | none |
| »»» maximum | body | number | false | none |
| »»» exclusiveMaximum | body | number | false | none |
| »»» minimum | body | number | false | none |
| »»» exclusiveMinimum | body | number | false | none |
| »»» maxLength | body | nonNegativeInteger | false | none |
| »»» minLength | body | nonNegativeInteger | false | none |
| »»» pattern | body | string(regex) | false | none |
| »»» maxItems | body | nonNegativeInteger | false | none |
| »»» minItems | body | nonNegativeInteger | false | none |
| »»» uniqueItems | body | boolean | false | none |
| »»» maxContains | body | nonNegativeInteger | false | none |
| »»» minContains | body | nonNegativeInteger | false | none |
| »»» maxProperties | body | nonNegativeInteger | false | none |
| »»» minProperties | body | nonNegativeInteger | false | none |
| »»» required | body | [string] | false | none |
| »»» dependentRequired | body | object | false | none |
| »»»» additionalProperties | body | [string] | false | none |
| »»» const | body | any | false | none |
| »»» enum | body | [any] | false | none |
| »»» type | body | any | false | none |
| »»»» anonymous | body | any | false | none |
| »»»» anonymous | body | [simpleTypes] | false | none |
| »» anonymous | body | meta-data | false | none |
| »»» title | body | string | false | none |
| »»» description | body | string | false | none |
| »»» default | body | any | false | none |
| »»» deprecated | body | boolean | false | none |
| »»» readOnly | body | boolean | false | none |
| »»» writeOnly | body | boolean | false | none |
| »»» examples | body | [any] | false | none |
| »» anonymous | body | format-annotation | false | none |
| »»» format | body | string | false | none |
| »» anonymous | body | content | false | none |
| »»» contentMediaType | body | string | false | none |
| »»» contentEncoding | body | string | false | none |
| »»» contentSchema | body | any | false | none |
| » history | body | [call] | false | none |
| »» Call | body | call | false | none |
| »»» id | body | string | true | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| »»» iterations | body | [iteration] | false | none |
| »»»» Iteration | body | iteration | false | none |
| »»»»» id | body | string | true | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| »»»»» index | body | integer | true | The zero-based index of this iteration within the current Call. |
| »»»»» callId | body | string | true | The unique identifier for the Call that this iteration is a part of. |
| »»»»» inputs | body | inputs | false | none |
| »»»»»» llmApi | body | string | false | The LLM resource targeted by the user. e.g. openai.chat.completions.create |
| »»»»»» llmOutput | body | string | false | The string output from an external LLM call provided by the user via Guard.parse. |
| »»»»»» messages | body | [object] | false | The message history for chat models. |
| »»»»»»» additionalProperties | body | any | false | none |
| »»»»»» promptParams | body | object | false | Parameters to be formatted into the prompt. |
| »»»»»»» additionalProperties | body | any | false | none |
| »»»»»» numReasks | body | integer | false | The total number of times the LLM can be called to correct output excluding the initial call. |
| »»»»»» metadata | body | object | false | Additional data to be used by Validators during execution time. |
| »»»»»»» additionalProperties | body | any | false | none |
| »»»»»» fullSchemaReask | body | boolean | false | Whether to perform reasks for the entire schema rather than for individual fields. |
| »»»»»» stream | body | boolean | false | Whether to use streaming. |
| »»»»» outputs | body | outputs | false | none |
| »»»»»» llmResponseInfo | body | LLMResponse | false | Information from the LLM response. |
| »»»»»»» promptTokenCount | body | integer | false | none |
| »»»»»»» responseTokenCount | body | integer | false | none |
| »»»»»»» output | body | string | true | none |
| »»»»»»» streamOutput | body | [string] | false | none |
| »»»»»»» asyncStreamOutput | body | [string] | false | none |
| »»»»»» rawOutput | body | string | false | The string content from the LLM response. |
| »»»»»» parsedOutput | body | any | false | none |
| »»»»»»» anonymous | body | string | false | none |
| »»»»»»» anonymous | body | object | false | none |
| »»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»» anonymous | body | [anyOf] | false | none |
| »»»»»»»» AnyType | body | any | false | none |
| »»»»»»»»» anonymous | body | any | false | none |
| »»»»»»»»»» anonymous | body | boolean | false | none |
| »»»»»»»»»» anonymous | body | integer | false | none |
| »»»»»»»»»» anonymous | body | null | false | none |
| »»»»»»»»»» anonymous | body | number | false | none |
| »»»»»»»»»» anonymous | body | string | false | none |
| »»»»»»»»» anonymous | body | objects | false | none |
| »»»»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»»»» anonymous | body | [anyOf] | false | none |
| »»»»»»»»»» anonymous | body | any | false | none |
| »»»»»»»»»» anonymous | body | objects | false | none |
| »»»»»» validationResponse | body | any | false | none |
| »»»»»»» anonymous | body | string | false | none |
| »»»»»»» anonymous | body | reask | false | none |
| »»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»»» incorrectValue | body | any | false | none |
| »»»»»»»» failResults | body | [allOf] | false | none |
| »»»»»»»»» FailResult | body | fail-result | false | The output from a single Validator. |
| »»»»»»»»»» outcome | body | any | true | none |
| »»»»»»»»»» errorMessage | body | string | true | none |
| »»»»»»»»»» fixValue | body | any | false | none |
| »»»»»»»»»» errorSpans | body | [error-span] | false | none |
| »»»»»»»»»»» ErrorSpan | body | error-span | false | none |
| »»»»»»»»»»»» start | body | integer | true | none |
| »»»»»»»»»»»» end | body | integer | true | none |
| »»»»»»»»»»»» reason | body | string | true | The reason validation failed, specific to this chunk. |
| »»»»»»» anonymous | body | object | false | none |
| »»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»» anonymous | body | [anyOf] | false | none |
| »»»»»»»» AnyType | body | any | false | none |
| »»»»»» guardedOutput | body | any | false | none |
| »»»»»»» anonymous | body | string | false | none |
| »»»»»»» anonymous | body | object | false | none |
| »»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»» anonymous | body | [anyOf] | false | none |
| »»»»»»»» AnyType | body | any | false | none |
| »»»»»» reasks | body | [reask] | false | none |
| »»»»»»» ReAsk | body | reask | false | none |
| »»»»»» validatorLogs | body | [validator-log] | false | none |
| »»»»»»» ValidatorLog | body | validator-log | false | none |
| »»»»»»»» validatorName | body | string(PascalCase) | true | The class name of the validator. |
| »»»»»»»» registeredName | body | string(kebab-case) | true | The registry id of the validator. |
| »»»»»»»» instanceId | body | any | false | A unique identifier for the validator that produced this log within the session. |
| »»»»»»»»» anonymous | body | string | false | none |
| »»»»»»»»» anonymous | body | integer | false | none |
| »»»»»»»» propertyPath | body | string | true | The JSON path to the property which was validated that produced this log. |
| »»»»»»»» valueBeforeValidation | body | any | true | none |
| »»»»»»»» valueAfterValidation | body | any | false | none |
| »»»»»»»» validationResult | body | any | false | none |
| »»»»»»»»» anonymous | body | pass-result | false | The output from a single Validator. |
| »»»»»»»»»» outcome | body | any | true | none |
| »»»»»»»»»» valueOverride | body | any | false | none |
| »»»»»»»»» anonymous | body | fail-result | false | The output from a single Validator. |
| »»»»»»»»»» outcome | body | any | true | none |
| »»»»»»»»»» errorMessage | body | string | true | none |
| »»»»»»»»»» fixValue | body | any | false | none |
| »»»»»»»»»» errorSpans | body | [error-span] | false | none |
| »»»»»»»» startTime | body | string(date-time) | false | none |
| »»»»»»»» endTime | body | string(date-time) | false | none |
| »»»»»» error | body | string | false | The error message from any exception which interrupted the Guard execution process. |
| »»» inputs | body | CallInputs | false | none |
| »»»» anonymous | body | inputs | false | none |
| »»»» anonymous | body | args-and-kwargs | false | none |
| »»»»» args | body | [anyOf] | false | none |
| »»»»»» AnyType | body | any | false | none |
| »»»»» kwargs | body | object | false | none |
| »»»»»» additionalProperties | body | any | false | none |
| »»» exception | body | string | false | none |
Enumerated Values
| Parameter | Value |
|---|---|
| »»»» anonymous | messages |
| »»»» anonymous | output |
| »»» onFail | exception |
| »»» onFail | filter |
| »»» onFail | fix |
| »»» onFail | fix_reask |
| »»» onFail | noop |
| »»» onFail | reask |
| »»» onFail | refrain |
| »»» onFail | custom |
| »»»» anonymous | array |
| »»»» anonymous | boolean |
| »»»» anonymous | integer |
| »»»» anonymous | null |
| »»»» anonymous | number |
| »»»» anonymous | object |
| »»»» anonymous | string |
| »»»» anonymous | array |
| »»»» anonymous | boolean |
| »»»» anonymous | integer |
| »»»» anonymous | null |
| »»»» anonymous | number |
| »»»» anonymous | object |
| »»»» anonymous | string |
Example responses
200 Response
Responses
To perform this operation, you must be authenticated by means of one of the following methods: ApiKeyAuth, BearerAuthgetGuard
GET /guards/{guardName}
Fetches a specific Guard
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| guardName | path | string | true | Guard name |
| asOf | query | string(date-time) | false | Used to query for data as it existed at this date and time |
Example responses
200 Response
Responses
To perform this operation, you must be authenticated by means of one of the following methods: ApiKeyAuth, BearerAuthupdateGuard
PUT /guards/{guardName}
Updates a Guard
Body parameter
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| guardName | path | string | true | Guard name |
| body | body | guard | true | none |
| » id | body | string(kebab-case) | true | The unique identifier for the Guard. |
| » name | body | string | true | The name for the Guard. |
| » description | body | string | false | A description that concisely states the expected behaviour or purpose of the Guard. |
| » validators | body | [allOf] | false | none |
| »» ValidatorReference | body | ValidatorReference | false | none |
| »»» id | body | string | true | The unique identifier for this Validator. Often the hub id; e.g. guardrails/regex_match |
| »»» on | body | any | false | A reference to the property this validator should be applied against. Can be a valid JSON path or a meta-property such as “prompt” or “output” |
| »»»» anonymous | body | string | false | meta-property |
| »»»» anonymous | body | string | false | JSON path to property; e.g. $.foo.bar |
| »»» onFail | body | string | false | none |
| » output_schema | body | schema | false | none |
| »» definitions | body | object | false | none |
| »»» additionalProperties | body | any | false | none |
| »» dependencies | body | object | false | none |
| »»» additionalProperties | body | any | false | none |
| »»»» anonymous | body | any | false | none |
| »»»» anonymous | body | [string] | false | none |
| »» anonymous | body | core | false | none |
| »»» $anchor | body | string | false | none |
| »»» $ref | body | string(uri-reference) | false | none |
| »»» $dynamicRef | body | string(uri-reference) | false | none |
| »»» $dynamicAnchor | body | string | false | none |
| »»» $vocabulary | body | object | false | none |
| »»»» additionalProperties | body | boolean | false | none |
| »»» $comment | body | string | false | none |
| »»» $defs | body | object | false | none |
| »»»» additionalProperties | body | any | false | none |
| »» anonymous | body | applicator | false | none |
| »»» prefixItems | body | [any] | false | none |
| »»» items | body | any | false | none |
| »»» contains | body | any | false | none |
| »»» additionalProperties | body | any | false | none |
| »»» properties | body | object | false | none |
| »»»» additionalProperties | body | any | false | none |
| »»» patternProperties | body | object | false | none |
| »»»» additionalProperties | body | any | false | none |
| »»» dependentSchemas | body | object | false | none |
| »»»» additionalProperties | body | any | false | none |
| »»» propertyNames | body | any | false | none |
| »»» if | body | any | false | none |
| »»» then | body | any | false | none |
| »»» else | body | any | false | none |
| »»» allOf | body | [any] | false | none |
| »»» anyOf | body | [any] | false | none |
| »»» oneOf | body | [any] | false | none |
| »»» not | body | any | false | none |
| »» anonymous | body | unevaluated | false | none |
| »»» unevaluatedItems | body | any | false | none |
| »»» unevaluatedProperties | body | any | false | none |
| »» anonymous | body | validation | false | none |
| »»» multipleOf | body | number | false | none |
| »»» maximum | body | number | false | none |
| »»» exclusiveMaximum | body | number | false | none |
| »»» minimum | body | number | false | none |
| »»» exclusiveMinimum | body | number | false | none |
| »»» maxLength | body | nonNegativeInteger | false | none |
| »»» minLength | body | nonNegativeInteger | false | none |
| »»» pattern | body | string(regex) | false | none |
| »»» maxItems | body | nonNegativeInteger | false | none |
| »»» minItems | body | nonNegativeInteger | false | none |
| »»» uniqueItems | body | boolean | false | none |
| »»» maxContains | body | nonNegativeInteger | false | none |
| »»» minContains | body | nonNegativeInteger | false | none |
| »»» maxProperties | body | nonNegativeInteger | false | none |
| »»» minProperties | body | nonNegativeInteger | false | none |
| »»» required | body | [string] | false | none |
| »»» dependentRequired | body | object | false | none |
| »»»» additionalProperties | body | [string] | false | none |
| »»» const | body | any | false | none |
| »»» enum | body | [any] | false | none |
| »»» type | body | any | false | none |
| »»»» anonymous | body | any | false | none |
| »»»» anonymous | body | [simpleTypes] | false | none |
| »» anonymous | body | meta-data | false | none |
| »»» title | body | string | false | none |
| »»» description | body | string | false | none |
| »»» default | body | any | false | none |
| »»» deprecated | body | boolean | false | none |
| »»» readOnly | body | boolean | false | none |
| »»» writeOnly | body | boolean | false | none |
| »»» examples | body | [any] | false | none |
| »» anonymous | body | format-annotation | false | none |
| »»» format | body | string | false | none |
| »» anonymous | body | content | false | none |
| »»» contentMediaType | body | string | false | none |
| »»» contentEncoding | body | string | false | none |
| »»» contentSchema | body | any | false | none |
| » history | body | [call] | false | none |
| »» Call | body | call | false | none |
| »»» id | body | string | true | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| »»» iterations | body | [iteration] | false | none |
| »»»» Iteration | body | iteration | false | none |
| »»»»» id | body | string | true | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| »»»»» index | body | integer | true | The zero-based index of this iteration within the current Call. |
| »»»»» callId | body | string | true | The unique identifier for the Call that this iteration is a part of. |
| »»»»» inputs | body | inputs | false | none |
| »»»»»» llmApi | body | string | false | The LLM resource targeted by the user. e.g. openai.chat.completions.create |
| »»»»»» llmOutput | body | string | false | The string output from an external LLM call provided by the user via Guard.parse. |
| »»»»»» messages | body | [object] | false | The message history for chat models. |
| »»»»»»» additionalProperties | body | any | false | none |
| »»»»»» promptParams | body | object | false | Parameters to be formatted into the prompt. |
| »»»»»»» additionalProperties | body | any | false | none |
| »»»»»» numReasks | body | integer | false | The total number of times the LLM can be called to correct output excluding the initial call. |
| »»»»»» metadata | body | object | false | Additional data to be used by Validators during execution time. |
| »»»»»»» additionalProperties | body | any | false | none |
| »»»»»» fullSchemaReask | body | boolean | false | Whether to perform reasks for the entire schema rather than for individual fields. |
| »»»»»» stream | body | boolean | false | Whether to use streaming. |
| »»»»» outputs | body | outputs | false | none |
| »»»»»» llmResponseInfo | body | LLMResponse | false | Information from the LLM response. |
| »»»»»»» promptTokenCount | body | integer | false | none |
| »»»»»»» responseTokenCount | body | integer | false | none |
| »»»»»»» output | body | string | true | none |
| »»»»»»» streamOutput | body | [string] | false | none |
| »»»»»»» asyncStreamOutput | body | [string] | false | none |
| »»»»»» rawOutput | body | string | false | The string content from the LLM response. |
| »»»»»» parsedOutput | body | any | false | none |
| »»»»»»» anonymous | body | string | false | none |
| »»»»»»» anonymous | body | object | false | none |
| »»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»» anonymous | body | [anyOf] | false | none |
| »»»»»»»» AnyType | body | any | false | none |
| »»»»»»»»» anonymous | body | any | false | none |
| »»»»»»»»»» anonymous | body | boolean | false | none |
| »»»»»»»»»» anonymous | body | integer | false | none |
| »»»»»»»»»» anonymous | body | null | false | none |
| »»»»»»»»»» anonymous | body | number | false | none |
| »»»»»»»»»» anonymous | body | string | false | none |
| »»»»»»»»» anonymous | body | objects | false | none |
| »»»»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»»»» anonymous | body | [anyOf] | false | none |
| »»»»»»»»»» anonymous | body | any | false | none |
| »»»»»»»»»» anonymous | body | objects | false | none |
| »»»»»» validationResponse | body | any | false | none |
| »»»»»»» anonymous | body | string | false | none |
| »»»»»»» anonymous | body | reask | false | none |
| »»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»»» incorrectValue | body | any | false | none |
| »»»»»»»» failResults | body | [allOf] | false | none |
| »»»»»»»»» FailResult | body | fail-result | false | The output from a single Validator. |
| »»»»»»»»»» outcome | body | any | true | none |
| »»»»»»»»»» errorMessage | body | string | true | none |
| »»»»»»»»»» fixValue | body | any | false | none |
| »»»»»»»»»» errorSpans | body | [error-span] | false | none |
| »»»»»»»»»»» ErrorSpan | body | error-span | false | none |
| »»»»»»»»»»»» start | body | integer | true | none |
| »»»»»»»»»»»» end | body | integer | true | none |
| »»»»»»»»»»»» reason | body | string | true | The reason validation failed, specific to this chunk. |
| »»»»»»» anonymous | body | object | false | none |
| »»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»» anonymous | body | [anyOf] | false | none |
| »»»»»»»» AnyType | body | any | false | none |
| »»»»»» guardedOutput | body | any | false | none |
| »»»»»»» anonymous | body | string | false | none |
| »»»»»»» anonymous | body | object | false | none |
| »»»»»»»» additionalProperties | body | any | false | none |
| »»»»»»» anonymous | body | [anyOf] | false | none |
| »»»»»»»» AnyType | body | any | false | none |
| »»»»»» reasks | body | [reask] | false | none |
| »»»»»»» ReAsk | body | reask | false | none |
| »»»»»» validatorLogs | body | [validator-log] | false | none |
| »»»»»»» ValidatorLog | body | validator-log | false | none |
| »»»»»»»» validatorName | body | string(PascalCase) | true | The class name of the validator. |
| »»»»»»»» registeredName | body | string(kebab-case) | true | The registry id of the validator. |
| »»»»»»»» instanceId | body | any | false | A unique identifier for the validator that produced this log within the session. |
| »»»»»»»»» anonymous | body | string | false | none |
| »»»»»»»»» anonymous | body | integer | false | none |
| »»»»»»»» propertyPath | body | string | true | The JSON path to the property which was validated that produced this log. |
| »»»»»»»» valueBeforeValidation | body | any | true | none |
| »»»»»»»» valueAfterValidation | body | any | false | none |
| »»»»»»»» validationResult | body | any | false | none |
| »»»»»»»»» anonymous | body | pass-result | false | The output from a single Validator. |
| »»»»»»»»»» outcome | body | any | true | none |
| »»»»»»»»»» valueOverride | body | any | false | none |
| »»»»»»»»» anonymous | body | fail-result | false | The output from a single Validator. |
| »»»»»»»»»» outcome | body | any | true | none |
| »»»»»»»»»» errorMessage | body | string | true | none |
| »»»»»»»»»» fixValue | body | any | false | none |
| »»»»»»»»»» errorSpans | body | [error-span] | false | none |
| »»»»»»»» startTime | body | string(date-time) | false | none |
| »»»»»»»» endTime | body | string(date-time) | false | none |
| »»»»»» error | body | string | false | The error message from any exception which interrupted the Guard execution process. |
| »»» inputs | body | CallInputs | false | none |
| »»»» anonymous | body | inputs | false | none |
| »»»» anonymous | body | args-and-kwargs | false | none |
| »»»»» args | body | [anyOf] | false | none |
| »»»»»» AnyType | body | any | false | none |
| »»»»» kwargs | body | object | false | none |
| »»»»»» additionalProperties | body | any | false | none |
| »»» exception | body | string | false | none |
Enumerated Values
| Parameter | Value |
|---|---|
| »»»» anonymous | messages |
| »»»» anonymous | output |
| »»» onFail | exception |
| »»» onFail | filter |
| »»» onFail | fix |
| »»» onFail | fix_reask |
| »»» onFail | noop |
| »»» onFail | reask |
| »»» onFail | refrain |
| »»» onFail | custom |
| »»»» anonymous | array |
| »»»» anonymous | boolean |
| »»»» anonymous | integer |
| »»»» anonymous | null |
| »»»» anonymous | number |
| »»»» anonymous | object |
| »»»» anonymous | string |
| »»»» anonymous | array |
| »»»» anonymous | boolean |
| »»»» anonymous | integer |
| »»»» anonymous | null |
| »»»» anonymous | number |
| »»»» anonymous | object |
| »»»» anonymous | string |
Example responses
200 Response
Responses
To perform this operation, you must be authenticated by means of one of the following methods: ApiKeyAuth, BearerAuthdeleteGuard
DELETE /guards/{guardName}
Deletes a Guard
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| guardName | path | string | true | Guard name |
Example responses
200 Response
Responses
To perform this operation, you must be authenticated by means of one of the following methods: ApiKeyAuth, BearerAuthgetGuardHistory
GET /guards/{guardName}/history/{callId}
Fetches the history for a specific Guard execution by using the id for the most recent Call
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| guardName | path | string | true | Guard name |
| callId | path | string | true | Call id |
Example responses
200 Response
Responses
Response Schema
Status Code 200| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [call] | false | none | none |
| » Call | call | false | none | none |
| »» id | string | true | none | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| »» iterations | [iteration] | false | none | none |
| »»» Iteration | iteration | false | none | none |
| »»»» id | string | true | none | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| »»»» index | integer | true | none | The zero-based index of this iteration within the current Call. |
| »»»» callId | string | true | none | The unique identifier for the Call that this iteration is a part of. |
| »»»» inputs | inputs | false | none | none |
| »»»»» llmApi | string | false | none | The LLM resource targeted by the user. e.g. openai.chat.completions.create |
| »»»»» llmOutput | string | false | none | The string output from an external LLM call provided by the user via Guard.parse. |
| »»»»» messages | [object] | false | none | The message history for chat models. |
| »»»»»» additionalProperties | any | false | none | none |
| »»»»» promptParams | object | false | none | Parameters to be formatted into the prompt. |
| »»»»»» additionalProperties | any | false | none | none |
| »»»»» numReasks | integer | false | none | The total number of times the LLM can be called to correct output excluding the initial call. |
| »»»»» metadata | object | false | none | Additional data to be used by Validators during execution time. |
| »»»»»» additionalProperties | any | false | none | none |
| »»»»» fullSchemaReask | boolean | false | none | Whether to perform reasks for the entire schema rather than for individual fields. |
| »»»»» stream | boolean | false | none | Whether to use streaming. |
| »»»» outputs | outputs | false | none | none |
| »»»»» llmResponseInfo | LLMResponse | false | none | Information from the LLM response. |
| »»»»»» promptTokenCount | integer | false | none | none |
| »»»»»» responseTokenCount | integer | false | none | none |
| »»»»»» output | string | true | none | none |
| »»»»»» streamOutput | [string] | false | none | none |
| »»»»»» asyncStreamOutput | [string] | false | none | none |
| »»»»» rawOutput | string | false | none | The string content from the LLM response. |
| »»»»» parsedOutput | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | object | false | none | none |
| »»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | [anyOf] | false | none | none |
| »»»»»»» AnyType | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» anonymous | boolean | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» anonymous | integer | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» anonymous | null | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» anonymous | number | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | objects | false | none | none |
| »»»»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | [anyOf] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» anonymous | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»»» anonymous | objects | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» validationResponse | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | reask | false | none | none |
| »»»»»»» additionalProperties | any | false | none | none |
| »»»»»»» incorrectValue | any | false | none | none |
| »»»»»»» failResults | [allOf] | false | none | none |
| »»»»»»»» FailResult | fail-result | false | none | The output from a single Validator. |
| »»»»»»»»» outcome | any | true | none | none |
| »»»»»»»»» errorMessage | string | true | none | none |
| »»»»»»»»» fixValue | any | false | none | none |
| »»»»»»»»» errorSpans | [error-span] | false | none | none |
| »»»»»»»»»» ErrorSpan | error-span | false | none | none |
| »»»»»»»»»»» start | integer | true | none | none |
| »»»»»»»»»»» end | integer | true | none | none |
| »»»»»»»»»»» reason | string | true | none | The reason validation failed, specific to this chunk. |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | object | false | none | none |
| »»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | [anyOf] | false | none | none |
| »»»»»»» AnyType | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» guardedOutput | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | object | false | none | none |
| »»»»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»» anonymous | [anyOf] | false | none | none |
| »»»»»»» AnyType | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»» reasks | [reask] | false | none | none |
| »»»»»» ReAsk | reask | false | none | none |
| »»»»» validatorLogs | [validator-log] | false | none | none |
| »»»»»» ValidatorLog | validator-log | false | none | none |
| »»»»»»» validatorName | string(PascalCase) | true | none | The class name of the validator. |
| »»»»»»» registeredName | string(kebab-case) | true | none | The registry id of the validator. |
| »»»»»»» instanceId | any | false | none | A unique identifier for the validator that produced this log within the session. |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | integer | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»» propertyPath | string | true | none | The JSON path to the property which was validated that produced this log. |
| »»»»»»» valueBeforeValidation | any | true | none | none |
| »»»»»»» valueAfterValidation | any | false | none | none |
| »»»»»»» validationResult | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | pass-result | false | none | The output from a single Validator. |
| »»»»»»»»» outcome | any | true | none | none |
| »»»»»»»»» valueOverride | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»»» anonymous | fail-result | false | none | The output from a single Validator. |
| »»»»»»»»» outcome | any | true | none | none |
| »»»»»»»»» errorMessage | string | true | none | none |
| »»»»»»»»» fixValue | any | false | none | none |
| »»»»»»»»» errorSpans | [error-span] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»»»»»» startTime | string(date-time) | false | none | none |
| »»»»»»» endTime | string(date-time) | false | none | none |
| »»»»» error | string | false | none | The error message from any exception which interrupted the Guard execution process. |
| »» inputs | CallInputs | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | inputs | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »»» anonymous | args-and-kwargs | false | none | none |
| »»»» args | [anyOf] | false | none | none |
| »»»»» AnyType | any | false | none | none |
| »»»» kwargs | object | false | none | none |
| »»»»» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »» exception | string | false | none | none |
openai
openaiChatCompletion
POST /guards/{guardName}/openai/v1/chat/completions
OpenAI SDK compatible endpoint for Chat Completions
Body parameter
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| guardName | path | string | true | Guard name |
| body | body | OpenAIChatCompletionPayload | true | none |
| » model | body | string | false | The model to use for the completion |
| » messages | body | [object] | false | The messages to use for the completion |
| »» role | body | string | false | The role of the message |
| »» content | body | string | false | The content of the message |
| » max_tokens | body | integer | false | The maximum number of tokens to generate |
| » temperature | body | number | false | The sampling temperature |
Example responses
200 Response
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | The output of the completion | OpenAIChatCompletion |
| default | Default | Unexpected error | HttpError |
validate
validate
POST /guards/{guardName}/validate
Runs the validations specified in a Guard
Body parameter
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| guardName | path | string | true | Guard name |
| x-openai-api-key | header | string(password) | false | A valid OpenAI API Key for calling LLM’s on your behalf |
| body | body | ValidatePayload | true | none |
| » additionalProperties | body | any | false | none |
| » llmOutput | body | string | false | The LLM output as a string or the input prompts for the LLM |
| » numReasks | body | integer | false | An override for the number of re-asks to perform |
| » promptParams | body | object | false | additional params for llm prompts |
| »» additionalProperties | body | any | false | none |
| » llmApi | body | LLMResource | false | none |
Enumerated Values
| Parameter | Value |
|---|---|
| » llmApi | openai.Completion.create |
| » llmApi | openai.completions.create |
| » llmApi | openai.ChatCompletion.create |
| » llmApi | openai.chat.completions.create |
| » llmApi | openai.Completion.acreate |
| » llmApi | openai.ChatCompletion.acreate |
| » llmApi | litellm.completion |
| » llmApi | litellm.acompletion |
Example responses
200 Response
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | The output of the validation | validation-outcome |
| default | Default | Unexpected error | HttpError |
Schemas
OpenAIChatCompletionPayload
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| model | string | false | none | The model to use for the completion |
| messages | [object] | false | none | The messages to use for the completion |
| » role | string | false | none | The role of the message |
| » content | string | false | none | The content of the message |
| max_tokens | integer | false | none | The maximum number of tokens to generate |
| temperature | number | false | none | The sampling temperature |
OpenAIChatCompletion
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string | true | none | The id |
| created | string | true | none | The created date |
| model_name | string | true | none | The model name |
| choices | [object] | true | none | none |
| » role | string | false | none | The role of the message |
| » content | string | false | none | The content of the message |
HttpError
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| status | integer | true | none | A valid http status code |
| message | string | true | none | A message explaining the status |
| cause | string | false | none | Used to describe the origin of an error if that original error has meaning to the client. This field should add specificity to ‘message’. |
| fields | object | false | none | Used to identify specific fields in a JSON body that caused the error. Typically only used for 4xx type responses. The key should be the json path to the invalid property and the value should be a list of error messages specific to that property. |
| » additionalProperties | [string] | false | none | none |
| context | string | false | none | Used to identify what part of the request caused the error for non-JSON payloads. |
HealthCheck
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| status | integer | true | none | A valid http status code |
| message | string | true | none | A message explaining the status |
ValidationOutcome
Properties
Noneprimitives
Properties
anyOf| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | boolean | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | integer | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | null | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | number | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | string | false | none | none |
objects
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| additionalProperties | any | false | none | none |
arrays
Properties
anyOf| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | primitives | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | objects | false | none | none |
any-type
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| AnyType | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | primitives | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | objects | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | arrays | false | none | none |
validation-result
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| outcome | string | true | none | none |
| metadata | object | false | none | none |
| » additionalProperties | any | false | none | none |
| validatedChunk | any-type | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| outcome | pass |
| outcome | fail |
error-span
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| start | integer | true | none | none |
| end | integer | true | none | none |
| reason | string | true | none | The reason validation failed, specific to this chunk. |
fail-result
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| FailResult | validation-result | false | none | The output from a single Validator. |
| outcome | any | true | none | none |
| errorMessage | string | true | none | none |
| fixValue | any-type | false | none | none |
| errorSpans | [error-span] | false | none | none |
reask
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| additionalProperties | any | false | none | none |
| incorrectValue | any-type | false | none | none |
| failResults | [fail-result] | false | none | none |
validation-outcome
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| callId | string | true | none | Foreign key to the most recent Call this resulted from. |
| rawLlmOutput | string | false | none | The raw, unchanged string content from the LLM call. |
| validatedOutput | any | false | none | The validated, and potentially fixed, output from the LLM call after undergoing validation. |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | object | false | none | none |
| »» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | [any-type] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| reask | reask | false | none | If validation continuously fails and all allocated reasks are used, this field will contain the final reask that would have been sent to the LLM if additional reasks were available. |
| validationPassed | boolean | false | none | A boolean to indicate whether or not the LLM output passed validation. If this is False, the validated_output may be invalid. |
| error | string | false | none | If the validation process raised a handleable exception, this field will contain the error message. |
Guard
Properties
NoneschemaArray
Properties
NonenonNegativeInteger
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | integer | false | none | none |
nonNegativeIntegerDefault0
Properties
NonesimpleTypes
Properties
NonestringArray
Properties
NoneLLMResponse
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| promptTokenCount | integer | false | none | none |
| responseTokenCount | integer | false | none | none |
| output | string | true | none | none |
| streamOutput | [string] | false | none | none |
| asyncStreamOutput | [string] | false | none | none |
CallInputs
Properties
allOf| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | inputs | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | args-and-kwargs | false | none | none |
ValidatorReference
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| ValidatorReference | args-and-kwargs | false | none | none |
| id | string | true | none | The unique identifier for this Validator. Often the hub id; e.g. guardrails/regex_match |
| on | any | false | none | A reference to the property this validator should be applied against. Can be a valid JSON path or a meta-property such as “prompt” or “output” |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | string | false | none | meta-property |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | string | false | none | JSON path to property; e.g. $.foo.bar |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| onFail | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| anonymous | prompt |
| anonymous | messages |
| anonymous | output |
| onFail | exception |
| onFail | filter |
| onFail | fix |
| onFail | fix_reask |
| onFail | noop |
| onFail | reask |
| onFail | refrain |
| onFail | custom |
args-and-kwargs
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| args | [any-type] | false | none | none |
| kwargs | object | false | none | none |
| » additionalProperties | any | false | none | none |
core
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Core vocabulary meta-schema | object,boolean | false | none | none |
| $anchor | string | false | none | none |
| $ref | string(uri-reference) | false | none | none |
| $dynamicRef | string(uri-reference) | false | none | none |
| $dynamicAnchor | string | false | none | none |
| $vocabulary | object | false | none | none |
| » additionalProperties | boolean | false | none | none |
| $comment | string | false | none | none |
| $defs | object | false | none | none |
| » additionalProperties | any | false | none | none |
applicator
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Applicator vocabulary meta-schema | object,boolean | false | none | none |
| prefixItems | schemaArray | false | none | none |
| items | any | false | none | none |
| contains | any | false | none | none |
| additionalProperties | any | false | none | none |
| properties | object | false | none | none |
| » additionalProperties | any | false | none | none |
| patternProperties | object | false | none | none |
| » additionalProperties | any | false | none | none |
| dependentSchemas | object | false | none | none |
| » additionalProperties | any | false | none | none |
| propertyNames | any | false | none | none |
| if | any | false | none | none |
| then | any | false | none | none |
| else | any | false | none | none |
| allOf | schemaArray | false | none | none |
| anyOf | schemaArray | false | none | none |
| oneOf | schemaArray | false | none | none |
| not | any | false | none | none |
unevaluated
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Unevaluated applicator vocabulary meta-schema | object,boolean | false | none | none |
| unevaluatedItems | any | false | none | none |
| unevaluatedProperties | any | false | none | none |
validation
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Validation vocabulary meta-schema | object,boolean | false | none | none |
| multipleOf | number | false | none | none |
| maximum | number | false | none | none |
| exclusiveMaximum | number | false | none | none |
| minimum | number | false | none | none |
| exclusiveMinimum | number | false | none | none |
| maxLength | nonNegativeInteger | false | none | none |
| minLength | nonNegativeIntegerDefault0 | false | none | none |
| pattern | string(regex) | false | none | none |
| maxItems | nonNegativeInteger | false | none | none |
| minItems | nonNegativeIntegerDefault0 | false | none | none |
| uniqueItems | boolean | false | none | none |
| maxContains | nonNegativeInteger | false | none | none |
| minContains | nonNegativeInteger | false | none | none |
| maxProperties | nonNegativeInteger | false | none | none |
| minProperties | nonNegativeIntegerDefault0 | false | none | none |
| required | stringArray | false | none | none |
| dependentRequired | object | false | none | none |
| » additionalProperties | stringArray | false | none | none |
| const | any | false | none | none |
| enum | [any] | false | none | none |
| type | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | simpleTypes | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | [simpleTypes] | false | none | none |
meta-data
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Meta-data vocabulary meta-schema | object,boolean | false | none | none |
| title | string | false | none | none |
| description | string | false | none | none |
| default | any | false | none | none |
| deprecated | boolean | false | none | none |
| readOnly | boolean | false | none | none |
| writeOnly | boolean | false | none | none |
| examples | [any] | false | none | none |
format-annotation
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Format vocabulary meta-schema for annotation results | object,boolean | false | none | none |
| format | string | false | none | none |
content
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Content vocabulary meta-schema | object,boolean | false | none | none |
| contentMediaType | string | false | none | none |
| contentEncoding | string | false | none | none |
| contentSchema | any | false | none | none |
schema
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Core and Validation specifications meta-schema | object,boolean | false | none | none |
| definitions | object | false | none | none |
| » additionalProperties | any | false | none | none |
| dependencies | object | false | none | none |
| » additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »» anonymous | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| »» anonymous | validation/definitions/stringArray | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | core | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | applicator | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | unevaluated | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | validation | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | meta-data | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | format-annotation | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | content | false | none | none |
inputs
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| llmApi | string | false | none | The LLM resource targeted by the user. e.g. openai.chat.completions.create |
| llmOutput | string | false | none | The string output from an external LLM call provided by the user via Guard.parse. |
| messages | [object] | false | none | The message history for chat models. |
| » additionalProperties | any | false | none | none |
| promptParams | object | false | none | Parameters to be formatted into the prompt. |
| » additionalProperties | any | false | none | none |
| numReasks | integer | false | none | The total number of times the LLM can be called to correct output excluding the initial call. |
| metadata | object | false | none | Additional data to be used by Validators during execution time. |
| » additionalProperties | any | false | none | none |
| fullSchemaReask | boolean | false | none | Whether to perform reasks for the entire schema rather than for individual fields. |
| stream | boolean | false | none | Whether to use streaming. |
pass-result
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| PassResult | validation-result | false | none | The output from a single Validator. |
| outcome | any | true | none | none |
| valueOverride | any-type | false | none | none |
validator-log
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| validatorName | string(PascalCase) | true | none | The class name of the validator. |
| registeredName | string(kebab-case) | true | none | The registry id of the validator. |
| instanceId | any | false | none | A unique identifier for the validator that produced this log within the session. |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | integer | false | none | none |
anyOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | pass-result | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | fail-result | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| startTime | string(date-time) | false | none | none |
| endTime | string(date-time) | false | none | none |
outputs
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| llmResponseInfo | LLMResponse | false | none | Information from the LLM response. |
| rawOutput | string | false | none | The string content from the LLM response. |
| parsedOutput | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | object | false | none | none |
| »» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | [any-type] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| validationResponse | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | reask | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | object | false | none | none |
| »» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | [any-type] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| guardedOutput | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | string | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | object | false | none | none |
| »» additionalProperties | any | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » anonymous | [any-type] | false | none | none |
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| reasks | [reask] | false | none | none |
| validatorLogs | [validator-log] | false | none | none |
| error | string | false | none | The error message from any exception which interrupted the Guard execution process. |
iteration
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string | true | none | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| index | integer | true | none | The zero-based index of this iteration within the current Call. |
| callId | string | true | none | The unique identifier for the Call that this iteration is a part of. |
| inputs | inputs | false | none | none |
| outputs | outputs | false | none | none |
call
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string | true | none | The unique identifier for this Call. Can be used as an identifier for a specific execution of a Guard. |
| iterations | [iteration] | false | none | none |
| inputs | CallInputs | false | none | none |
| exception | string | false | none | none |
guard
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(kebab-case) | true | none | The unique identifier for the Guard. |
| name | string | true | none | The name for the Guard. |
| description | string | false | none | A description that concisely states the expected behaviour or purpose of the Guard. |
| validators | [ValidatorReference] | false | none | none |
| output_schema | schema | false | none | none |
| history | [call] | false | read-only | none |
ValidatePayload
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| additionalProperties | any | false | none | none |
| llmOutput | string | false | none | The LLM output as a string or the input prompts for the LLM |
| numReasks | integer | false | none | An override for the number of re-asks to perform |
| promptParams | object | false | none | additional params for llm prompts |
| » additionalProperties | any | false | none | none |
| llmApi | LLMResource | false | none | none |
LLMResource
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| anonymous | openai.Completion.create |
| anonymous | openai.completions.create |
| anonymous | openai.ChatCompletion.create |
| anonymous | openai.chat.completions.create |
| anonymous | openai.Completion.acreate |
| anonymous | openai.ChatCompletion.acreate |
| anonymous | litellm.completion |
| anonymous | litellm.acompletion |