lib

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuickQueryFromEnv

func QuickQueryFromEnv(ctx context.Context, prompt, systemPrompt string) (string, error)

QuickQueryFromEnv performs a single query using environment configuration

func StructuredQueryFromEnv

func StructuredQueryFromEnv(ctx context.Context, prompt, systemPrompt string, target interface{}) error

StructuredQueryFromEnv performs a structured query using OpenAI's native structured outputs

Types

type Config

type Config struct {
	Model     openai.ChatModel
	MaxTokens int
}

Config holds configuration for the AI client

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration

func NewClientFromEnv

func NewClientFromEnv() (*openai.Client, *Config, error)

NewClientFromEnv creates an OpenAI client from environment variables

type Conversation

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

Conversation manages a multi-turn conversation with the AI

func NewConversation

func NewConversation(client *openai.Client, config *Config, systemPrompt string) *Conversation

NewConversation creates a new conversation with a system prompt

func (*Conversation) GetHistory

func (c *Conversation) GetHistory() []Message

GetHistory returns the conversation history as a slice of Messages

func (*Conversation) Reset

func (c *Conversation) Reset()

Reset clears the conversation history except for the system message

func (*Conversation) SendMessage

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

SendMessage sends a user message and returns the AI's response

type Message

type Message struct {
	Role    string
	Content string
}

Message represents a single message in a conversation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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