llm

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAPIKey

func WithAPIKey(apiKey string) opt

func WithBaseURL

func WithBaseURL(baseURL string) opt

func WithModel

func WithModel(model string) opt

func WithProvider

func WithProvider(provider string) opt

Types

type ChatRequest

type ChatRequest struct {
	SystemPrompt string
	Prompt       Message
	Transcript   []Message
}

ChatRequest captures a normalized chat request for LLM providers.

type LLM

type LLM interface {
	Complete(ctx context.Context, req ChatRequest) (Message, error)
}

LLM defines the interface for language model providers. It abstracts away provider-specific details and allows for interchangeable implementations.

func NewLLM

func NewLLM(opts ...opt) (LLM, error)

NewLLM builds an LLM based on the supplied configuration.

type Message

type Message struct {
	Role      Role
	Content   string
	Timestamp time.Time
}

Message is a transcript entry exchanged within a session.

type Role

type Role string

Role represents the speaker of a message.

const (
	RoleUser      Role = "user"
	RoleAssistant Role = "assistant"
	RoleSystem    Role = "system"
)

Jump to

Keyboard shortcuts

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