Documentation
¶
Overview ¶
Package openai implements the modelrepo.Provider contract against the OpenAI HTTP API and OpenAI-compatible endpoints. The package registers its catalog at init time; depend on it via blank import where the catalog must be discoverable from runtimestate.
Index ¶
- func NewOpenAIProvider(apiKey, modelName string, backendURLs []string, ...) modelrepo.Provider
- type OpenAIChatClient
- type OpenAIEmbedClient
- type OpenAIPromptClient
- type OpenAIProvider
- func (p *OpenAIProvider) CanChat() bool
- func (p *OpenAIProvider) CanEmbed() bool
- func (p *OpenAIProvider) CanPrompt() bool
- func (p *OpenAIProvider) CanStream() bool
- func (p *OpenAIProvider) CanThink() bool
- func (p *OpenAIProvider) GetBackendIDs() []string
- func (p *OpenAIProvider) GetChatConnection(ctx context.Context, backendID string) (modelrepo.LLMChatClient, error)
- func (p *OpenAIProvider) GetContextLength() int
- func (p *OpenAIProvider) GetEmbedConnection(ctx context.Context, backendID string) (modelrepo.LLMEmbedClient, error)
- func (p *OpenAIProvider) GetID() string
- func (p *OpenAIProvider) GetMaxOutputTokens() int
- func (p *OpenAIProvider) GetPromptConnection(ctx context.Context, backendID string) (modelrepo.LLMPromptExecClient, error)
- func (p *OpenAIProvider) GetStreamConnection(ctx context.Context, backendID string) (modelrepo.LLMStreamClient, error)
- func (p *OpenAIProvider) GetType() string
- func (p *OpenAIProvider) ModelName() string
- type OpenAIStreamClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewOpenAIProvider ¶
func NewOpenAIProvider(apiKey, modelName string, backendURLs []string, capability modelrepo.CapabilityConfig, httpClient *http.Client, tracker libtracker.ActivityTracker) modelrepo.Provider
Types ¶
type OpenAIChatClient ¶
type OpenAIChatClient struct {
// contains filtered or unexported fields
}
func (*OpenAIChatClient) Chat ¶
func (c *OpenAIChatClient) Chat(ctx context.Context, messages []modelrepo.Message, args ...modelrepo.ChatArgument) (modelrepo.ChatResult, error)
type OpenAIEmbedClient ¶
type OpenAIEmbedClient struct {
// contains filtered or unexported fields
}
type OpenAIPromptClient ¶
type OpenAIPromptClient struct {
// contains filtered or unexported fields
}
type OpenAIProvider ¶
type OpenAIProvider struct {
// contains filtered or unexported fields
}
func (*OpenAIProvider) CanChat ¶
func (p *OpenAIProvider) CanChat() bool
func (*OpenAIProvider) CanEmbed ¶
func (p *OpenAIProvider) CanEmbed() bool
func (*OpenAIProvider) CanPrompt ¶
func (p *OpenAIProvider) CanPrompt() bool
func (*OpenAIProvider) CanStream ¶
func (p *OpenAIProvider) CanStream() bool
func (*OpenAIProvider) CanThink ¶
func (p *OpenAIProvider) CanThink() bool
func (*OpenAIProvider) GetBackendIDs ¶
func (p *OpenAIProvider) GetBackendIDs() []string
func (*OpenAIProvider) GetChatConnection ¶
func (p *OpenAIProvider) GetChatConnection(ctx context.Context, backendID string) (modelrepo.LLMChatClient, error)
func (*OpenAIProvider) GetContextLength ¶
func (p *OpenAIProvider) GetContextLength() int
func (*OpenAIProvider) GetEmbedConnection ¶
func (p *OpenAIProvider) GetEmbedConnection(ctx context.Context, backendID string) (modelrepo.LLMEmbedClient, error)
func (*OpenAIProvider) GetID ¶
func (p *OpenAIProvider) GetID() string
func (*OpenAIProvider) GetMaxOutputTokens ¶ added in v0.29.0
func (p *OpenAIProvider) GetMaxOutputTokens() int
func (*OpenAIProvider) GetPromptConnection ¶
func (p *OpenAIProvider) GetPromptConnection(ctx context.Context, backendID string) (modelrepo.LLMPromptExecClient, error)
func (*OpenAIProvider) GetStreamConnection ¶
func (p *OpenAIProvider) GetStreamConnection(ctx context.Context, backendID string) (modelrepo.LLMStreamClient, error)
func (*OpenAIProvider) GetType ¶
func (p *OpenAIProvider) GetType() string
func (*OpenAIProvider) ModelName ¶
func (p *OpenAIProvider) ModelName() string
type OpenAIStreamClient ¶
type OpenAIStreamClient struct {
// contains filtered or unexported fields
}
func (*OpenAIStreamClient) Stream ¶
func (c *OpenAIStreamClient) Stream(ctx context.Context, messages []modelrepo.Message, args ...modelrepo.ChatArgument) (<-chan *modelrepo.StreamParcel, error)
Click to show internal directories.
Click to hide internal directories.