Skip to navigation

Need

View as MarkdownOpen in Claude

Raise Need from an operation’s prepare(), or from an identify() find function, when something it needs wasn’t said. Nothing is proposed. The model is told what to ask, and keeps what the caller already gave for the next call. When the operation has guidance, the call moves to the operation’s own step.

from signalwire.operations import Need

Parameters

ask
strRequired

The question to ask the caller, in the operation’s words.

fields
Sequence[str]Defaults to ()

The fields still missing.

Example

from signalwire.operations import Change, Field, Need, Operation
class Order(Operation):
"""Order a coffee."""
size = Field(str, "Small, medium or large.", required=False)
def prepare(self, call, f):
if not f.size:
raise Need("Which size would they like: small, medium or large?", ["size"])
return Change(read_back=f"One {f.size} coffee. Shall I?", touches=["order:new"])