- list - List guardrail rules
- create - Create guardrail rule
- delete - Delete guardrail rule
- retrieve - Get guardrail rule
- update - Update guardrail rule
Returns a paginated list of guardrail rules for the current project.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.guardrail_rules.list(limit=10)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
limit |
Optional[int] |
➖ |
N/A |
starting_after |
Optional[str] |
➖ |
A cursor for use in pagination. |
ending_before |
Optional[str] |
➖ |
A cursor for use in pagination. |
project_id |
Optional[str] |
➖ |
Optional filter by project ID. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GuardrailRuleListResponseBody
| Error Type |
Status Code |
Content Type |
| models.APIError |
4XX, 5XX |
*/* |
Creates a new guardrail rule with expression, guardrails configuration, and timeout settings.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.guardrail_rules.create(display_name="Rosemarie_Wisoky")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
display_name |
str |
✔️ |
N/A |
description |
Optional[str] |
➖ |
N/A |
enabled |
Optional[bool] |
➖ |
N/A |
expression |
Optional[models.ExpressionInput] |
➖ |
N/A |
guardrails |
List[models.GuardrailRef] |
➖ |
N/A |
project_id |
Optional[str] |
➖ |
Optional project ID. If null/omitted, the entity is global (workspace-wide). |
timeout |
Optional[int] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GuardrailRuleCreateResponseBody
| Error Type |
Status Code |
Content Type |
| models.APIError |
4XX, 5XX |
*/* |
Deletes an existing guardrail rule by ID.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
orq.guardrail_rules.delete(guardrail_rule_id="<id>")
# Use the SDK ...
| Parameter |
Type |
Required |
Description |
guardrail_rule_id |
str |
✔️ |
The ID of the guardrail rule |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
| Error Type |
Status Code |
Content Type |
| models.APIError |
4XX, 5XX |
*/* |
Retrieves the details of an existing guardrail rule by ID.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.guardrail_rules.retrieve(guardrail_rule_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
guardrail_rule_id |
str |
✔️ |
The ID of the guardrail rule |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GuardrailRuleGetResponseBody
| Error Type |
Status Code |
Content Type |
| models.APIError |
4XX, 5XX |
*/* |
Partially updates an existing guardrail rule. Only provided fields are updated.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.guardrail_rules.update(guardrail_rule_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
guardrail_rule_id |
str |
✔️ |
The ID of the guardrail rule |
description |
Optional[str] |
➖ |
N/A |
display_name |
Optional[str] |
➖ |
N/A |
enabled |
Optional[bool] |
➖ |
N/A |
expression |
Optional[models.ExpressionInput] |
➖ |
N/A |
guardrails |
List[models.GuardrailRef] |
➖ |
N/A |
timeout |
Optional[int] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GuardrailRuleUpdateResponseBody
| Error Type |
Status Code |
Content Type |
| models.APIError |
4XX, 5XX |
*/* |