openai

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 10 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.ChatModel for OpenAI's /chat/completions endpoint.

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient constructs a client with sane defaults.

func (*Client) Chat

Chat executes a chat completion request against OpenAI.

func (*Client) Name

func (c *Client) Name() string

func (*Client) StreamChat

func (c *Client) StreamChat(ctx context.Context, req protocol.ChatRequest) (protocol.ChatStream, error)

StreamChat uses SSE stream from /chat/completions with stream=true.

type Config

type Config struct {
	APIKey       string
	BaseURL      string
	HTTPClient   *http.Client
	Organization string
	Project      string
}

Config configures the OpenAI-compatible chat client.

Jump to

Keyboard shortcuts

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