usecase

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequest   = errors.New("invalid run request")
	ErrProfileRequired  = errors.New("profile selection is required")
	ErrAPIKeyEnvMissing = errors.New("api_key_env points to an unset environment variable")
	ErrAPIKeyRequired   = errors.New("api key is required")
	ErrPromptLoad       = errors.New("failed to load prompt definition")
	ErrProfileLoad      = errors.New("failed to load execution profile")
	ErrArtifactLoad     = errors.New("failed to load artifact")
	ErrPromptRender     = errors.New("failed to render prompt")
	ErrLLMGenerate      = errors.New("failed to generate output")
	ErrValidation       = errors.New("failed to validate output")
)

Functions

This section is empty.

Types

type BackendResolver added in v0.2.0

type BackendResolver interface {
	GetBackend(string) (domain.Backend, error)
}

BackendResolver resolves one normalized backend ID.

type CapacityError added in v0.4.0

type CapacityError struct {
	BackendID string
}

CapacityError identifies bounded admission rejected for one selected backend.

func (*CapacityError) Error added in v0.4.0

func (e *CapacityError) Error() string

func (*CapacityError) Unwrap added in v0.4.0

func (e *CapacityError) Unwrap() error

type OutputRepairer

type OutputRepairer interface {
	Repair(ctx context.Context, req RepairRequest) (*domain.GenerateResponse, error)
}

func NewDefaultOutputRepairer

func NewDefaultOutputRepairer(llmClient llm.Client) OutputRepairer

type PreparedExecution added in v0.4.0

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

PreparedExecution owns one frozen, single-use runner execution.

func (*PreparedExecution) Details added in v0.4.0

func (p *PreparedExecution) Details() *domain.PreparedRun

Details returns a fresh credential-redacted copy of the prepared run.

func (*PreparedExecution) Discard added in v0.4.0

func (p *PreparedExecution) Discard()

Discard invalidates an unclaimed execution and drops its private payload.

type RepairRequest

type RepairRequest struct {
	PreviousOutput   string
	ValidationErrors []string
	SessionID        string
	Target           domain.ExecutionTarget
	TargetPresence   domain.ExecutionTargetPresence
	StructuredOutput *domain.StructuredOutputSpec
	Attempt          int
	MaxAttempts      int
	Mode             domain.ValidationMode
}

type RunAdmitter added in v0.2.0

type RunAdmitter interface {
	Admit(context.Context, string) (func(), error)
}

RunAdmitter reserves capacity for one resolved backend run.

type Runner

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

Runner executes the Promptkit core use case.

func NewRunner

func NewRunner(
	promptDefs promptdef.Repository,
	profiles profile.Repository,
	backends BackendResolver,
	artifacts artifact.Reader,
	renderer prompt.Renderer,
	llmClient llm.Client,
	validator validate.Validator,
	admitter RunAdmitter,
) *Runner

func NewRunnerWithRepairer

func NewRunnerWithRepairer(
	promptDefs promptdef.Repository,
	profiles profile.Repository,
	backends BackendResolver,
	artifacts artifact.Reader,
	renderer prompt.Renderer,
	llmClient llm.Client,
	validator validate.Validator,
	repairer OutputRepairer,
	admitter RunAdmitter,
) *Runner

func (*Runner) InspectProfile added in v0.4.0

func (r *Runner) InspectProfile(
	ctx context.Context,
	profileID string,
) (*domain.ProfileInspection, error)

InspectProfile resolves one explicit profile without prompt or execution work.

func (*Runner) InspectPrompt added in v0.4.0

func (r *Runner) InspectPrompt(
	ctx context.Context,
	promptID string,
	promptVersion string,
) (*domain.PromptInspection, error)

InspectPrompt resolves one explicit prompt without execution work.

func (*Runner) Prepare

func (r *Runner) Prepare(ctx context.Context, req domain.RunRequest) (*domain.PreparedRun, error)

func (*Runner) PrepareExecution added in v0.4.0

func (r *Runner) PrepareExecution(ctx context.Context, req domain.RunRequest) (*PreparedExecution, error)

PrepareExecution completes preparation without generation or admission and returns a runner-bound, single-use execution.

func (*Runner) Run

func (*Runner) RunPrepared added in v0.4.0

func (r *Runner) RunPrepared(ctx context.Context, prepared *PreparedExecution) (*domain.RunResult, error)

RunPrepared claims and executes one prepared execution owned by this runner.

Jump to

Keyboard shortcuts

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