openairt

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiKeyEnvVarNameShort = "OPENAI_KEY"
	ApiKeyEnvVarNameLong  = "OPENAI_API_KEY"
)

Variables

This section is empty.

Functions

func ResamplePCM added in v0.6.0

func ResamplePCM(pcmData []byte, fromRate, toRate int) ([]byte, error)

Types

type Client

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

func New

func New(opts ...ClientOption) *Client

func (*Client) Audio added in v0.2.0

func (c *Client) Audio() io.ReadWriter

Audio returns user audio

func (*Client) CreateResponse

func (c *Client) CreateResponse() error

func (*Client) CreateResponseWithPayload

func (c *Client) CreateResponseWithPayload(p events.ResponseCreatePayload) error

func (*Client) OnError

func (c *Client) OnError(h func(e *events.ErrorEvent))

func (*Client) OnEvent

func (c *Client) OnEvent(h func(e any))

func (*Client) OnToolCall added in v0.2.0

func (c *Client) OnToolCall(h func(name string, args map[string]any) (any, error))

func (*Client) Open

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

func (*Client) Send

func (c *Client) Send(evt any) error

Send sends any kind of event to the websocket

func (*Client) SessionUpdate

func (c *Client) SessionUpdate(session events.SessionUpdate) error

func (*Client) UserInput

func (c *Client) UserInput(text string, respond bool) (err error)

type ClientOption added in v0.2.0

type ClientOption func(*clientConfig)

func WithDefaultLogger added in v0.2.0

func WithDefaultLogger() ClientOption

func WithEnvKey added in v0.2.0

func WithEnvKey(vars ...string) ClientOption

func WithInstruction added in v0.2.0

func WithInstruction(instruction string) ClientOption

func WithKey added in v0.2.0

func WithKey(apiKey string) ClientOption

func WithLanguage added in v0.2.0

func WithLanguage(language string) ClientOption

func WithLogger added in v0.2.0

func WithLogger(logger *slog.Logger) ClientOption

func WithModel added in v0.2.0

func WithModel(model string) ClientOption

func WithOptions added in v0.2.0

func WithOptions(opts ...ClientOption) ClientOption

func WithSampleRate added in v0.5.0

func WithSampleRate(sr int) ClientOption

func WithSpeed added in v0.2.0

func WithSpeed(speed float64) ClientOption

func WithTemperature added in v0.2.0

func WithTemperature(temperature float64) ClientOption

func WithTools added in v0.2.0

func WithTools(tools ...tool.Tool) ClientOption

func WithVoice added in v0.2.0

func WithVoice(voice string) ClientOption

type InterruptEvent

type InterruptEvent struct {
}

type PCMStreamer added in v0.6.0

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

func NewPCMStreamer added in v0.6.0

func NewPCMStreamer(b []byte) *PCMStreamer

func (*PCMStreamer) Err added in v0.6.0

func (s *PCMStreamer) Err() error

func (*PCMStreamer) Stream added in v0.6.0

func (s *PCMStreamer) Stream(samples [][2]float64) (n int, ok bool)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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