Documentation
¶
Overview ¶
Package turnend is the client for an acoustic end-of-turn classifier served over HTTP - Smart Turn in the duplex deployment profiles (tools/duplexmodels/turn_server.py, POST /v1/endpoint/smart-turn).
The request body is the most recent user audio as little-endian float32 mono at 16 kHz, at most MaxWindow long and ending at the pause being judged; the response is {"probability": P(turn complete), "model": "..."}. The transcript heard so far travels percent-encoded in TranscriptHeader, so a classifier that reads words (LiveKit's turn detector) or both (a fusion) answers through the same route; an acoustic one ignores it. The classifier never sees audio or words from after the pause, so the evidence is causal.
Index ¶
Constants ¶
const ( // SampleRateHz is the rate the service reads. SampleRateHz = uint32(16_000) // MaxWindow is the most audio sent: Smart Turn reads up to eight seconds. MaxWindow = 8 * time.Second // DefaultTimeout bounds one classification. The call sits on the pause // decision, so a slow classifier costs the user that much waiting. DefaultTimeout = 300 * time.Millisecond // TranscriptHeader carries the percent-encoded transcript of the turn so // far. TranscriptHeader = "X-OpenRealtime-Transcript" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client classifies pauses.
func (*Client) Evaluate ¶
func (client *Client) Evaluate(ctx context.Context, pcm16le []byte, transcript string) (interaction.AcousticEndpoint, error)
Evaluate classifies the pause at the end of pcm16le, which must be 16 kHz mono PCM16, given the transcript of the turn so far (possibly empty). Audio beyond MaxWindow is dropped from the front.