runner

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OsExistCode             int           = 1
	DefaultBaseURL          string        = "https://api.openai.com"
	DefaultModel            string        = "text-davinci-003"
	DefaultMaxTokens        int           = 4000
	DefaultTemperature      float64       = 1.0
	DefaultFileMode         os.FileMode   = 0600
	DefaultFileAccess       int           = os.O_APPEND | os.O_CREATE | os.O_WRONLY
	DefaultTimeout          time.Duration = time.Second * 5
	HTTPHeaderAccept        string        = "Accept"
	HTTPHeaderContent       string        = "Content-Type"
	HTTPHeaderAppJSON       string        = "application/json"
	HTTPHeaderAuthorization string        = "Authorization"
)

Variables

This section is empty.

Functions

func GetParameters

func GetParameters() (string, string, string, bool, bool)

func Run

func Run() int

Types

type Choices

type Choices struct {
	FinishReason string  `json:"finish_reason"`
	Index        float64 `json:"index"`
	Message      Message `json:"message"`
}

type Message

type Message struct {
	Content      *string `json:"content"`
	FunctionCall string  `json:"function_call"`
	Role         string  `json:"role"`
}

type PostRequestBody

type PostRequestBody struct {
	Prompt      string  `json:"prompt"`
	Model       string  `json:"model"`
	MaxTokens   int     `json:"max_tokens"`
	Temperature float64 `json:"temperature"`
}

type PostResponseBody

type PostResponseBody struct {
	ID      string    `json:"id"`
	Choices []Choices `json:"choices"`
	Created int64     `json:"created"`
	Model   string    `json:"model"`
	Object  string    `json:"object"`
	Usage   Usage     `json:"usage"`
}

type Usage

type Usage struct {
	CompletionTokens int64 `json:"completion_tokens"`
	PromptTokens     int64 `json:"prompt_tokens"`
	TotalTokens      int64 `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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