openai

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBaseURL is the default OpenAI API endpoint
	DefaultBaseURL = "https://api.openai.com/v1"
)

Variables

This section is empty.

Functions

func NewModel

func NewModel(modelName string, cfg *Config) (model.LLM, error)

NewModel returns github.com/sjzsdu/adk-go-cn/model.LLM, backed by the OpenAI API.

It uses the provided modelName and configuration to initialize the underlying HTTP client for OpenAI API calls.

An error is returned if the configuration is invalid.

Types

type Config

type Config struct {
	// APIKey is the OpenAI API key. If empty, it will be read from OPENAI_API_KEY environment variable.
	APIKey string
	// BaseURL is the OpenAI API base URL. If empty, it will use DefaultBaseURL.
	BaseURL string
	// Organization is the OpenAI organization ID.
	Organization string
	// HTTPClient is the HTTP client to use. If nil, http.DefaultClient will be used.
	HTTPClient *http.Client
}

Config holds the configuration for OpenAI model initialization.

Jump to

Keyboard shortcuts

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