openai

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginTitle   = "rtp-agent.plugins.openai"
	PluginVersion = "v0.4.2"
	PluginPackage = "rtp-agent.plugins.openai"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LLM added in v0.4.2

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

func NewAzureOpenAILLM added in v0.0.15

func NewAzureOpenAILLM(model, azureEndpoint, azureDeployment, apiVersion, apiKey, azureADToken string, opts ...LLMOption) (*LLM, error)

func NewCerebrasOpenAILLM added in v0.0.19

func NewCerebrasOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewCometAPIOpenAILLM added in v0.0.19

func NewCometAPIOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewDeepSeekOpenAILLM added in v0.0.19

func NewDeepSeekOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewFireworksOpenAILLM added in v0.0.19

func NewFireworksOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewLLM added in v0.4.2

func NewLLM(apiKey string, model string, opts ...LLMOption) (*LLM, error)

func NewLettaOpenAILLM added in v0.0.19

func NewLettaOpenAILLM(agentID, baseURL, apiKey string, opts ...LLMOption) (*LLM, error)

func NewNebiusOpenAILLM added in v0.0.19

func NewNebiusOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewOVHCloudOpenAILLM added in v0.0.19

func NewOVHCloudOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewOctoAIOpenAILLM added in v0.0.19

func NewOctoAIOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewOllamaOpenAILLM added in v0.0.19

func NewOllamaOpenAILLM(model string, opts ...LLMOption) *LLM

func NewOpenAILLM deprecated

func NewOpenAILLM(apiKey string, model string, opts ...LLMOption) (*LLM, error)

Deprecated: use NewLLM.

func NewOpenAILLMWithBaseURL

func NewOpenAILLMWithBaseURL(apiKey string, model string, baseURL string, opts ...LLMOption) *LLM

func NewOpenAILLMWithBaseURLAndHTTPClient added in v0.0.15

func NewOpenAILLMWithBaseURLAndHTTPClient(apiKey string, model string, baseURL string, httpClient openai.HTTPDoer, opts ...LLMOption) *LLM

func NewOpenRouterLLM added in v0.0.15

func NewOpenRouterLLM(apiKey, model string, opts ...OpenRouterLLMOption) (*LLM, error)

func NewOpenRouterLLMWithHTTPClient added in v0.0.15

func NewOpenRouterLLMWithHTTPClient(apiKey, model string, httpClient openai.HTTPDoer, opts ...OpenRouterLLMOption) (*LLM, error)

func NewPerplexityOpenAILLM added in v0.0.19

func NewPerplexityOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewSambaNovaOpenAILLM added in v0.0.19

func NewSambaNovaOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewTelnyxOpenAILLM added in v0.0.19

func NewTelnyxOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewTogetherOpenAILLM added in v0.0.19

func NewTogetherOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func NewXAIOpenAILLM added in v0.0.19

func NewXAIOpenAILLM(model, apiKey string, opts ...LLMOption) (*LLM, error)

func (*LLM) Chat added in v0.4.2

func (l *LLM) Chat(ctx context.Context, chatCtx *llm.ChatContext, opts ...llm.ChatOption) (llm.LLMStream, error)

func (*LLM) Close added in v0.4.2

func (l *LLM) Close() error

func (*LLM) Model added in v0.4.2

func (l *LLM) Model() string

func (*LLM) Provider added in v0.4.2

func (l *LLM) Provider() string

type LLMOption added in v0.4.2

type LLMOption func(*LLM)

func WithOpenAILLMAzureADTokenProvider added in v0.1.2

func WithOpenAILLMAzureADTokenProvider(provider func(context.Context) (string, error)) LLMOption

func WithOpenAILLMAzureBaseURL added in v0.1.2

func WithOpenAILLMAzureBaseURL(baseURL string) LLMOption

func WithOpenAILLMAzureTimeout added in v0.1.2

func WithOpenAILLMAzureTimeout(timeout time.Duration) LLMOption

func WithOpenAILLMDefaultReasoning added in v0.1.0

func WithOpenAILLMDefaultReasoning(defaultReasoning bool) LLMOption

func WithOpenAILLMExtraBody added in v0.0.15

func WithOpenAILLMExtraBody(body map[string]any) LLMOption

func WithOpenAILLMExtraHeaders added in v0.0.15

func WithOpenAILLMExtraHeaders(headers map[string]string) LLMOption

func WithOpenAILLMExtraParams added in v0.1.0

func WithOpenAILLMExtraParams(params map[string]any) LLMOption

func WithOpenAILLMExtraQuery added in v0.0.15

func WithOpenAILLMExtraQuery(query map[string]string) LLMOption

func WithOpenAILLMMaxCompletionTokens added in v0.0.15

func WithOpenAILLMMaxCompletionTokens(maxCompletionTokens int) LLMOption

func WithOpenAILLMMaxRetries added in v0.1.3

func WithOpenAILLMMaxRetries(maxRetries int) LLMOption

func WithOpenAILLMMetadata added in v0.0.15

func WithOpenAILLMMetadata(metadata map[string]string) LLMOption

func WithOpenAILLMOrganization added in v0.1.2

func WithOpenAILLMOrganization(organization string) LLMOption

func WithOpenAILLMParallelToolCalls added in v0.0.15

func WithOpenAILLMParallelToolCalls(parallelToolCalls bool) LLMOption

func WithOpenAILLMProject added in v0.1.2

func WithOpenAILLMProject(project string) LLMOption

func WithOpenAILLMPromptCacheKey added in v0.0.15

func WithOpenAILLMPromptCacheKey(promptCacheKey string) LLMOption

func WithOpenAILLMPromptCacheRetention added in v0.0.15

func WithOpenAILLMPromptCacheRetention(promptCacheRetention string) LLMOption

func WithOpenAILLMReasoning added in v0.1.2

func WithOpenAILLMReasoning(reasoning map[string]any) LLMOption

func WithOpenAILLMReasoningEffort added in v0.0.15

func WithOpenAILLMReasoningEffort(reasoningEffort string) LLMOption

func WithOpenAILLMSafetyIdentifier added in v0.0.15

func WithOpenAILLMSafetyIdentifier(safetyIdentifier string) LLMOption

func WithOpenAILLMServiceTier added in v0.0.15

func WithOpenAILLMServiceTier(serviceTier string) LLMOption

func WithOpenAILLMStore added in v0.0.15

func WithOpenAILLMStore(store bool) LLMOption

func WithOpenAILLMStrictToolSchema added in v0.0.19

func WithOpenAILLMStrictToolSchema(strict bool) LLMOption

func WithOpenAILLMTemperature added in v0.0.15

func WithOpenAILLMTemperature(temperature float64) LLMOption

func WithOpenAILLMTimeout added in v0.1.3

func WithOpenAILLMTimeout(timeout time.Duration) LLMOption

func WithOpenAILLMToolChoice added in v0.0.15

func WithOpenAILLMToolChoice(toolChoice llm.ToolChoice) LLMOption

func WithOpenAILLMTopP added in v0.0.15

func WithOpenAILLMTopP(topP float64) LLMOption

func WithOpenAILLMUser added in v0.0.15

func WithOpenAILLMUser(user string) LLMOption

func WithOpenAILLMVerbosity added in v0.0.15

func WithOpenAILLMVerbosity(verbosity string) LLMOption

type OpenAILLM deprecated

type OpenAILLM = LLM

Deprecated: use LLM.

type OpenAILLMOption deprecated added in v0.0.15

type OpenAILLMOption = LLMOption

Deprecated: use LLMOption.

type OpenAIRealtimeFunctionCallFilter added in v0.1.0

type OpenAIRealtimeFunctionCallFilter func([]llm.Tool, string) bool

type OpenAIRealtimeInputTranscriptionFinalHook added in v0.1.0

type OpenAIRealtimeInputTranscriptionFinalHook func(*llm.ChatMessage, *llm.InputTranscriptionCompleted)

type OpenAIRealtimeOption deprecated added in v0.0.15

type OpenAIRealtimeOption = RealtimeOption

Deprecated: use RealtimeOption.

type OpenAIRealtimeRemoteItemAddedHook added in v0.1.0

type OpenAIRealtimeRemoteItemAddedHook func(*llm.RemoteChatContext, *llm.RemoteItemAddedEvent)

type OpenAIRealtimeSessionCloseMetricsHook added in v0.1.0

type OpenAIRealtimeSessionCloseMetricsHook func(time.Duration) *telemetry.RealtimeModelMetrics

type OpenAIRealtimeToolFormatter added in v0.1.0

type OpenAIRealtimeToolFormatter func([]llm.Tool) []map[string]any

type OpenAIRealtimeWebsocketDialer added in v0.1.0

type OpenAIRealtimeWebsocketDialer func(string, http.Header) (*websocket.Conn, *http.Response, error)

type OpenAISTT deprecated

type OpenAISTT = STT

Deprecated: use STT.

type OpenAISTTOption deprecated added in v0.0.15

type OpenAISTTOption = STTOption

Deprecated: use STTOption.

type OpenAITTS deprecated

type OpenAITTS = TTS

Deprecated: use TTS.

type OpenAITTSOption deprecated added in v0.0.15

type OpenAITTSOption = TTSOption

Deprecated: use TTSOption.

type OpenRouterLLMOption added in v0.0.15

type OpenRouterLLMOption func(*openRouterLLMOptions)

func WithOpenRouterAppName added in v0.0.15

func WithOpenRouterAppName(appName string) OpenRouterLLMOption

func WithOpenRouterFallbackModels added in v0.0.15

func WithOpenRouterFallbackModels(models []string) OpenRouterLLMOption

func WithOpenRouterLLMOptions added in v0.0.15

func WithOpenRouterLLMOptions(opts ...LLMOption) OpenRouterLLMOption

func WithOpenRouterPlugins added in v0.0.15

func WithOpenRouterPlugins(plugins []map[string]any) OpenRouterLLMOption

func WithOpenRouterProvider added in v0.0.15

func WithOpenRouterProvider(provider map[string]any) OpenRouterLLMOption

func WithOpenRouterSiteURL added in v0.0.15

func WithOpenRouterSiteURL(siteURL string) OpenRouterLLMOption

type RealtimeModel

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

func NewAzureOpenAIRealtimeModel added in v0.1.0

func NewAzureOpenAIRealtimeModel(model, azureEndpoint, azureDeployment, apiVersion, apiKey, azureADToken string, opts ...RealtimeOption) (*RealtimeModel, error)

func NewRealtimeModel

func NewRealtimeModel(apiKey, model string, opts ...RealtimeOption) *RealtimeModel

func (*RealtimeModel) Capabilities added in v0.0.15

func (m *RealtimeModel) Capabilities() llm.RealtimeCapabilities

func (*RealtimeModel) Close added in v0.0.15

func (m *RealtimeModel) Close() error

func (*RealtimeModel) Model added in v0.0.15

func (m *RealtimeModel) Model() string

func (*RealtimeModel) Provider added in v0.0.15

func (m *RealtimeModel) Provider() string

func (*RealtimeModel) Session

func (m *RealtimeModel) Session() (llm.RealtimeSession, error)

func (*RealtimeModel) UpdateOptions added in v0.0.15

func (m *RealtimeModel) UpdateOptions(options llm.RealtimeSessionOptions) error

type RealtimeOption added in v0.4.2

type RealtimeOption func(*openAIRealtimeModelOptions)

func WithOpenAIRealtimeBaseURL added in v0.0.15

func WithOpenAIRealtimeBaseURL(baseURL string) RealtimeOption

func WithOpenAIRealtimeConnectOptions added in v0.1.0

func WithOpenAIRealtimeConnectOptions(connectOptions llm.APIConnectOptions) RealtimeOption

func WithOpenAIRealtimeFunctionCallFilter added in v0.1.0

func WithOpenAIRealtimeFunctionCallFilter(filter OpenAIRealtimeFunctionCallFilter) RealtimeOption

func WithOpenAIRealtimeInputAudioNoiseReduction added in v0.0.15

func WithOpenAIRealtimeInputAudioNoiseReduction(noiseReduction any) RealtimeOption

func WithOpenAIRealtimeInputAudioTranscription added in v0.0.15

func WithOpenAIRealtimeInputAudioTranscription(transcription any) RealtimeOption

func WithOpenAIRealtimeInputTranscriptionFinalHook added in v0.1.0

func WithOpenAIRealtimeInputTranscriptionFinalHook(hook OpenAIRealtimeInputTranscriptionFinalHook) RealtimeOption

func WithOpenAIRealtimeMaxResponseOutputTokens added in v0.0.15

func WithOpenAIRealtimeMaxResponseOutputTokens(tokens any) RealtimeOption

func WithOpenAIRealtimeMaxSessionDuration added in v0.1.0

func WithOpenAIRealtimeMaxSessionDuration(duration time.Duration) RealtimeOption

func WithOpenAIRealtimeModalities added in v0.0.15

func WithOpenAIRealtimeModalities(modalities []string) RealtimeOption

func WithOpenAIRealtimeReasoning added in v0.1.0

func WithOpenAIRealtimeReasoning(reasoning any) RealtimeOption

func WithOpenAIRealtimeRemoteItemAddedHook added in v0.1.0

func WithOpenAIRealtimeRemoteItemAddedHook(hook OpenAIRealtimeRemoteItemAddedHook) RealtimeOption

func WithOpenAIRealtimeSessionCloseMetricsHook added in v0.1.0

func WithOpenAIRealtimeSessionCloseMetricsHook(hook OpenAIRealtimeSessionCloseMetricsHook) RealtimeOption

func WithOpenAIRealtimeSpeed added in v0.0.15

func WithOpenAIRealtimeSpeed(speed float64) RealtimeOption

func WithOpenAIRealtimeToolChoice added in v0.0.15

func WithOpenAIRealtimeToolChoice(toolChoice llm.ToolChoice) RealtimeOption

func WithOpenAIRealtimeToolFormatter added in v0.1.0

func WithOpenAIRealtimeToolFormatter(formatter OpenAIRealtimeToolFormatter) RealtimeOption

func WithOpenAIRealtimeTracing added in v0.0.15

func WithOpenAIRealtimeTracing(tracing any) RealtimeOption

func WithOpenAIRealtimeTruncation added in v0.0.15

func WithOpenAIRealtimeTruncation(truncation any) RealtimeOption

func WithOpenAIRealtimeTurnDetection added in v0.0.15

func WithOpenAIRealtimeTurnDetection(turnDetection any) RealtimeOption

func WithOpenAIRealtimeVoice added in v0.0.15

func WithOpenAIRealtimeVoice(voice string) RealtimeOption

func WithOpenAIRealtimeWebsocketDialer added in v0.1.0

func WithOpenAIRealtimeWebsocketDialer(dialer OpenAIRealtimeWebsocketDialer) RealtimeOption

type STT added in v0.4.2

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

func NewAzureOpenAISTT added in v0.0.15

func NewAzureOpenAISTT(model, azureEndpoint, azureDeployment, apiVersion, apiKey, azureADToken string, opts ...STTOption) (*STT, error)

func NewOVHCloudOpenAISTT added in v0.0.19

func NewOVHCloudOpenAISTT(model, apiKey string, opts ...STTOption) (*STT, error)

func NewOpenAISTT deprecated

func NewOpenAISTT(apiKey string, model string, opts ...STTOption) (*STT, error)

Deprecated: use NewSTT.

func NewSTT added in v0.4.2

func NewSTT(apiKey string, model string, opts ...STTOption) (*STT, error)

func (*STT) Capabilities added in v0.4.2

func (s *STT) Capabilities() stt.STTCapabilities

func (*STT) Close added in v0.4.2

func (s *STT) Close() error

func (*STT) Label added in v0.4.2

func (s *STT) Label() string

func (*STT) Model added in v0.4.2

func (s *STT) Model() string

func (*STT) Provider added in v0.4.2

func (s *STT) Provider() string

func (*STT) Recognize added in v0.4.2

func (s *STT) Recognize(ctx context.Context, frames []*model.AudioFrame, language string) (*stt.SpeechEvent, error)

func (*STT) Stream added in v0.4.2

func (s *STT) Stream(ctx context.Context, language string) (stt.RecognizeStream, error)

func (*STT) UpdateOptions added in v0.4.2

func (s *STT) UpdateOptions(opts ...STTOption)

type STTOption added in v0.4.2

type STTOption func(*STT)

func WithOpenAISTTAzureADTokenProvider added in v0.1.4

func WithOpenAISTTAzureADTokenProvider(provider func(context.Context) (string, error)) STTOption

func WithOpenAISTTBaseURL added in v0.0.15

func WithOpenAISTTBaseURL(baseURL string) STTOption

func WithOpenAISTTConnectOptions added in v0.1.0

func WithOpenAISTTConnectOptions(connectOptions llm.APIConnectOptions) STTOption

func WithOpenAISTTDetectLanguage added in v0.0.15

func WithOpenAISTTDetectLanguage(detect bool) STTOption

func WithOpenAISTTHTTPClient added in v0.1.3

func WithOpenAISTTHTTPClient(client openai.HTTPDoer) STTOption

func WithOpenAISTTLanguage added in v0.0.15

func WithOpenAISTTLanguage(language string) STTOption

func WithOpenAISTTModel added in v0.0.15

func WithOpenAISTTModel(model string) STTOption

func WithOpenAISTTNoiseReductionType added in v0.0.15

func WithOpenAISTTNoiseReductionType(noiseReductionType string) STTOption

func WithOpenAISTTOrganization added in v0.1.4

func WithOpenAISTTOrganization(organization string) STTOption

func WithOpenAISTTProject added in v0.1.4

func WithOpenAISTTProject(project string) STTOption

func WithOpenAISTTPrompt added in v0.0.15

func WithOpenAISTTPrompt(prompt string) STTOption

func WithOpenAISTTRealtime added in v0.0.15

func WithOpenAISTTRealtime(useRealtime bool) STTOption

func WithOpenAISTTTurnDetection added in v0.0.15

func WithOpenAISTTTurnDetection(turnDetection map[string]interface{}) STTOption

func WithOpenAISTTVAD added in v0.1.0

func WithOpenAISTTVAD(v vad.VAD) STTOption

type TTS added in v0.4.2

type TTS struct {
	tts.MetricsEmitter
	// contains filtered or unexported fields
}

func NewAzureOpenAITTS added in v0.0.15

func NewAzureOpenAITTS(model openai.SpeechModel, voice openai.SpeechVoice, azureEndpoint, azureDeployment, apiVersion, apiKey, azureADToken string, opts ...TTSOption) (*TTS, error)

func NewOpenAITTS deprecated

func NewOpenAITTS(apiKey string, model openai.SpeechModel, voice openai.SpeechVoice, opts ...TTSOption) (*TTS, error)

Deprecated: use NewTTS.

func NewTTS added in v0.4.2

func NewTTS(apiKey string, model openai.SpeechModel, voice openai.SpeechVoice, opts ...TTSOption) (*TTS, error)

func (*TTS) Capabilities added in v0.4.2

func (t *TTS) Capabilities() tts.TTSCapabilities

func (*TTS) Close added in v0.4.2

func (t *TTS) Close() error

func (*TTS) Label added in v0.4.2

func (t *TTS) Label() string

func (*TTS) Model added in v0.4.2

func (t *TTS) Model() string

func (*TTS) NumChannels added in v0.4.2

func (t *TTS) NumChannels() int

func (*TTS) Prewarm added in v0.4.2

func (t *TTS) Prewarm()

func (*TTS) Provider added in v0.4.2

func (t *TTS) Provider() string

func (*TTS) SampleRate added in v0.4.2

func (t *TTS) SampleRate() int

func (*TTS) Stream added in v0.4.2

func (t *TTS) Stream(ctx context.Context) (tts.SynthesizeStream, error)

func (*TTS) Synthesize added in v0.4.2

func (t *TTS) Synthesize(ctx context.Context, text string) (tts.ChunkedStream, error)

func (*TTS) UpdateOptions added in v0.4.2

func (t *TTS) UpdateOptions(opts ...TTSOption)

type TTSOption added in v0.4.2

type TTSOption func(*TTS)

func WithOpenAITTSAzureADTokenProvider added in v0.1.4

func WithOpenAITTSAzureADTokenProvider(provider func(context.Context) (string, error)) TTSOption

func WithOpenAITTSBaseURL added in v0.0.15

func WithOpenAITTSBaseURL(baseURL string) TTSOption

func WithOpenAITTSInstructions added in v0.0.15

func WithOpenAITTSInstructions(instructions string) TTSOption

func WithOpenAITTSModel added in v0.0.15

func WithOpenAITTSModel(model openai.SpeechModel) TTSOption

func WithOpenAITTSOrganization added in v0.1.4

func WithOpenAITTSOrganization(organization string) TTSOption

func WithOpenAITTSProject added in v0.1.4

func WithOpenAITTSProject(project string) TTSOption

func WithOpenAITTSResponseFormat added in v0.0.15

func WithOpenAITTSResponseFormat(format openai.SpeechResponseFormat) TTSOption

func WithOpenAITTSSpeed added in v0.0.15

func WithOpenAITTSSpeed(speed float64) TTSOption

func WithOpenAITTSVoice added in v0.0.15

func WithOpenAITTSVoice(voice openai.SpeechVoice) TTSOption

Jump to

Keyboard shortcuts

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