realtime

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package realtime provides realtime session implementations (OpenAI Realtime API and shim). RealtimeSession (SendText, SendAudio, Events, Close) and RealtimeService (NewSession) align with OpenAI Realtime and WebSocket session abstractions: a long-lived bidirectional session over WebSocket with event-driven input/output. OpenAIRealtimeAPI uses the official OpenAI Realtime WebSocket API; use realtime.NewFromConfig(cfg, "openai") to construct it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromConfig

func NewFromConfig(cfg *config.Config, provider string) (services.RealtimeService, error)

NewFromConfig returns a RealtimeService for the given provider, or an error if unsupported. Provider should be one of services.SupportedRealtimeProviders (e.g. "openai", "hume", "inworld"). This lives in the realtime package to avoid an import cycle (services -> realtime -> services).

Types

type OpenAIRealtime

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

OpenAIRealtime provides a minimal OpenAI-backed implementation of services.RealtimeService. It builds on the existing LLM and STT services rather than the dedicated OpenAI Realtime API, but exposes a compatible interface that can be upgraded later.

func NewOpenAIRealtime

func NewOpenAIRealtime(apiKey, model string) *OpenAIRealtime

NewOpenAIRealtime constructs an OpenAIRealtime provider using the given API key and model. If apiKey or model are empty, the defaults from NewService and NewOpenAI are used.

func (*OpenAIRealtime) NewSession

NewSession creates a new realtime session. The RealtimeConfig is currently used only for model overrides; provider/voice/tools are accepted for future compatibility.

type OpenAIRealtimeAPI

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

OpenAIRealtimeAPI implements services.RealtimeService using the official OpenAI Realtime WebSocket API. It corresponds to the Python openai_realtime service: single WebSocket, response.audio_transcript.done and response.audio.delta events mapped to RealtimeEvent (Text/Audio).

func NewOpenAIRealtimeAPI

func NewOpenAIRealtimeAPI(apiKey, model string) *OpenAIRealtimeAPI

NewOpenAIRealtimeAPI creates a Realtime service that uses the OpenAI Realtime API (WebSocket).

func (*OpenAIRealtimeAPI) NewSession

NewSession opens a WebSocket to the Realtime API and returns a session.

Jump to

Keyboard shortcuts

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