runner

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoKey = errorutil.New("OPENAI_API_KEY is not configured / provided.")

ErrNoKey is returned when no key is provided

Functions

func GetUpdateCallback

func GetUpdateCallback() func()

GetUpdateCallback returns a callback function that updates aix

Types

type Options

type Options struct {
	OpenaiApiKey       string              `yaml:"openai_api_key"`
	Prompt             string              `yaml:"prompt"`
	Gpt3               bool                `yaml:"gpt3"`
	Gpt4               bool                `yaml:"gpt4"`
	Model              string              `yaml:"model"`
	ListModels         bool                `yaml:"list_models"`
	Update             bool                `yaml:"update"`
	DisableUpdateCheck bool                `yaml:"disable_update_check"`
	Output             string              `yaml:"output"`
	Jsonl              bool                `yaml:"jsonl"`
	Verbose            bool                `yaml:"verbose"`
	Silent             bool                `yaml:"silent"`
	NoColor            bool                `yaml:"no_color"`
	Version            bool                `yaml:"version"`
	Stream             bool                `yaml:"stream"`
	TopP               float32             `yaml:"top_p"`
	Temperature        float32             `yaml:"temperature"`
	System             goflags.StringSlice `yaml:"system"`      // system message if any
	NoMarkdown         bool                `yaml:"no-markdown"` // render markdown message
}

Options contains the configuration options for tuning the enumeration process.

func ParseOptions

func ParseOptions() *Options

ParseOptions parses the command line flags provided by a user

type Result

type Result struct {
	Timestamp        string         `json:"timestamp"`
	Prompt           string         `json:"prompt"`
	Completion       string         `json:"completion"`
	Model            string         `json:"model"`
	CompletionStream *io.PipeReader `json:"-"` // contained stream response

	Error error `json:"-"`
	// contains filtered or unexported fields
}

func (*Result) CloseCompletionStream added in v0.0.3

func (r *Result) CloseCompletionStream()

CloseCompletionStream closes the completion stream

func (*Result) JSON

func (result *Result) JSON() string

func (*Result) SetupStreaming added in v0.0.3

func (r *Result) SetupStreaming()

SetupStreaming sets up the streaming for the result

func (*Result) WriteCompletionStreamResponse added in v0.0.3

func (r *Result) WriteCompletionStreamResponse(data string)

WriteCompletionStreamResponse writes a response to the completion stream

type Runner

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

Runner contains the internal logic of the program

func NewRunner

func NewRunner(options *Options) (*Runner, error)

NewRunner instance

func (*Runner) Run

func (r *Runner) Run() (*Result, error)

Run the instance

Jump to

Keyboard shortcuts

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