openai

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChatURL  = "https://api.openai.com/v1/chat/completions"
	PhotoURL = "https://api.openai.com/v1/images/generations"
)

Variables

This section is empty.

Functions

func NewPhotoQuerier

func NewPhotoQuerier(pConf photo.Configurations) (models.Querier, error)

Types

type ChatCompletion

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

type ChatGPT

type ChatGPT struct {
	Model            string  `json:"model"`
	FrequencyPenalty float32 `json:"frequency_penalty"`
	MaxTokens        *int    `json:"max_tokens"` // Use a pointer to allow null value
	PresencePenalty  float32 `json:"presence_penalty"`
	Temperature      float32 `json:"temperature"`
	TopP             float32 `json:"top_p"`
	Url              string  `json:"url"`
	// contains filtered or unexported fields
}

type Choice

type Choice struct {
	Index        int            `json:"index"`
	Message      models.Message `json:"message"`
	Logprobs     interface{}    `json:"logprobs"` // null or complex object, hence interface{}
	FinishReason string         `json:"finish_reason"`
}

type DallE

type DallE struct {
	Model   string       `json:"model"`
	N       int          `json:"n"`
	Size    string       `json:"size"`
	Quality string       `json:"quality"`
	Style   string       `json:"style"`
	Output  photo.Output `json:"output"`
	// Don't save this as this is set via the Output struct
	ResponseFormat string `json:"-"`
	Prompt         string `json:"-"`
	// contains filtered or unexported fields
}

func (*DallE) Query

func (q *DallE) Query(ctx context.Context) error

type DallERequest

type DallERequest struct {
	Model          string `json:"model"`
	N              int    `json:"n"`
	Size           string `json:"size"`
	Quality        string `json:"quality"`
	Style          string `json:"style"`
	ResponseFormat string `json:"response_format"`
	Prompt         string `json:"prompt"`
}

type ImageResponse

type ImageResponse struct {
	RevisedPrompt string `json:"revised_prompt"`
	URL           string `json:"url"`
	B64_JSON      string `json:"b64_json"`
}

type ImageResponses

type ImageResponses struct {
	Created int             `json:"created"`
	Data    []ImageResponse `json:"data"`
}

type Usage

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

Jump to

Keyboard shortcuts

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