generate

package
v0.0.0-...-0d8279c Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generate

type Generate struct {
	Context     context.Context
	AIClient    ai.IAI
	AIProvider  string
	PromptName  string
	PromptVars  any
	OutputType  string
	Output      any
	Results     string
	RunningTime string
}

func NewGenerate

func NewGenerate(ctx context.Context, promptName string, promptVars any, outputType string, output any) (*Generate, error)

func (*Generate) BuildPrompt

func (g *Generate) BuildPrompt() ([]llms.MessageContent, error)

BuildPrompt builds the prompt based on the prompt name and variables.

func (*Generate) Generate

func (g *Generate) Generate() error

Generate generates the text based on the prompt.

func (*Generate) GenerateFileName

func (g *Generate) GenerateFileName() string

GenerateFileName generates the file name based on the prompt variables.

func (*Generate) GetFileSuffix

func (g *Generate) GetFileSuffix() string

GetFileSuffix returns the file suffix based on the output format.

func (*Generate) GetOutputFile

func (g *Generate) GetOutputFile() string

GetOutputFile returns the output file path.

func (*Generate) GetOutputResults

func (g *Generate) GetOutputResults() string

GetOutputResults returns the results.

func (*Generate) SaveAndPrintResults

func (g *Generate) SaveAndPrintResults() error

SaveAndPrintResults saves the results and errors to the files and prints the errors.

func (*Generate) SaveFile

func (g *Generate) SaveFile(filename string, data []byte) error

SaveFile saves the data to the specified file.

Jump to

Keyboard shortcuts

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