Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

GuardrailLlmPolicy

import type { GuardrailLlmPolicy } from "https://googleapis.deno.dev/v1/ces:v1.ts";

Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.

interface GuardrailLlmPolicy {
allowShortUtterance?: boolean;
failOpen?: boolean;
maxConversationMessages?: number;
modelSettings?: ModelSettings;
policyScope?:
| "POLICY_SCOPE_UNSPECIFIED"
| "USER_QUERY"
| "AGENT_RESPONSE"
| "USER_QUERY_AND_AGENT_RESPONSE";
prompt?: string;
}

§Properties

§
allowShortUtterance?: boolean
[src]

Optional. By default, the LLM policy check is bypassed for short utterances. Enabling this setting applies the policy check to all utterances, including those that would normally be skipped.

§
failOpen?: boolean
[src]

Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.

§
maxConversationMessages?: number
[src]

Optional. When checking this policy, consider the last 'n' messages in the conversation. When not set a default value of 10 will be used.

§
modelSettings?: ModelSettings
[src]

Optional. Model settings.

§
policyScope?: "POLICY_SCOPE_UNSPECIFIED" | "USER_QUERY" | "AGENT_RESPONSE" | "USER_QUERY_AND_AGENT_RESPONSE"
[src]

Required. Defines when to apply the policy check during the conversation. If set to POLICY_SCOPE_UNSPECIFIED, the policy will be applied to the user input. When applying the policy to the agent response, additional latency will be introduced before the agent can respond.

§
prompt?: string
[src]

Required. Policy prompt.