runner

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPromptOrPromptPathRequired = errors.New("either prompt or prompt-path must be provided")
	ErrOutpathRewriteConflict     = errors.New("outpath and rewrite cannot be provided together")
	ErrOutpathMultipleFiles       = errors.New("outpath cannot be provided when multiple input files are provided")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Prompt                   string
	PromptPath               string
	PromptOptimize           bool
	Model                    string
	MaxTokens                int
	MaxCompletionRepeatCount int
	DryRun                   bool
	Silent                   bool
	Verbose                  bool
	ShowCost                 bool
	Diff                     bool
	InputFileList            string
	LogAPILevel              string
	Rewrite                  bool
	Outpath                  string
	UseFirstCodeBlock        bool
	Confirm                  bool
}

func (*Config) Validate

func (c *Config) Validate(inputFiles []string) error

Validate checks the configuration for errors.

type ConfirmFunc

type ConfirmFunc func(string) (bool, error)

type GenerativeAIHandlerFactoryFunc

type GenerativeAIHandlerFactoryFunc func(model string) (openai.GenerativeAIClient, error)

type Process

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

func NewProcess

func NewProcess(config *Config, confirmFunc ConfirmFunc) *Process

func (*Process) Run

func (p *Process) Run(ctx context.Context, i int, inputPath string, opt *RunOption, onBeforeProcessing func(string), onAfterProcessing func(string, *steps.ShapeResult)) error

type RunOption

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

RunOption holds options for running the Runner.

type Runner

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

Runner manages the execution of text processing tasks.

func New

func New(config *Config, inputFiles []string, gaiFactory GenerativeAIHandlerFactoryFunc, confirmFunc ConfirmFunc) *Runner

New creates a new Runner instance.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, opt *RunOption, onBeforeProcessing func(string), onAfterProcessing func(string, *steps.ShapeResult)) error

Run processing of multiple input files.

func (*Runner) Setup

func (r *Runner) Setup() (*RunOption, error)

Setup initializes the Runner and returns a RunOption.

Jump to

Keyboard shortcuts

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