Synaptic.Voice.TurnAdmission behaviour (synaptic v0.3.0-alpha.9)

View Source

Normalizes application-owned decisions about whether a final transcript should resume a headless voice workflow or keep the current turn open.

A policy may be a one- or two-argument function, or a module exporting decide/2. Policies return :commit, :keep_listening, or either action paired with an application metadata map. The headless session evaluates the policy asynchronously so network- or model-backed policies do not block the session GenServer.

Summary

Types

action()

@type action() :: :commit | :keep_listening

decision()

@type decision() :: action() | {action(), map()}

result()

@type result() :: {:ok, action(), map()} | {:error, term()}

Callbacks

decide(input, opts)

@callback decide(input :: map(), opts :: keyword()) :: decision()

Functions

evaluate(policy, input, opts \\ [])

@spec evaluate(module() | function(), map(), keyword()) :: result()