> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# toDict

> Return the semantic gate as the object sent in the function definition.

[swml-gates]: /docs/swml/reference/calling/ai/swaig/functions/gates

Return the gate as the object sent in the function's `gates` list, in the shape of
the SWML [gate object][swml-gates]. Keys that weren't set (`id`, `criteria`) are
left out.

## Parameters

None.

## Returns

`Record<string, unknown>` -- The gate: `id` (when set), `question`, `criteria`
(when `trueMeans` or `falseMeans` is set), `threshold`, and `on_fail`.

## Examples

```typescript {10}
import { SemanticGate } from '@signalwire/sdk';

const gate = new SemanticGate(
  'Has the caller explicitly asked to cancel their account in `conversation`?',
  0.95,
  'cancel_account was not run. Ask the caller to confirm that they want to cancel.',
  { id: 'explicit_request' },
);

console.log(gate.toDict());
// {
//   id: 'explicit_request',
//   question: 'Has the caller explicitly asked to cancel their account in `conversation`?',
//   threshold: 0.95,
//   on_fail: { response: 'cancel_account was not run. Ask the caller to confirm that they want to cancel.' }
// }
```