gtp

package
v0.0.0-...-e770b57 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BASEURL = "https://api.openai.com/v1/"

Variables

This section is empty.

Functions

func Completions

func Completions(msg string) (string, error)

Completions gtp文本模型回复 curl https://api.openai.com/v1/completions -H "Content-Type: application/json" -H "Authorization: Bearer your chatGPT key" -d '{"model": "text-davinci-003", "prompt": "give me good song", "temperature": 0, "max_tokens": 7}'

Types

type ChatGPTRequestBody

type ChatGPTRequestBody struct {
	Model            string  `json:"model"`
	Prompt           string  `json:"prompt"`
	MaxTokens        int     `json:"max_tokens"`
	Temperature      float32 `json:"temperature"`
	TopP             int     `json:"top_p"`
	FrequencyPenalty int     `json:"frequency_penalty"`
	PresencePenalty  int     `json:"presence_penalty"`
}

ChatGPTRequestBody 响应体

type ChatGPTResponseBody

type ChatGPTResponseBody struct {
	ID      string                   `json:"id"`
	Object  string                   `json:"object"`
	Created int                      `json:"created"`
	Model   string                   `json:"model"`
	Choices []map[string]interface{} `json:"choices"`
	Usage   map[string]interface{}   `json:"usage"`
}

ChatGPTResponseBody 请求体

type ChoiceItem

type ChoiceItem struct {
}

Jump to

Keyboard shortcuts

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