Skip to navigation

gateFillers

View as MarkdownOpen in Claude

Set what the AI says while this function’s semantic gates are checked. Only for a function with gates: toSwaigFunction() throws when gate fillers are set and no gate() was added.

Parameters

fillers
FillerPhrasesRequired

Phrases keyed by language code ('en-US'), 'auto' (translated into the call’s language on first use), or 'default'. Shaped like a function’s fillers: each entry is a phrase, or a list of phrases spoken one at a time while the call waits. FillerPhrases is exported from @signalwire/sdk.

Returns

DataMap — Self for method chaining.

Examples

import { DataMap, FunctionResult, SemanticGate } from '@signalwire/sdk';
const cancelOrder = new DataMap('cancel_order')
.purpose("Cancel one of the caller's open orders")
.parameter('order_id', 'string', 'The order number', { required: true })
.gate(
new SemanticGate(
'Has the caller asked in `conversation` to cancel the order in `proposed_function`?',
0.9,
'cancel_order was not run. Ask the caller which order to cancel.',
),
)
.gateFillers({ 'en-US': ['Let me check that.', 'One moment.'] })
.webhook('POST', 'https://api.example.com/orders/${enc:args.order_id}/cancel')
.output(new FunctionResult('The order is cancelled. Tell the caller.'));