Documentation ¶
Index ¶
- Constants
- type ChatGPTSettings
- type OpenAIChatGPT
- func (instance *OpenAIChatGPT) Complete(prompt string, payload map[string]interface{}) (text string, response map[string]interface{}, err error)
- func (instance *OpenAIChatGPT) Get(url string) (response map[string]interface{}, err error)
- func (instance *OpenAIChatGPT) Post(url string, body interface{}) (response map[string]interface{}, err error)
Constants ¶
View Source
const ( BaseApiUrl = "https://api.openai.com/v1" ApiModels = "/models" ApiCompletions = "/completions" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatGPTSettings ¶
type ChatGPTSettings struct { Model string `json:"model"` // "text-davinci-003" Temperature float32 `json:"temperature"` MaxTokens int `json:"max_tokens"` // 1 token = 0.75 WORD TopP int `json:"top_p"` N int `json:"n"` Stop string `json:"stop"` }
func (*ChatGPTSettings) Load ¶
func (instance *ChatGPTSettings) Load(m map[string]interface{}) (err error)
func (*ChatGPTSettings) Map ¶
func (instance *ChatGPTSettings) Map() (m map[string]interface{})
type OpenAIChatGPT ¶
type OpenAIChatGPT struct {
// contains filtered or unexported fields
}
func NewOpenAIChatGPT ¶
func NewOpenAIChatGPT(settings *commons.SettingsExternal) (instance *OpenAIChatGPT, err error)
func (*OpenAIChatGPT) Complete ¶
func (instance *OpenAIChatGPT) Complete(prompt string, payload map[string]interface{}) (text string, response map[string]interface{}, err error)
Complete send the prompt to chatGPT payload: optional map to override default parameters (
"model": "text-davinci-003", "max_tokens": 75, "temperature": 0, "top_p": 1, "n": 1, "stop": "")
Click to show internal directories.
Click to hide internal directories.