client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MODEL_GPT_DAVINCI   string = "text-davinci-003"
	MODEL_CODEX_DAVINCI string = "code-davinci-002"
	COMPLETIONAPIURL    string = "https://api.openai.com/v1/completions"
)

Variables

This section is empty.

Functions

func OpenAIResponse

func OpenAIResponse()

Types

type Choice

type Choice struct {
	Text         string `json:"text"`
	Index        int64  `json:"index"`
	Logprobs     bool   `json:"logprobs"`
	FinishReason string `json:"finish_reason"`
}

type Client

type Client struct {
	BearerToken string `json:"token"`
}

type ClientProperty

type ClientProperty struct {
	Model      string `json:"model"`
	Prompt     string `json:"prompt"`
	MaxToken   int64  `json:"max_tokens"`
	Temperatur int64  `json:"temperature"`
}

type CompletionRequest

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

type CompletionResponse

type CompletionResponse struct {
	ID      string   `json:"id"`
	Object  string   `json:"object"`
	Created int64    `json:"created"`
	Model   string   `json:"model"`
	Choices []Choice `json:"choices"`
	Use     Usage    `json:"use"`
}

type Usage

type Usage struct {
	PromptTokens     int64 `json:"prompt_token"`
	CompletionTokens int64 `json:"completion_token"`
	TotalTokens      int64 `json:"total_token"`
}

Jump to

Keyboard shortcuts

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