openai

package
v1.210.0-test.21 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ProviderName is the name of this provider for configuration lookup.
	ProviderName = "openai"
	// DefaultMaxTokens is the default maximum number of tokens in AI responses.
	DefaultMaxTokens = 4096
	// DefaultModel is the default OpenAI model.
	DefaultModel = "gpt-4o"
	// DefaultAPIKeyEnvVar is the default environment variable name for the API key (used in error hints).
	DefaultAPIKeyEnvVar = "OPENAI_API_KEY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides a simplified interface to the OpenAI API for Atmos.

func NewClient

func NewClient(atmosConfig *schema.AtmosConfiguration) (*Client, error)

NewClient creates a new OpenAI client from Atmos configuration.

func (*Client) GetMaxTokens

func (c *Client) GetMaxTokens() int

GetMaxTokens returns the configured max tokens.

func (*Client) GetModel

func (c *Client) GetModel() string

GetModel returns the configured model name.

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, message string) (string, error)

SendMessage sends a message to the AI and returns the response.

func (*Client) SendMessageWithHistory

func (c *Client) SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)

SendMessageWithHistory sends messages with full conversation history.

func (*Client) SendMessageWithSystemPromptAndTools

func (c *Client) SendMessageWithSystemPromptAndTools(
	ctx context.Context,
	systemPrompt string,
	atmosMemory string,
	messages []types.Message,
	availableTools []tools.Tool,
) (*types.Response, error)

SendMessageWithSystemPromptAndTools sends messages with system prompt, conversation history, and available tools. For OpenAI, caching happens automatically (no explicit cache control needed). The system prompt and atmosMemory are prepended as system messages.

func (*Client) SendMessageWithTools

func (c *Client) SendMessageWithTools(ctx context.Context, message string, availableTools []tools.Tool) (*types.Response, error)

SendMessageWithTools sends a message with available tools.

func (*Client) SendMessageWithToolsAndHistory

func (c *Client) SendMessageWithToolsAndHistory(ctx context.Context, messages []types.Message, availableTools []tools.Tool) (*types.Response, error)

SendMessageWithToolsAndHistory sends messages with full conversation history and available tools.

Jump to

Keyboard shortcuts

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