function

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package function provides function-based generators for Augustus.

These generators wrap user-provided functions that generate responses. Two variants are supported:

  • Single: functions that return a single response regardless of n
  • Multiple: functions that accept n and return n responses

This is designed for programmatic use, not CLI invocation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMultiple

func NewMultiple(cfg registry.Config) (generators.Generator, error)

NewMultiple creates a new Multiple generator from configuration.

func NewSingle

func NewSingle(cfg registry.Config) (generators.Generator, error)

NewSingle creates a new Single generator from configuration.

Types

type Multiple

type Multiple struct {
	types.UsageCounter // embedded but never incremented: in-process function returns no token usage.
	// contains filtered or unexported fields
}

Multiple is a generator that wraps a user-provided function for multiple responses. The function is called with the n parameter and should return n responses.

func (*Multiple) ClearHistory

func (m *Multiple) ClearHistory()

ClearHistory is a no-op for function generators (stateless).

func (*Multiple) Description

func (m *Multiple) Description() string

Description returns a human-readable description.

func (*Multiple) Generate

func (m *Multiple) Generate(ctx context.Context, conv *attempt.Conversation, n int) ([]attempt.Message, error)

Generate calls the wrapped function with the n parameter.

func (*Multiple) Name

func (m *Multiple) Name() string

Name returns the generator's fully qualified name.

type MultipleFunc

type MultipleFunc func(string, int) []string

MultipleFunc is the signature for multiple-response generator functions. Takes a prompt string and count n, returns a slice of n strings.

type Single

type Single struct {
	types.UsageCounter // embedded but never incremented: in-process function returns no token usage.
	// contains filtered or unexported fields
}

Single is a generator that wraps a user-provided function for single responses. The function is called once regardless of the n parameter.

func (*Single) ClearHistory

func (s *Single) ClearHistory()

ClearHistory is a no-op for function generators (stateless).

func (*Single) Description

func (s *Single) Description() string

Description returns a human-readable description.

func (*Single) Generate

func (s *Single) Generate(ctx context.Context, conv *attempt.Conversation, n int) ([]attempt.Message, error)

Generate calls the wrapped function and returns the response. The n parameter is ignored (Single does not support multiple generations).

func (*Single) Name

func (s *Single) Name() string

Name returns the generator's fully qualified name.

type SingleFunc

type SingleFunc func(string) []string

SingleFunc is the signature for single-response generator functions. Takes a prompt string and returns a slice of strings (typically with one element).

Jump to

Keyboard shortcuts

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