openai

package
v0.28.13 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

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

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

type OpenAIEmbedClient

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

func (*OpenAIEmbedClient) Embed

func (c *OpenAIEmbedClient) Embed(ctx context.Context, prompt string) ([]float64, error)

type OpenAIPromptClient

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

func (*OpenAIPromptClient) Chat

func (*OpenAIPromptClient) Prompt

func (c *OpenAIPromptClient) Prompt(ctx context.Context, systemInstruction string, temperature float32, prompt string) (string, error)

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) 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)

Jump to

Keyboard shortcuts

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