services

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROUTE_COMPLETIONS = "https://api.openai.com/v1/chat/completions"
)

Variables

This section is empty.

Functions

func SaveConfigFile

func SaveConfigFile(filePath string, cfg FileConfig) error

Types

type AiModel

type AiModel string
const (
	AIMODEL_GPT35 AiModel = "gpt-3.5-turbo-1106"
)

type CommandsService

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

We might want to pass args to the commands service if things get more complex

func NewCommandsService

func NewCommandsService(prompt *PromptService, openAiSvc *OpenAiService) *CommandsService

func (*CommandsService) Auth

func (c *CommandsService) Auth() (string, error)

func (*CommandsService) Help

func (c *CommandsService) Help() (string, error)

func (*CommandsService) Interactive added in v1.2.0

func (c *CommandsService) Interactive(args []string) (string, error)

func (*CommandsService) Version added in v1.3.0

func (c *CommandsService) Version() (string, error)

type ConfigService

type ConfigService struct {
	ApiKey       string
	CustomPrompt string
}

func NewConfigService

func NewConfigService() (svc *ConfigService)

type FileConfig

type FileConfig struct {
	ApiKey struct {
		Key string `toml:"key"`
	} `toml:"apikey"`
	Prompt struct {
		Custom string `toml:"custom"`
	} `toml:"prompt"`
}

type OpenAiService

type OpenAiService struct {
	OpenAiRequest models.OpenAIRequest
	// contains filtered or unexported fields
}

func NewOpenAiService

func NewOpenAiService(cfg *ConfigService, aiModel AiModel, temperature float64) *OpenAiService

func (*OpenAiService) GetResponse

func (s *OpenAiService) GetResponse(prompt string) (string, error)

type PromptService

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

func NewPromptService

func NewPromptService(cfg *ConfigService) *PromptService

func (*PromptService) GetAllChanges added in v1.2.0

func (s *PromptService) GetAllChanges() (string, error)

This function should get the changes from git status just like the function above, but now, it will be allowed to add everything to staging in case nothing is in it.

func (*PromptService) GetChanges

func (s *PromptService) GetChanges() (string, error)

func (*PromptService) InteractivePrompt added in v1.2.0

func (s *PromptService) InteractivePrompt(arguments []string) (string, error)

Jump to

Keyboard shortcuts

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