codex

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartCommanderCodex

func StartCommanderCodex(query string) bool

Types

type CmdrCodex

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

func NewCmdrCodex

func NewCmdrCodex(codexApi OpenApiCodex) *CmdrCodex

func (*CmdrCodex) Run

func (c *CmdrCodex) Run(prompt string)

type CodexApi

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

func (*CodexApi) GetCodexSuggestion

func (c *CodexApi) GetCodexSuggestion(ctx context.Context, prompt string) (suggestion CodexSuggestion, err error)

type CodexApiMock

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

func (*CodexApiMock) GetCodexSuggestion

func (c *CodexApiMock) GetCodexSuggestion(ctx context.Context, prompt string) (suggestion CodexSuggestion, err error)

type CodexRequest

type CodexRequest struct {
	Model            string  `json:"model"`
	Prompt           string  `json:"prompt"`
	Temperature      float64 `json:"temperature"`
	MaxTokens        int     `json:"max_tokens"`
	TopP             int     `json:"top_p"`
	FrequencyPenalty int     `json:"frequency_penalty"`
	PresencePenalty  int     `json:"presence_penalty"`
}

type CodexSuggestion

type CodexSuggestion struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	Created int    `json:"created"`
	Model   string `json:"model"`
	Choices []struct {
		Text         string      `json:"text"`
		Index        int         `json:"index"`
		Logprobs     interface{} `json:"logprobs"`
		FinishReason string      `json:"finish_reason"`
	} `json:"choices"`
	Usage struct {
		PromptTokens     int `json:"prompt_tokens"`
		CompletionTokens int `json:"completion_tokens"`
		TotalTokens      int `json:"total_tokens"`
	} `json:"usage"`
}

type OpenApiCodex

type OpenApiCodex interface {
	GetCodexSuggestion(ctx context.Context, prompt string) (suggestion CodexSuggestion, err error)
}

func NewCodexApi

func NewCodexApi(apiKey string) OpenApiCodex

func NewCodexApiMock

func NewCodexApiMock(apiKey string) OpenApiCodex

Jump to

Keyboard shortcuts

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