openai

package
v0.29.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements llm.Provider for the OpenAI Chat Completions API. Compatible with any OpenAI-format endpoint (OpenAI, Azure OpenAI, vLLM, LiteLLM).

func New

func New(apiKey string) *Client

New creates a client with the default OpenAI base URL.

func NewFull added in v0.21.0

func NewFull(name, apiKey, baseURL, organization string) *Client

NewFull creates a named client with all options.

func NewWithBaseURL

func NewWithBaseURL(apiKey, baseURL string) *Client

NewWithBaseURL creates a client with a custom base URL (for Azure, vLLM, etc.).

func NewWithHTTPClient

func NewWithHTTPClient(apiKey, baseURL, organization string, httpClient *http.Client) *Client

NewWithHTTPClient creates a client with a custom HTTP client (for testing).

func (*Client) ChatCompletion

func (c *Client) ChatCompletion(ctx context.Context, req llm.ChatRequest) (*llm.ChatResponse, error)

func (*Client) HealthCheck

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

func (*Client) ListModels added in v0.15.1

func (c *Client) ListModels(ctx context.Context) ([]string, error)

ListModels returns available model IDs from the OpenAI-compatible API.

func (*Client) Name

func (c *Client) Name() string

func (*Client) SupportsStreaming added in v0.16.9

func (c *Client) SupportsStreaming() bool

SupportsStreaming implements llm.StreamingProvider.

Jump to

Keyboard shortcuts

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