/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { guardrailsDeleteGuardrails } from "../funcs/guardrailsDeleteGuardrails.js"; import { guardrailsGetGuardrails } from "../funcs/guardrailsGetGuardrails.js"; import { guardrailsListGuardrailsPolicies } from "../funcs/guardrailsListGuardrailsPolicies.js"; import { guardrailsTestGuardrails } from "../funcs/guardrailsTestGuardrails.js"; import { guardrailsUpdateGuardrails } from "../funcs/guardrailsUpdateGuardrails.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class Guardrails extends ClientSDK { /** * Get effective guardrails * * @remarks * Retrieve the guardrails that apply to the caller's requests: the org-wide policy plus the caller's team policy, combined. Both are enforced when both exist. Policies are managed by org admins via PUT /guardrails. */ async getGuardrails( request: operations.GetGuardrailsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(guardrailsGetGuardrails( this, request, options, )); } /** * Update guardrails policy * * @remarks * Replace a guardrails policy. Omit team_id to set the org-wide policy (org admin only); provide team_id to set that team's additional policy (org admins may target any team in their org, other callers only their own team). The org-wide policy applies to every team; a team policy is enforced in addition to it — configuring a team policy never weakens the org-wide one. */ async updateGuardrails( request: operations.UpdateGuardrailsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(guardrailsUpdateGuardrails( this, request, options, )); } /** * Delete guardrails policy * * @remarks * Delete a guardrails policy. Omit team_id to delete the org-wide policy (org admin only); provide team_id to delete that team's policy (org admins may target any team in their org, other callers only their own team). Idempotent: deleting a policy that doesn't exist returns deleted: false. */ async deleteGuardrails( request: operations.DeleteGuardrailsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(guardrailsDeleteGuardrails( this, request, options, )); } /** * List guardrails policies * * @remarks * List the stored guardrails policies visible to the caller: org admins see every policy in their org (the org-wide policy has team_id null, plus each team's additional policy); other callers see the org-wide policy and their own team's policy. Unlike GET /guardrails, rows are returned per scope so a team can see which rules it owns versus which the org mandates. */ async listGuardrailsPolicies( request: operations.ListGuardrailsPoliciesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(guardrailsListGuardrailsPolicies( this, request, options, )); } /** * Test content against guardrails * * @remarks * Test a piece of content against the caller's effective guardrails (org-wide policy plus team policy) without making an actual API call. Useful for debugging and validating guardrail configurations. Returns a report indicating whether the content passed and which guardrail was triggered if any. */ async testGuardrails( request: operations.TestGuardrailsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(guardrailsTestGuardrails( this, request, options, )); } }