openai

package
v0.0.0-...-ea7053f Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCompletionOptions = CompletionOptions{
	Model:       "text-davinci-003",
	MaxTokens:   100,
	Temperature: 0.6,
}

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(http *http.Client, token string) *Client

func (*Client) GetCompletion

func (c *Client) GetCompletion(prompt string, options ...CompletionOptions) (string, error)

type CompletionOptions

type CompletionOptions struct {
	Model       string
	MaxTokens   int
	Temperature float64
}

type CompletionRequest

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

type CompletionResponse

type CompletionResponse struct {
	Choices []struct {
		Text string `json:"text"`
	} `json:"choices"`
}

Jump to

Keyboard shortcuts

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