llm

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPrompt

func BuildPrompt(target *parser.Target, ctx *vibecontext.Collected, vars map[string]string) string

BuildPrompt constructs the full prompt sent to the LLM for a codegen target. Skills are not included here — they are provided to the model as tools via the Anthropic tool-calling API.

func BuildRetryPrompt

func BuildRetryPrompt(target *parser.Target, ctx *vibecontext.Collected, vars map[string]string, failedScript, errorOutput string) string

BuildRetryPrompt constructs a prompt for retrying a failed script generation.

func SystemPrompt

func SystemPrompt() string

SystemPrompt returns the system prompt for the LLM.

Types

type Client

type Client struct {
	APIKey     string
	Model      string
	HTTPClient *http.Client // used for OpenAI only

	// OnSkillInvoked is called each time the model invokes a skill tool
	// during generation. May be nil.
	OnSkillInvoked func(SkillEvent)
}

Client is an LLM API client that supports Anthropic and OpenAI.

func NewClient

func NewClient(apiKey, model string) *Client

NewClient creates a new LLM client.

func (*Client) Generate

func (c *Client) Generate(systemPrompt, userPrompt string, skills []*skill.SkillInfo) (string, error)

Generate sends the prompt to the LLM and returns the generated shell script. skills may be nil for targets that don't use @skill directives.

type SkillEvent added in v0.0.3

type SkillEvent struct {
	SkillName string // which skill the model invoked
	Iteration int    // which tool-use iteration (1-based)
}

SkillEvent describes a skill-related event during generation.

Jump to

Keyboard shortcuts

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