Returns a paginated list of policies 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.policies.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.PolicyListResponseBody
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Creates a new router policy with model configuration, evaluators, retry settings, and limits.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.policies.create(display_name="Zelda80")
# Handle response
print(res)
models.PolicyCreateResponseBody
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Deletes an existing policy by ID.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
orq.policies.delete(policy_id="<id>")
# Use the SDK ...
| Parameter |
Type |
Required |
Description |
policy_id |
str |
✔️ |
The ID of the policy |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Retrieves the details of an existing policy by ID.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.policies.retrieve(policy_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
policy_id |
str |
✔️ |
The ID of the policy |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.PolicyGetResponseBody
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Partially updates an existing policy. 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.policies.update(policy_id="<id>")
# Handle response
print(res)
models.PolicyUpdateResponseBody
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |