Discover Packages
within.website/x
web
openai
chatgpt
package
Version:
v1.8.0
Opens a new window with list of versions in this module.
Published: Oct 8, 2023
License: CC0-1.0
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package chatgpt is a simple binding to the ChatGPT API.
type Choice struct {
Message Message `json:"message"`
FinishReason string `json:"finish_reason"`
Index int `json:"index"`
}
type Function struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Parameters []Param `json:"parameters"`
}
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
FunctionCall *Funcall `json:"function_call,omitempty"`
}
type Param struct {
Type string `json:"type"`
Description string `json:"description,omitempty"`
Enum []string `json:"enum,omitempty"`
Properties map[string ]Param `json:"properties,omitempty"`
Required []string `json:"required,omitempty"`
}
type Request struct {
Model string `json:"model"`
Messages []Message `json:"messages"`
Functions []Function `json:"functions,omitempty"`
}
type Response struct {
ID string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
Model string `json:"model"`
Usage Usage `json:"usage"`
Choices []Choice `json:"choices"`
}
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.