completion

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

type Choice struct {
	Index        int     `json:"index"`
	Message      Message `json:"message"`
	FinishReason string  `json:"finish_reason"`
}

type CompletionError

type CompletionError struct {
	Detail ErrorDetail `json:"error"`
}

func (CompletionError) Error

func (e CompletionError) Error() string

error 型として扱えるように Error() メソッドを実装する

type Create

type Create struct {
	Model    string     `json:"model"`
	Messages []Messages `json:"messages"`
}

type ErrorDetail

type ErrorDetail struct {
	Message string `json:"message"`
	Type    string `json:"type"`
	Param   string `json:"param"`
	Code    string `json:"code"`
}

type Message

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

type Messages

type Messages struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

以下のJSONを元に構造体を定義する {"model": "gpt-3.5-turbo-1106", "messages": [{"role": "user", "content": q}] }

type Result

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

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