llm

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelProvider

type ModelProvider interface {
	Generate(prompt string) (string, error)
	ToolCall(prompt string) (string, error)
	Stream(prompt string) (<-chan string, error)
}

ModelProvider defines the interface for AI generation in the real runtime.

type OpenAIProvider

type OpenAIProvider struct {
	APIKey     string
	HTTPClient *http.Client
}

OpenAIProvider connects to the OpenAI API for completions.

func NewOpenAIProvider

func NewOpenAIProvider(apiKey string) *OpenAIProvider

NewOpenAIProvider creates a new real OpenAI provider.

func (*OpenAIProvider) Generate

func (p *OpenAIProvider) Generate(prompt string) (string, error)

Generate sends a prompt to OpenAI and gets a full text response.

func (*OpenAIProvider) Stream

func (p *OpenAIProvider) Stream(prompt string) (<-chan string, error)

Stream sends a streaming request to OpenAI and yields chunks.

func (*OpenAIProvider) ToolCall

func (p *OpenAIProvider) ToolCall(prompt string) (string, error)

ToolCall executes the prompt and forces output to match a tool JSON format.

Jump to

Keyboard shortcuts

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