Documentation
¶
Index ¶
- Constants
- func ResamplePCM(pcmData []byte, fromRate, toRate int) ([]byte, error)
- type Client
- func (c *Client) Audio() io.ReadWriter
- func (c *Client) CreateResponse() error
- func (c *Client) CreateResponseWithPayload(p events.ResponseCreatePayload) error
- func (c *Client) OnError(h func(e *events.ErrorEvent))
- func (c *Client) OnEvent(h func(e any))
- func (c *Client) OnToolCall(h func(name string, args map[string]any) (any, error))
- func (c *Client) Open(ctx context.Context) error
- func (c *Client) Send(evt any) error
- func (c *Client) SessionUpdate(session events.SessionUpdate) error
- func (c *Client) UserInput(text string, respond bool) (err error)
- type ClientOption
- func WithDefaultLogger() ClientOption
- func WithEnvKey(vars ...string) ClientOption
- func WithInstruction(instruction string) ClientOption
- func WithKey(apiKey string) ClientOption
- func WithLanguage(language string) ClientOption
- func WithLogger(logger *slog.Logger) ClientOption
- func WithModel(model string) ClientOption
- func WithOptions(opts ...ClientOption) ClientOption
- func WithSampleRate(sr int) ClientOption
- func WithSpeed(speed float64) ClientOption
- func WithTemperature(temperature float64) ClientOption
- func WithTools(tools ...tool.Tool) ClientOption
- func WithVoice(voice string) ClientOption
- type InterruptEvent
- type PCMStreamer
Constants ¶
View Source
const ( ApiKeyEnvVarNameShort = "OPENAI_KEY" ApiKeyEnvVarNameLong = "OPENAI_API_KEY" )
Variables ¶
This section is empty.
Functions ¶
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 (*Client) CreateResponseWithPayload ¶
func (c *Client) CreateResponseWithPayload(p events.ResponseCreatePayload) error
func (*Client) OnError ¶
func (c *Client) OnError(h func(e *events.ErrorEvent))
func (*Client) OnToolCall ¶ added in v0.2.0
func (*Client) SessionUpdate ¶
func (c *Client) SessionUpdate(session events.SessionUpdate) 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
Click to show internal directories.
Click to hide internal directories.