Debian Codegraph @

docs/dyn/ces_v1beta.projects.locations.apps.guardrails.html

raw
1 <html><body>
2 <style>
3
4 body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13 }
14
15 body {
16 font-size: 13px;
17 padding: 1em;
18 }
19
20 h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23 }
24
25 h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28 }
29
30 h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34 }
35
36 pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39 }
40
41 pre {
42 margin-top: 0.5em;
43 }
44
45 h1, h2, h3, p {
46 font-family: Arial, sans serif;
47 }
48
49 h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51 }
52
53 .toc_element {
54 margin-top: 0.5em;
55 }
56
57 .firstline {
58 margin-left: 2 em;
59 }
60
61 .method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66 }
67
68 .details {
69 font-weight: bold;
70 font-size: 14px;
71 }
72
73 </style>
74
75 <h1><a href="ces_v1beta.html">Gemini Enterprise for Customer Experience API</a> . <a href="ces_v1beta.projects.html">projects</a> . <a href="ces_v1beta.projects.locations.html">locations</a> . <a href="ces_v1beta.projects.locations.apps.html">apps</a> . <a href="ces_v1beta.projects.locations.apps.guardrails.html">guardrails</a></h1>
76 <h2>Instance Methods</h2>
77 <p class="toc_element">
78 <code><a href="#close">close()</a></code></p>
79 <p class="firstline">Close httplib2 connections.</p>
80 <p class="toc_element">
81 <code><a href="#create">create(parent, body=None, guardrailId=None, x__xgafv=None)</a></code></p>
82 <p class="firstline">Creates a new guardrail in the given app.</p>
83 <p class="toc_element">
84 <code><a href="#delete">delete(name, etag=None, force=None, x__xgafv=None)</a></code></p>
85 <p class="firstline">Deletes the specified guardrail.</p>
86 <p class="toc_element">
87 <code><a href="#get">get(name, x__xgafv=None)</a></code></p>
88 <p class="firstline">Gets details of the specified guardrail.</p>
89 <p class="toc_element">
90 <code><a href="#list">list(parent, filter=None, orderBy=None, pageSize=None, pageToken=None, x__xgafv=None)</a></code></p>
91 <p class="firstline">Lists guardrails in the given app.</p>
92 <p class="toc_element">
93 <code><a href="#list_next">list_next()</a></code></p>
94 <p class="firstline">Retrieves the next page of results.</p>
95 <p class="toc_element">
96 <code><a href="#patch">patch(name, body=None, updateMask=None, x__xgafv=None)</a></code></p>
97 <p class="firstline">Updates the specified guardrail.</p>
98 <h3>Method Details</h3>
99 <div class="method">
100 <code class="details" id="close">close()</code>
101 <pre>Close httplib2 connections.</pre>
102 </div>
103
104 <div class="method">
105 <code class="details" id="create">create(parent, body=None, guardrailId=None, x__xgafv=None)</code>
106 <pre>Creates a new guardrail in the given app.
107
108 Args:
109 parent: string, Required. The resource name of the app to create a guardrail in. (required)
110 body: object, The request body.
111 The object takes the form of:
112
113 { # Guardrail contains a list of checks and balances to keep the agents safe and secure.
114 &quot;action&quot;: { # Action that is taken when a certain precondition is met. # Optional. Action to take when the guardrail is triggered.
115 &quot;generativeAnswer&quot;: { # The agent will immediately respond with a generative answer. # Optional. Respond with a generative answer.
116 &quot;prompt&quot;: &quot;A String&quot;, # Required. The prompt to use for the generative answer.
117 },
118 &quot;respondImmediately&quot;: { # The agent will immediately respond with a preconfigured response. # Optional. Immediately respond with a preconfigured response.
119 &quot;responses&quot;: [ # Required. The canned responses for the agent to choose from. The response is chosen randomly.
120 { # Represents a response from the agent.
121 &quot;disabled&quot;: True or False, # Optional. Whether the response is disabled. Disabled responses are not used by the agent.
122 &quot;text&quot;: &quot;A String&quot;, # Required. Text for the agent to respond with.
123 },
124 ],
125 },
126 &quot;transferAgent&quot;: { # The agent will transfer the conversation to a different agent. # Optional. Transfer the conversation to a different agent.
127 &quot;agent&quot;: &quot;A String&quot;, # Required. The name of the agent to transfer the conversation to. The agent must be in the same app as the current agent. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
128 },
129 },
130 &quot;codeCallback&quot;: { # Guardrail that blocks the conversation based on the code callbacks provided. # Optional. Guardrail that potentially blocks the conversation based on the result of the callback execution.
131 &quot;afterAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
132 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
133 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
134 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
135 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
136 },
137 &quot;afterModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
138 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
139 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
140 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
141 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
142 },
143 &quot;beforeAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
144 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
145 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
146 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
147 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
148 },
149 &quot;beforeModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
150 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
151 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
152 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
153 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
154 },
155 },
156 &quot;contentFilter&quot;: { # Guardrail that bans certain content from being used in the conversation. # Optional. Guardrail that bans certain content from being used in the conversation.
157 &quot;bannedContents&quot;: [ # Optional. List of banned phrases. Applies to both user inputs and agent responses.
158 &quot;A String&quot;,
159 ],
160 &quot;bannedContentsInAgentResponse&quot;: [ # Optional. List of banned phrases. Applies only to agent responses.
161 &quot;A String&quot;,
162 ],
163 &quot;bannedContentsInUserInput&quot;: [ # Optional. List of banned phrases. Applies only to user inputs.
164 &quot;A String&quot;,
165 ],
166 &quot;disregardDiacritics&quot;: True or False, # Optional. If true, diacritics are ignored during matching.
167 &quot;matchType&quot;: &quot;A String&quot;, # Required. Match type for the content filter.
168 },
169 &quot;createTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was created.
170 &quot;description&quot;: &quot;A String&quot;, # Optional. Description of the guardrail.
171 &quot;displayName&quot;: &quot;A String&quot;, # Required. Display name of the guardrail.
172 &quot;enabled&quot;: True or False, # Optional. Whether the guardrail is enabled.
173 &quot;etag&quot;: &quot;A String&quot;, # Etag used to ensure the object hasn&#x27;t changed during a read-modify-write operation. If the etag is empty, the update will overwrite any concurrent changes.
174 &quot;llmPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
175 &quot;allowShortUtterance&quot;: True or False, # 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.
176 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
177 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
178 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
179 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
180 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
181 },
182 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
183 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
184 },
185 &quot;llmPromptSecurity&quot;: { # Guardrail that blocks the conversation if the input is considered unsafe based on the LLM classification. # Optional. Guardrail that blocks the conversation if the prompt is considered unsafe based on the LLM classification.
186 &quot;customPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Use a user-defined LlmPolicy to configure the security guardrail.
187 &quot;allowShortUtterance&quot;: True or False, # 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.
188 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
189 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
190 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
191 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
192 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
193 },
194 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
195 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
196 },
197 &quot;defaultSettings&quot;: { # Configuration for default system security settings. # Optional. Use the system&#x27;s predefined default security settings. To select this mode, include an empty &#x27;default_settings&#x27; message in the request. The &#x27;default_prompt_template&#x27; field within will be populated by the server in the response.
198 &quot;defaultPromptTemplate&quot;: &quot;A String&quot;, # Output only. The default prompt template used by the system. This field is for display purposes to show the user what prompt the system uses by default. It is OUTPUT_ONLY.
199 },
200 &quot;failOpen&quot;: True or False, # Optional. Determines the behavior when the guardrail encounters an LLM error. - If true: the guardrail is bypassed. - If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy&#x27;s &#x27;fail_open&#x27; configuration.
201 },
202 &quot;modelSafety&quot;: { # Model safety settings overrides. When this is set, it will override the default settings and trigger the guardrail if the response is considered unsafe. # Optional. Guardrail that blocks the conversation if the LLM response is considered unsafe based on the model safety settings.
203 &quot;safetySettings&quot;: [ # Required. List of safety settings.
204 { # Safety setting.
205 &quot;category&quot;: &quot;A String&quot;, # Required. The harm category.
206 &quot;threshold&quot;: &quot;A String&quot;, # Required. The harm block threshold.
207 },
208 ],
209 },
210 &quot;name&quot;: &quot;A String&quot;, # Identifier. The unique identifier of the guardrail. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
211 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was last updated.
212 }
213
214 guardrailId: string, Optional. The ID to use for the guardrail, which will become the final component of the guardrail&#x27;s resource name. If not provided, a unique ID will be automatically assigned for the guardrail.
215 x__xgafv: string, V1 error format.
216 Allowed values
217 1 - v1 error format
218 2 - v2 error format
219
220 Returns:
221 An object of the form:
222
223 { # Guardrail contains a list of checks and balances to keep the agents safe and secure.
224 &quot;action&quot;: { # Action that is taken when a certain precondition is met. # Optional. Action to take when the guardrail is triggered.
225 &quot;generativeAnswer&quot;: { # The agent will immediately respond with a generative answer. # Optional. Respond with a generative answer.
226 &quot;prompt&quot;: &quot;A String&quot;, # Required. The prompt to use for the generative answer.
227 },
228 &quot;respondImmediately&quot;: { # The agent will immediately respond with a preconfigured response. # Optional. Immediately respond with a preconfigured response.
229 &quot;responses&quot;: [ # Required. The canned responses for the agent to choose from. The response is chosen randomly.
230 { # Represents a response from the agent.
231 &quot;disabled&quot;: True or False, # Optional. Whether the response is disabled. Disabled responses are not used by the agent.
232 &quot;text&quot;: &quot;A String&quot;, # Required. Text for the agent to respond with.
233 },
234 ],
235 },
236 &quot;transferAgent&quot;: { # The agent will transfer the conversation to a different agent. # Optional. Transfer the conversation to a different agent.
237 &quot;agent&quot;: &quot;A String&quot;, # Required. The name of the agent to transfer the conversation to. The agent must be in the same app as the current agent. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
238 },
239 },
240 &quot;codeCallback&quot;: { # Guardrail that blocks the conversation based on the code callbacks provided. # Optional. Guardrail that potentially blocks the conversation based on the result of the callback execution.
241 &quot;afterAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
242 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
243 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
244 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
245 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
246 },
247 &quot;afterModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
248 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
249 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
250 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
251 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
252 },
253 &quot;beforeAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
254 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
255 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
256 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
257 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
258 },
259 &quot;beforeModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
260 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
261 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
262 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
263 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
264 },
265 },
266 &quot;contentFilter&quot;: { # Guardrail that bans certain content from being used in the conversation. # Optional. Guardrail that bans certain content from being used in the conversation.
267 &quot;bannedContents&quot;: [ # Optional. List of banned phrases. Applies to both user inputs and agent responses.
268 &quot;A String&quot;,
269 ],
270 &quot;bannedContentsInAgentResponse&quot;: [ # Optional. List of banned phrases. Applies only to agent responses.
271 &quot;A String&quot;,
272 ],
273 &quot;bannedContentsInUserInput&quot;: [ # Optional. List of banned phrases. Applies only to user inputs.
274 &quot;A String&quot;,
275 ],
276 &quot;disregardDiacritics&quot;: True or False, # Optional. If true, diacritics are ignored during matching.
277 &quot;matchType&quot;: &quot;A String&quot;, # Required. Match type for the content filter.
278 },
279 &quot;createTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was created.
280 &quot;description&quot;: &quot;A String&quot;, # Optional. Description of the guardrail.
281 &quot;displayName&quot;: &quot;A String&quot;, # Required. Display name of the guardrail.
282 &quot;enabled&quot;: True or False, # Optional. Whether the guardrail is enabled.
283 &quot;etag&quot;: &quot;A String&quot;, # Etag used to ensure the object hasn&#x27;t changed during a read-modify-write operation. If the etag is empty, the update will overwrite any concurrent changes.
284 &quot;llmPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
285 &quot;allowShortUtterance&quot;: True or False, # 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.
286 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
287 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
288 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
289 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
290 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
291 },
292 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
293 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
294 },
295 &quot;llmPromptSecurity&quot;: { # Guardrail that blocks the conversation if the input is considered unsafe based on the LLM classification. # Optional. Guardrail that blocks the conversation if the prompt is considered unsafe based on the LLM classification.
296 &quot;customPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Use a user-defined LlmPolicy to configure the security guardrail.
297 &quot;allowShortUtterance&quot;: True or False, # 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.
298 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
299 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
300 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
301 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
302 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
303 },
304 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
305 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
306 },
307 &quot;defaultSettings&quot;: { # Configuration for default system security settings. # Optional. Use the system&#x27;s predefined default security settings. To select this mode, include an empty &#x27;default_settings&#x27; message in the request. The &#x27;default_prompt_template&#x27; field within will be populated by the server in the response.
308 &quot;defaultPromptTemplate&quot;: &quot;A String&quot;, # Output only. The default prompt template used by the system. This field is for display purposes to show the user what prompt the system uses by default. It is OUTPUT_ONLY.
309 },
310 &quot;failOpen&quot;: True or False, # Optional. Determines the behavior when the guardrail encounters an LLM error. - If true: the guardrail is bypassed. - If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy&#x27;s &#x27;fail_open&#x27; configuration.
311 },
312 &quot;modelSafety&quot;: { # Model safety settings overrides. When this is set, it will override the default settings and trigger the guardrail if the response is considered unsafe. # Optional. Guardrail that blocks the conversation if the LLM response is considered unsafe based on the model safety settings.
313 &quot;safetySettings&quot;: [ # Required. List of safety settings.
314 { # Safety setting.
315 &quot;category&quot;: &quot;A String&quot;, # Required. The harm category.
316 &quot;threshold&quot;: &quot;A String&quot;, # Required. The harm block threshold.
317 },
318 ],
319 },
320 &quot;name&quot;: &quot;A String&quot;, # Identifier. The unique identifier of the guardrail. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
321 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was last updated.
322 }</pre>
323 </div>
324
325 <div class="method">
326 <code class="details" id="delete">delete(name, etag=None, force=None, x__xgafv=None)</code>
327 <pre>Deletes the specified guardrail.
328
329 Args:
330 name: string, Required. The resource name of the guardrail to delete. (required)
331 etag: string, Optional. The current etag of the guardrail. If an etag is not provided, the deletion will overwrite any concurrent changes. If an etag is provided and does not match the current etag of the guardrail, deletion will be blocked and an ABORTED error will be returned.
332 force: boolean, Optional. Indicates whether to forcefully delete the guardrail, even if it is still referenced by app/agents. * If `force = false`, the deletion fails if any apps/agents still reference the guardrail. * If `force = true`, all existing references from apps/agents will be removed and the guardrail will be deleted.
333 x__xgafv: string, V1 error format.
334 Allowed values
335 1 - v1 error format
336 2 - v2 error format
337
338 Returns:
339 An object of the form:
340
341 { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
342 }</pre>
343 </div>
344
345 <div class="method">
346 <code class="details" id="get">get(name, x__xgafv=None)</code>
347 <pre>Gets details of the specified guardrail.
348
349 Args:
350 name: string, Required. The resource name of the guardrail to retrieve. (required)
351 x__xgafv: string, V1 error format.
352 Allowed values
353 1 - v1 error format
354 2 - v2 error format
355
356 Returns:
357 An object of the form:
358
359 { # Guardrail contains a list of checks and balances to keep the agents safe and secure.
360 &quot;action&quot;: { # Action that is taken when a certain precondition is met. # Optional. Action to take when the guardrail is triggered.
361 &quot;generativeAnswer&quot;: { # The agent will immediately respond with a generative answer. # Optional. Respond with a generative answer.
362 &quot;prompt&quot;: &quot;A String&quot;, # Required. The prompt to use for the generative answer.
363 },
364 &quot;respondImmediately&quot;: { # The agent will immediately respond with a preconfigured response. # Optional. Immediately respond with a preconfigured response.
365 &quot;responses&quot;: [ # Required. The canned responses for the agent to choose from. The response is chosen randomly.
366 { # Represents a response from the agent.
367 &quot;disabled&quot;: True or False, # Optional. Whether the response is disabled. Disabled responses are not used by the agent.
368 &quot;text&quot;: &quot;A String&quot;, # Required. Text for the agent to respond with.
369 },
370 ],
371 },
372 &quot;transferAgent&quot;: { # The agent will transfer the conversation to a different agent. # Optional. Transfer the conversation to a different agent.
373 &quot;agent&quot;: &quot;A String&quot;, # Required. The name of the agent to transfer the conversation to. The agent must be in the same app as the current agent. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
374 },
375 },
376 &quot;codeCallback&quot;: { # Guardrail that blocks the conversation based on the code callbacks provided. # Optional. Guardrail that potentially blocks the conversation based on the result of the callback execution.
377 &quot;afterAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
378 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
379 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
380 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
381 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
382 },
383 &quot;afterModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
384 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
385 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
386 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
387 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
388 },
389 &quot;beforeAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
390 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
391 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
392 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
393 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
394 },
395 &quot;beforeModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
396 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
397 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
398 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
399 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
400 },
401 },
402 &quot;contentFilter&quot;: { # Guardrail that bans certain content from being used in the conversation. # Optional. Guardrail that bans certain content from being used in the conversation.
403 &quot;bannedContents&quot;: [ # Optional. List of banned phrases. Applies to both user inputs and agent responses.
404 &quot;A String&quot;,
405 ],
406 &quot;bannedContentsInAgentResponse&quot;: [ # Optional. List of banned phrases. Applies only to agent responses.
407 &quot;A String&quot;,
408 ],
409 &quot;bannedContentsInUserInput&quot;: [ # Optional. List of banned phrases. Applies only to user inputs.
410 &quot;A String&quot;,
411 ],
412 &quot;disregardDiacritics&quot;: True or False, # Optional. If true, diacritics are ignored during matching.
413 &quot;matchType&quot;: &quot;A String&quot;, # Required. Match type for the content filter.
414 },
415 &quot;createTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was created.
416 &quot;description&quot;: &quot;A String&quot;, # Optional. Description of the guardrail.
417 &quot;displayName&quot;: &quot;A String&quot;, # Required. Display name of the guardrail.
418 &quot;enabled&quot;: True or False, # Optional. Whether the guardrail is enabled.
419 &quot;etag&quot;: &quot;A String&quot;, # Etag used to ensure the object hasn&#x27;t changed during a read-modify-write operation. If the etag is empty, the update will overwrite any concurrent changes.
420 &quot;llmPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
421 &quot;allowShortUtterance&quot;: True or False, # 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.
422 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
423 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
424 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
425 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
426 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
427 },
428 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
429 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
430 },
431 &quot;llmPromptSecurity&quot;: { # Guardrail that blocks the conversation if the input is considered unsafe based on the LLM classification. # Optional. Guardrail that blocks the conversation if the prompt is considered unsafe based on the LLM classification.
432 &quot;customPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Use a user-defined LlmPolicy to configure the security guardrail.
433 &quot;allowShortUtterance&quot;: True or False, # 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.
434 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
435 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
436 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
437 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
438 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
439 },
440 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
441 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
442 },
443 &quot;defaultSettings&quot;: { # Configuration for default system security settings. # Optional. Use the system&#x27;s predefined default security settings. To select this mode, include an empty &#x27;default_settings&#x27; message in the request. The &#x27;default_prompt_template&#x27; field within will be populated by the server in the response.
444 &quot;defaultPromptTemplate&quot;: &quot;A String&quot;, # Output only. The default prompt template used by the system. This field is for display purposes to show the user what prompt the system uses by default. It is OUTPUT_ONLY.
445 },
446 &quot;failOpen&quot;: True or False, # Optional. Determines the behavior when the guardrail encounters an LLM error. - If true: the guardrail is bypassed. - If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy&#x27;s &#x27;fail_open&#x27; configuration.
447 },
448 &quot;modelSafety&quot;: { # Model safety settings overrides. When this is set, it will override the default settings and trigger the guardrail if the response is considered unsafe. # Optional. Guardrail that blocks the conversation if the LLM response is considered unsafe based on the model safety settings.
449 &quot;safetySettings&quot;: [ # Required. List of safety settings.
450 { # Safety setting.
451 &quot;category&quot;: &quot;A String&quot;, # Required. The harm category.
452 &quot;threshold&quot;: &quot;A String&quot;, # Required. The harm block threshold.
453 },
454 ],
455 },
456 &quot;name&quot;: &quot;A String&quot;, # Identifier. The unique identifier of the guardrail. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
457 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was last updated.
458 }</pre>
459 </div>
460
461 <div class="method">
462 <code class="details" id="list">list(parent, filter=None, orderBy=None, pageSize=None, pageToken=None, x__xgafv=None)</code>
463 <pre>Lists guardrails in the given app.
464
465 Args:
466 parent: string, Required. The resource name of the app to list guardrails from. (required)
467 filter: string, Optional. Filter to be applied when listing the guardrails. See https://google.aip.dev/160 for more details.
468 orderBy: string, Optional. Field to sort by. Only &quot;name&quot; and &quot;create_time&quot; is supported. See https://google.aip.dev/132#ordering for more details.
469 pageSize: integer, Optional. Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.
470 pageToken: string, Optional. The next_page_token value returned from a previous list AgentService.ListGuardrails call.
471 x__xgafv: string, V1 error format.
472 Allowed values
473 1 - v1 error format
474 2 - v2 error format
475
476 Returns:
477 An object of the form:
478
479 { # Response message for AgentService.ListGuardrails.
480 &quot;guardrails&quot;: [ # The list of guardrails.
481 { # Guardrail contains a list of checks and balances to keep the agents safe and secure.
482 &quot;action&quot;: { # Action that is taken when a certain precondition is met. # Optional. Action to take when the guardrail is triggered.
483 &quot;generativeAnswer&quot;: { # The agent will immediately respond with a generative answer. # Optional. Respond with a generative answer.
484 &quot;prompt&quot;: &quot;A String&quot;, # Required. The prompt to use for the generative answer.
485 },
486 &quot;respondImmediately&quot;: { # The agent will immediately respond with a preconfigured response. # Optional. Immediately respond with a preconfigured response.
487 &quot;responses&quot;: [ # Required. The canned responses for the agent to choose from. The response is chosen randomly.
488 { # Represents a response from the agent.
489 &quot;disabled&quot;: True or False, # Optional. Whether the response is disabled. Disabled responses are not used by the agent.
490 &quot;text&quot;: &quot;A String&quot;, # Required. Text for the agent to respond with.
491 },
492 ],
493 },
494 &quot;transferAgent&quot;: { # The agent will transfer the conversation to a different agent. # Optional. Transfer the conversation to a different agent.
495 &quot;agent&quot;: &quot;A String&quot;, # Required. The name of the agent to transfer the conversation to. The agent must be in the same app as the current agent. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
496 },
497 },
498 &quot;codeCallback&quot;: { # Guardrail that blocks the conversation based on the code callbacks provided. # Optional. Guardrail that potentially blocks the conversation based on the result of the callback execution.
499 &quot;afterAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
500 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
501 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
502 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
503 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
504 },
505 &quot;afterModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
506 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
507 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
508 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
509 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
510 },
511 &quot;beforeAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
512 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
513 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
514 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
515 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
516 },
517 &quot;beforeModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
518 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
519 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
520 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
521 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
522 },
523 },
524 &quot;contentFilter&quot;: { # Guardrail that bans certain content from being used in the conversation. # Optional. Guardrail that bans certain content from being used in the conversation.
525 &quot;bannedContents&quot;: [ # Optional. List of banned phrases. Applies to both user inputs and agent responses.
526 &quot;A String&quot;,
527 ],
528 &quot;bannedContentsInAgentResponse&quot;: [ # Optional. List of banned phrases. Applies only to agent responses.
529 &quot;A String&quot;,
530 ],
531 &quot;bannedContentsInUserInput&quot;: [ # Optional. List of banned phrases. Applies only to user inputs.
532 &quot;A String&quot;,
533 ],
534 &quot;disregardDiacritics&quot;: True or False, # Optional. If true, diacritics are ignored during matching.
535 &quot;matchType&quot;: &quot;A String&quot;, # Required. Match type for the content filter.
536 },
537 &quot;createTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was created.
538 &quot;description&quot;: &quot;A String&quot;, # Optional. Description of the guardrail.
539 &quot;displayName&quot;: &quot;A String&quot;, # Required. Display name of the guardrail.
540 &quot;enabled&quot;: True or False, # Optional. Whether the guardrail is enabled.
541 &quot;etag&quot;: &quot;A String&quot;, # Etag used to ensure the object hasn&#x27;t changed during a read-modify-write operation. If the etag is empty, the update will overwrite any concurrent changes.
542 &quot;llmPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
543 &quot;allowShortUtterance&quot;: True or False, # 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.
544 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
545 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
546 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
547 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
548 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
549 },
550 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
551 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
552 },
553 &quot;llmPromptSecurity&quot;: { # Guardrail that blocks the conversation if the input is considered unsafe based on the LLM classification. # Optional. Guardrail that blocks the conversation if the prompt is considered unsafe based on the LLM classification.
554 &quot;customPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Use a user-defined LlmPolicy to configure the security guardrail.
555 &quot;allowShortUtterance&quot;: True or False, # 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.
556 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
557 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
558 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
559 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
560 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
561 },
562 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
563 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
564 },
565 &quot;defaultSettings&quot;: { # Configuration for default system security settings. # Optional. Use the system&#x27;s predefined default security settings. To select this mode, include an empty &#x27;default_settings&#x27; message in the request. The &#x27;default_prompt_template&#x27; field within will be populated by the server in the response.
566 &quot;defaultPromptTemplate&quot;: &quot;A String&quot;, # Output only. The default prompt template used by the system. This field is for display purposes to show the user what prompt the system uses by default. It is OUTPUT_ONLY.
567 },
568 &quot;failOpen&quot;: True or False, # Optional. Determines the behavior when the guardrail encounters an LLM error. - If true: the guardrail is bypassed. - If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy&#x27;s &#x27;fail_open&#x27; configuration.
569 },
570 &quot;modelSafety&quot;: { # Model safety settings overrides. When this is set, it will override the default settings and trigger the guardrail if the response is considered unsafe. # Optional. Guardrail that blocks the conversation if the LLM response is considered unsafe based on the model safety settings.
571 &quot;safetySettings&quot;: [ # Required. List of safety settings.
572 { # Safety setting.
573 &quot;category&quot;: &quot;A String&quot;, # Required. The harm category.
574 &quot;threshold&quot;: &quot;A String&quot;, # Required. The harm block threshold.
575 },
576 ],
577 },
578 &quot;name&quot;: &quot;A String&quot;, # Identifier. The unique identifier of the guardrail. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
579 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was last updated.
580 },
581 ],
582 &quot;nextPageToken&quot;: &quot;A String&quot;, # A token that can be sent as ListGuardrailsRequest.page_token to retrieve the next page. Absence of this field indicates there are no subsequent pages.
583 }</pre>
584 </div>
585
586 <div class="method">
587 <code class="details" id="list_next">list_next()</code>
588 <pre>Retrieves the next page of results.
589
590 Args:
591 previous_request: The request for the previous page. (required)
592 previous_response: The response from the request for the previous page. (required)
593
594 Returns:
595 A request object that you can call &#x27;execute()&#x27; on to request the next
596 page. Returns None if there are no more items in the collection.
597 </pre>
598 </div>
599
600 <div class="method">
601 <code class="details" id="patch">patch(name, body=None, updateMask=None, x__xgafv=None)</code>
602 <pre>Updates the specified guardrail.
603
604 Args:
605 name: string, Identifier. The unique identifier of the guardrail. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}` (required)
606 body: object, The request body.
607 The object takes the form of:
608
609 { # Guardrail contains a list of checks and balances to keep the agents safe and secure.
610 &quot;action&quot;: { # Action that is taken when a certain precondition is met. # Optional. Action to take when the guardrail is triggered.
611 &quot;generativeAnswer&quot;: { # The agent will immediately respond with a generative answer. # Optional. Respond with a generative answer.
612 &quot;prompt&quot;: &quot;A String&quot;, # Required. The prompt to use for the generative answer.
613 },
614 &quot;respondImmediately&quot;: { # The agent will immediately respond with a preconfigured response. # Optional. Immediately respond with a preconfigured response.
615 &quot;responses&quot;: [ # Required. The canned responses for the agent to choose from. The response is chosen randomly.
616 { # Represents a response from the agent.
617 &quot;disabled&quot;: True or False, # Optional. Whether the response is disabled. Disabled responses are not used by the agent.
618 &quot;text&quot;: &quot;A String&quot;, # Required. Text for the agent to respond with.
619 },
620 ],
621 },
622 &quot;transferAgent&quot;: { # The agent will transfer the conversation to a different agent. # Optional. Transfer the conversation to a different agent.
623 &quot;agent&quot;: &quot;A String&quot;, # Required. The name of the agent to transfer the conversation to. The agent must be in the same app as the current agent. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
624 },
625 },
626 &quot;codeCallback&quot;: { # Guardrail that blocks the conversation based on the code callbacks provided. # Optional. Guardrail that potentially blocks the conversation based on the result of the callback execution.
627 &quot;afterAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
628 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
629 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
630 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
631 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
632 },
633 &quot;afterModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
634 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
635 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
636 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
637 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
638 },
639 &quot;beforeAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
640 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
641 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
642 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
643 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
644 },
645 &quot;beforeModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
646 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
647 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
648 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
649 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
650 },
651 },
652 &quot;contentFilter&quot;: { # Guardrail that bans certain content from being used in the conversation. # Optional. Guardrail that bans certain content from being used in the conversation.
653 &quot;bannedContents&quot;: [ # Optional. List of banned phrases. Applies to both user inputs and agent responses.
654 &quot;A String&quot;,
655 ],
656 &quot;bannedContentsInAgentResponse&quot;: [ # Optional. List of banned phrases. Applies only to agent responses.
657 &quot;A String&quot;,
658 ],
659 &quot;bannedContentsInUserInput&quot;: [ # Optional. List of banned phrases. Applies only to user inputs.
660 &quot;A String&quot;,
661 ],
662 &quot;disregardDiacritics&quot;: True or False, # Optional. If true, diacritics are ignored during matching.
663 &quot;matchType&quot;: &quot;A String&quot;, # Required. Match type for the content filter.
664 },
665 &quot;createTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was created.
666 &quot;description&quot;: &quot;A String&quot;, # Optional. Description of the guardrail.
667 &quot;displayName&quot;: &quot;A String&quot;, # Required. Display name of the guardrail.
668 &quot;enabled&quot;: True or False, # Optional. Whether the guardrail is enabled.
669 &quot;etag&quot;: &quot;A String&quot;, # Etag used to ensure the object hasn&#x27;t changed during a read-modify-write operation. If the etag is empty, the update will overwrite any concurrent changes.
670 &quot;llmPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
671 &quot;allowShortUtterance&quot;: True or False, # 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.
672 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
673 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
674 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
675 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
676 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
677 },
678 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
679 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
680 },
681 &quot;llmPromptSecurity&quot;: { # Guardrail that blocks the conversation if the input is considered unsafe based on the LLM classification. # Optional. Guardrail that blocks the conversation if the prompt is considered unsafe based on the LLM classification.
682 &quot;customPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Use a user-defined LlmPolicy to configure the security guardrail.
683 &quot;allowShortUtterance&quot;: True or False, # 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.
684 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
685 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
686 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
687 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
688 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
689 },
690 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
691 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
692 },
693 &quot;defaultSettings&quot;: { # Configuration for default system security settings. # Optional. Use the system&#x27;s predefined default security settings. To select this mode, include an empty &#x27;default_settings&#x27; message in the request. The &#x27;default_prompt_template&#x27; field within will be populated by the server in the response.
694 &quot;defaultPromptTemplate&quot;: &quot;A String&quot;, # Output only. The default prompt template used by the system. This field is for display purposes to show the user what prompt the system uses by default. It is OUTPUT_ONLY.
695 },
696 &quot;failOpen&quot;: True or False, # Optional. Determines the behavior when the guardrail encounters an LLM error. - If true: the guardrail is bypassed. - If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy&#x27;s &#x27;fail_open&#x27; configuration.
697 },
698 &quot;modelSafety&quot;: { # Model safety settings overrides. When this is set, it will override the default settings and trigger the guardrail if the response is considered unsafe. # Optional. Guardrail that blocks the conversation if the LLM response is considered unsafe based on the model safety settings.
699 &quot;safetySettings&quot;: [ # Required. List of safety settings.
700 { # Safety setting.
701 &quot;category&quot;: &quot;A String&quot;, # Required. The harm category.
702 &quot;threshold&quot;: &quot;A String&quot;, # Required. The harm block threshold.
703 },
704 ],
705 },
706 &quot;name&quot;: &quot;A String&quot;, # Identifier. The unique identifier of the guardrail. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
707 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was last updated.
708 }
709
710 updateMask: string, Optional. Field mask is used to control which fields get updated. If the mask is not present, all fields will be updated.
711 x__xgafv: string, V1 error format.
712 Allowed values
713 1 - v1 error format
714 2 - v2 error format
715
716 Returns:
717 An object of the form:
718
719 { # Guardrail contains a list of checks and balances to keep the agents safe and secure.
720 &quot;action&quot;: { # Action that is taken when a certain precondition is met. # Optional. Action to take when the guardrail is triggered.
721 &quot;generativeAnswer&quot;: { # The agent will immediately respond with a generative answer. # Optional. Respond with a generative answer.
722 &quot;prompt&quot;: &quot;A String&quot;, # Required. The prompt to use for the generative answer.
723 },
724 &quot;respondImmediately&quot;: { # The agent will immediately respond with a preconfigured response. # Optional. Immediately respond with a preconfigured response.
725 &quot;responses&quot;: [ # Required. The canned responses for the agent to choose from. The response is chosen randomly.
726 { # Represents a response from the agent.
727 &quot;disabled&quot;: True or False, # Optional. Whether the response is disabled. Disabled responses are not used by the agent.
728 &quot;text&quot;: &quot;A String&quot;, # Required. Text for the agent to respond with.
729 },
730 ],
731 },
732 &quot;transferAgent&quot;: { # The agent will transfer the conversation to a different agent. # Optional. Transfer the conversation to a different agent.
733 &quot;agent&quot;: &quot;A String&quot;, # Required. The name of the agent to transfer the conversation to. The agent must be in the same app as the current agent. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
734 },
735 },
736 &quot;codeCallback&quot;: { # Guardrail that blocks the conversation based on the code callbacks provided. # Optional. Guardrail that potentially blocks the conversation based on the result of the callback execution.
737 &quot;afterAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
738 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
739 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
740 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
741 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
742 },
743 &quot;afterModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute after the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
744 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
745 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
746 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
747 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
748 },
749 &quot;beforeAgentCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the agent is called. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
750 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
751 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
752 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
753 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
754 },
755 &quot;beforeModelCallback&quot;: { # A callback defines the custom logic to be executed at various stages of agent interaction. # Optional. The callback to execute before the model is called. If there are multiple calls to the model, the callback will be executed multiple times. Each callback function is expected to return a structure (e.g., a dict or object) containing at least: - &#x27;decision&#x27;: Either &#x27;OK&#x27; or &#x27;TRIGGER&#x27;. - &#x27;reason&#x27;: A string explaining the decision. A &#x27;TRIGGER&#x27; decision may halt further processing.
756 &quot;description&quot;: &quot;A String&quot;, # Optional. Human-readable description of the callback.
757 &quot;disabled&quot;: True or False, # Optional. Whether the callback is disabled. Disabled callbacks are ignored by the agent.
758 &quot;proactiveExecutionEnabled&quot;: True or False, # Optional. If enabled, the callback will also be executed on intermediate model outputs. This setting only affects after model callback. **ENABLE WITH CAUTION**. Typically after model callback only needs to be executed after receiving all model responses. Enabling proactive execution may have negative implication on the execution cost and latency, and should only be enabled in rare situations.
759 &quot;pythonCode&quot;: &quot;A String&quot;, # Required. The python code to execute for the callback.
760 },
761 },
762 &quot;contentFilter&quot;: { # Guardrail that bans certain content from being used in the conversation. # Optional. Guardrail that bans certain content from being used in the conversation.
763 &quot;bannedContents&quot;: [ # Optional. List of banned phrases. Applies to both user inputs and agent responses.
764 &quot;A String&quot;,
765 ],
766 &quot;bannedContentsInAgentResponse&quot;: [ # Optional. List of banned phrases. Applies only to agent responses.
767 &quot;A String&quot;,
768 ],
769 &quot;bannedContentsInUserInput&quot;: [ # Optional. List of banned phrases. Applies only to user inputs.
770 &quot;A String&quot;,
771 ],
772 &quot;disregardDiacritics&quot;: True or False, # Optional. If true, diacritics are ignored during matching.
773 &quot;matchType&quot;: &quot;A String&quot;, # Required. Match type for the content filter.
774 },
775 &quot;createTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was created.
776 &quot;description&quot;: &quot;A String&quot;, # Optional. Description of the guardrail.
777 &quot;displayName&quot;: &quot;A String&quot;, # Required. Display name of the guardrail.
778 &quot;enabled&quot;: True or False, # Optional. Whether the guardrail is enabled.
779 &quot;etag&quot;: &quot;A String&quot;, # Etag used to ensure the object hasn&#x27;t changed during a read-modify-write operation. If the etag is empty, the update will overwrite any concurrent changes.
780 &quot;llmPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
781 &quot;allowShortUtterance&quot;: True or False, # 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.
782 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
783 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
784 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
785 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
786 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
787 },
788 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
789 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
790 },
791 &quot;llmPromptSecurity&quot;: { # Guardrail that blocks the conversation if the input is considered unsafe based on the LLM classification. # Optional. Guardrail that blocks the conversation if the prompt is considered unsafe based on the LLM classification.
792 &quot;customPolicy&quot;: { # Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. # Optional. Use a user-defined LlmPolicy to configure the security guardrail.
793 &quot;allowShortUtterance&quot;: True or False, # 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.
794 &quot;failOpen&quot;: True or False, # Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
795 &quot;maxConversationMessages&quot;: 42, # Optional. When checking this policy, consider the last &#x27;n&#x27; messages in the conversation. When not set a default value of 10 will be used.
796 &quot;modelSettings&quot;: { # Model settings contains various configurations for the LLM model. # Optional. Model settings.
797 &quot;model&quot;: &quot;A String&quot;, # Optional. The LLM model that the agent should use. If not set, the agent will inherit the model from its parent agent.
798 &quot;temperature&quot;: 3.14, # Optional. If set, this temperature will be used for the LLM model. Temperature controls the randomness of the model&#x27;s responses. Lower temperatures produce responses that are more predictable. Higher temperatures produce responses that are more creative.
799 },
800 &quot;policyScope&quot;: &quot;A String&quot;, # 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.
801 &quot;prompt&quot;: &quot;A String&quot;, # Required. Policy prompt.
802 },
803 &quot;defaultSettings&quot;: { # Configuration for default system security settings. # Optional. Use the system&#x27;s predefined default security settings. To select this mode, include an empty &#x27;default_settings&#x27; message in the request. The &#x27;default_prompt_template&#x27; field within will be populated by the server in the response.
804 &quot;defaultPromptTemplate&quot;: &quot;A String&quot;, # Output only. The default prompt template used by the system. This field is for display purposes to show the user what prompt the system uses by default. It is OUTPUT_ONLY.
805 },
806 &quot;failOpen&quot;: True or False, # Optional. Determines the behavior when the guardrail encounters an LLM error. - If true: the guardrail is bypassed. - If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy&#x27;s &#x27;fail_open&#x27; configuration.
807 },
808 &quot;modelSafety&quot;: { # Model safety settings overrides. When this is set, it will override the default settings and trigger the guardrail if the response is considered unsafe. # Optional. Guardrail that blocks the conversation if the LLM response is considered unsafe based on the model safety settings.
809 &quot;safetySettings&quot;: [ # Required. List of safety settings.
810 { # Safety setting.
811 &quot;category&quot;: &quot;A String&quot;, # Required. The harm category.
812 &quot;threshold&quot;: &quot;A String&quot;, # Required. The harm block threshold.
813 },
814 ],
815 },
816 &quot;name&quot;: &quot;A String&quot;, # Identifier. The unique identifier of the guardrail. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
817 &quot;updateTime&quot;: &quot;A String&quot;, # Output only. Timestamp when the guardrail was last updated.
818 }</pre>
819 </div>
820
821 </body></html>