inworld

package
v0.0.0-...-86d84e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package inworld is an STT WebSocket client for the Inworld realtime API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a bidirectional streaming STT session (one websocket for the lifetime of the client).

func New

func New(ctx context.Context, cfg *Config) (*Client, error)

New dials Inworld STT with cfg.API.Key as Basic auth credential and configures the session.

func (*Client) Close

func (c *Client) Close() error

Close closes the websocket.

func (*Client) ReadEvent

func (c *Client) ReadEvent(ctx context.Context) (Event, error)

ReadEvent blocks for the next STT message.

func (*Client) SendEndTurn

func (c *Client) SendEndTurn(ctx context.Context) error

SendEndTurn notifies the recognizer that the user finished an utterance.

func (*Client) SendPCMChunk

func (c *Client) SendPCMChunk(ctx context.Context, pcm []byte) error

SendPCMChunk sends one LINEAR16 mono PCM window.

type Config

type Config struct {
	API struct {
		Key string
	}
	STT struct {
		Model string `default:"base"`
	}
}

Config maps INWORLD_* environment keys.

type Event

type Event struct {
	Text         string       `json:"text"`
	IsFinal      bool         `json:"isFinal"`
	VoiceProfile VoiceProfile `json:"voice_profile"`
}

Event is the merged STT transcription event produced from API envelopes.

type VoiceProfile

type VoiceProfile struct {
	Age        []VoiceProfileBucket `json:"age"`
	Accent     []VoiceProfileBucket `json:"accent"`
	Emotion    []VoiceProfileBucket `json:"emotion"`
	VocalStyle []VoiceProfileBucket `json:"vocal_style"`
	Pitch      []VoiceProfileBucket `json:"pitch"`
}

VoiceProfile contains optional categorical facets emitted by STT.

type VoiceProfileBucket

type VoiceProfileBucket struct {
	Label      string  `json:"label"`
	Confidence float64 `json:"confidence"`
}

VoiceProfileBucket is one bucket in a categorical voice facet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL