cli

package
v0.0.0-...-66bbac4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Flags struct {
	Version VersionFlag `name:"version" help:"Print version information and quit"`

	Complete CompleteCmd `cmd:"complete" short:"c" help:"Complete a prompt"`
	Generate GenerateCmd `cmd:"generate" short:"g" help:"Generate an prompt"`
	TTS      TTSCmd      `cmd:"tts" short:"t" help:"Generate an audio from a prompt"`

	Action ActionCmd `cmd:"" help:"Performs an action"`

	Forget ForgetCmd `cmd:"forget" short:"f" help:"Forget all users"`

	CountTokens CountTokensCmd `cmd:"count-tokens" help:"Count tokens"`

	CreateUser CreateUserCmd `cmd:"create-user" help:"Create a new user"`
	DeleteUser DeleteUserCmd `cmd:"delete-user" help:"Delete a user"`

	ListUsers  ListUsersCmd  `cmd:"list-users" help:"List users"`
	MergeUsers MergeUsersCmd `cmd:"merge-users" help:"Merge users"`

	AddExternalID    AddExternalIDCmd    `cmd:"add-external-id" help:"Add external ID to user"`
	DeleteExternalID DeleteExternalIDCmd `cmd:"delete-external-id" help:"Delete external ID from user"`

	ListMessages ListMessagesCmd `cmd:"list-messages" help:"List messages"`

	CreateAPIKey CreateAPIKeyCmd `cmd:"create-api-key" help:"Create an API key for use with the HTTP interface"`
}

Functions

func Complete

func Complete(ctx context.Context, text string, writer writer_structs.ChloeWriter) error

func Forget

func Forget(ctx context.Context, all bool) error

func Generate

func Generate(ctx context.Context, text string, writer writer_structs.ChloeWriter) error

func Handle

func Handle(ctx context.Context) error

func Start

func Start(ctx context.Context)

func TTS

func TTS(ctx context.Context, text string, writer writer_structs.ChloeWriter) error

Types

type ActionCmd

type ActionCmd struct {
	Action string   `arg:"" help:"Action to perform" enum:"openai,image,latex,math,news,scrape,transcribe,tts,wikipedia,youtube_summarizer"`
	Params []string `arg:"" help:"Parameters for the action"`
}

func (*ActionCmd) Run

func (a *ActionCmd) Run(globals *Globals) error

type AddExternalIDCmd

type AddExternalIDCmd struct {
	UserID     uint   `short:"u" long:"user-id" description:"User ID"`
	ExternalID string `short:"e" long:"external-id" description:"External ID"`
	Interface  string `short:"i" long:"interface" description:"Interface"`
}

func (*AddExternalIDCmd) Run

func (c *AddExternalIDCmd) Run(globals *Globals) error

type CLIWriter

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

func NewCLIWriter

func NewCLIWriter() *CLIWriter

func (*CLIWriter) Close

func (w *CLIWriter) Close() error

func (*CLIWriter) Flush

func (w *CLIWriter) Flush()

func (*CLIWriter) GetObjects

func (*CLIWriter) Header

func (w *CLIWriter) Header() http.Header

func (*CLIWriter) SetPreWriteCallback

func (w *CLIWriter) SetPreWriteCallback(fn func())

func (*CLIWriter) Write

func (w *CLIWriter) Write(p []byte) (n int, err error)

func (*CLIWriter) WriteHeader

func (w *CLIWriter) WriteHeader(int)

func (*CLIWriter) WriteObject

type CompleteCmd

type CompleteCmd struct {
	Prompt []string `arg:"" optional:"" help:"Prompt to complete"`
	Model  string   `short:"m" long:"model" help:"Model to use for completion" default:"gpt-3.5-turbo"`
}

func (*CompleteCmd) Run

func (c *CompleteCmd) Run(globals *Globals) error

type CountTokensCmd

type CountTokensCmd struct {
	Prompt []string `arg:"" help:"Prompt to generate"`
	Model  string   `help:"Model to use" default:"gpt-3.5-turbo"`
}

func (*CountTokensCmd) Run

func (c *CountTokensCmd) Run(globals *Globals) error

type CreateAPIKeyCmd

type CreateAPIKeyCmd struct {
	UserID uint `arg:"" short:"u" long:"user-id" description:"User ID"`
}

func (*CreateAPIKeyCmd) Run

func (c *CreateAPIKeyCmd) Run(globals *Globals) error

type CreateUserCmd

type CreateUserCmd struct {
	Username  string `short:"u" long:"username" description:"Username"`
	FirstName string `short:"f" long:"first-name" description:"First name"`
	LastName  string `short:"l" long:"last-name" description:"Last name"`
}

func (*CreateUserCmd) Run

func (c *CreateUserCmd) Run(globals *Globals) error

type DeleteExternalIDCmd

type DeleteExternalIDCmd struct {
	UserID     uint   `short:"u" long:"user-id" description:"User ID"`
	ExternalID string `short:"e" long:"external-id" description:"External ID"`
	Interface  string `short:"i" long:"interface" description:"Interface"`
}

func (*DeleteExternalIDCmd) Run

func (c *DeleteExternalIDCmd) Run(globals *Globals) error

type DeleteUserCmd

type DeleteUserCmd struct {
	UserID uint `short:"u" long:"user-id" description:"User ID"`
}

func (*DeleteUserCmd) Run

func (c *DeleteUserCmd) Run(globals *Globals) error

type FileWriter

type FileWriter struct {
	Path string
	// contains filtered or unexported fields
}

func NewFileWriter

func NewFileWriter(path string) *FileWriter

func (*FileWriter) Close

func (w *FileWriter) Close() error

func (*FileWriter) Flush

func (w *FileWriter) Flush()

func (*FileWriter) GetObjects

func (*FileWriter) Header

func (w *FileWriter) Header() http.Header

func (*FileWriter) SetPreWriteCallback

func (w *FileWriter) SetPreWriteCallback(fn func())

func (*FileWriter) Write

func (w *FileWriter) Write(p []byte) (n int, err error)

func (*FileWriter) WriteHeader

func (w *FileWriter) WriteHeader(int)

func (*FileWriter) WriteObject

type ForgetCmd

type ForgetCmd struct {
	All bool `help:"Forget all users, not just the CLI user"`
}

func (*ForgetCmd) Run

func (c *ForgetCmd) Run(globals *Globals) error

type GenerateCmd

type GenerateCmd struct {
	Prompt     []string `arg:"" help:"Prompt to generate"`
	OutputPath string   `` /* 136-byte string literal not displayed */
}

func (*GenerateCmd) Run

func (c *GenerateCmd) Run(globals *Globals) error

type Globals

type Globals struct {
	Context context.Context
}

type ListMessagesCmd

type ListMessagesCmd struct {
	UserID uint   `arg:"" short:"u" long:"user-id" description:"User ID"`
	Format string `help:"Output format, one of: table, markdown" default:"table"`
}

func (*ListMessagesCmd) Run

func (c *ListMessagesCmd) Run(globals *Globals) error

type ListUsersCmd

type ListUsersCmd struct {
	Format string `help:"Output format, one of: table, markdown" default:"table"`
}

func (*ListUsersCmd) Run

func (c *ListUsersCmd) Run(globals *Globals) error

type MergeUsersCmd

type MergeUsersCmd struct {
	Users []uint `arg:"" help:"Users to merge"`
}

func (*MergeUsersCmd) Run

func (c *MergeUsersCmd) Run(globals *Globals) error

type TTSCmd

type TTSCmd struct {
	Prompt     []string `arg:"" help:"Prompt to generate"`
	OutputPath string   `` /* 136-byte string literal not displayed */
}

func (*TTSCmd) Run

func (c *TTSCmd) Run(globals *Globals) error

type VersionFlag

type VersionFlag string

func (VersionFlag) BeforeApply

func (v VersionFlag) BeforeApply(app *kong.Kong, vars kong.Vars) error

func (VersionFlag) Decode

func (v VersionFlag) Decode(ctx *kong.DecodeContext) error

func (VersionFlag) IsBool

func (v VersionFlag) IsBool() bool

Jump to

Keyboard shortcuts

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