cli

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingPrompt           = errors.New("please provide a prompt")
	ErrMultiplePromptsProvided = errors.New("only a single prompt may be provided")
	ErrOpenAIAPIKeyNotSet      = errors.New("no OpenAI API key found")
)
View Source
var (
	ModelSelect = promptui.Select{
		Label: "Select model",
		Items: llm.Models,
		Size:  len(llm.Models),
	}

	ApiKeyPrompt = promptui.Prompt{
		Label: "Enter OpenAI API key",
		Mask:  '*',
	}
)

Functions

func NewApp

func NewApp(
	configService config.Service,
	openAIClientFactory OpenAIClientFactory,
	modelPrompter SelectPrompter,
	apiKeyPrompter TextPrompter,
	outputWriter io.Writer,
) cli.Command

Types

type OpenAIClient

type OpenAIClient interface {
	Ask(ctx context.Context, model openai.ChatModel, systemMsg string, msg string) (string, error)
}

type OpenAIClientFactory

type OpenAIClientFactory func(apiKey string) OpenAIClient

type SelectPrompter

type SelectPrompter interface {
	Run() (int, string, error)
}

type TextPrompter

type TextPrompter interface {
	Run() (string, error)
}

Jump to

Keyboard shortcuts

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