openaichat

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package openaichat is a reference client emulator for the OpenAI Chat Completions API (legacy OpenAI-compatible chat surface), using github.com/openai/openai-go/v3.

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 wraps the SDK chat completions surface.

func New

func New(cfg Config) *Client

New builds a Chat Completions reference client.

func (*Client) CreateChatCompletion

func (c *Client) CreateChatCompletion(ctx context.Context, body openai.ChatCompletionNewParams) (*openai.ChatCompletion, error)

CreateChatCompletion calls POST /v1/chat/completions (non-streaming).

func (*Client) CreateChatCompletionStream

func (c *Client) CreateChatCompletionStream(ctx context.Context, body openai.ChatCompletionNewParams) *ssestream.Stream[openai.ChatCompletionChunk]

CreateChatCompletionStream calls chat/completions with stream: true.

type Config

type Config struct {
	BaseURL    string
	APIKey     string
	HTTPClient *http.Client
	// DisableSDKRetries, when true, sets MaxRetries to 0 for deterministic refbackend errors.
	DisableSDKRetries bool
}

Config configures the official OpenAI Go client (base URL must include the /v1 prefix).

Jump to

Keyboard shortcuts

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