Documentation
¶
Overview ¶
Package chatgpt provides functionality to interact with OpenAI's ChatGPT API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatGPTClient ¶
type ChatGPTClient struct {
// contains filtered or unexported fields
}
ChatGPTClient holds the configuration and API key for the ChatGPT service.
func NewChatGPT ¶
func NewChatGPT(configPath, apiKey string) (*ChatGPTClient, error)
NewChatGPT initializes a new ChatGPT client with the given configuration file and API key.
func (*ChatGPTClient) GetGPTResponse ¶
func (client *ChatGPTClient) GetGPTResponse(sysMessage, userMessage string) (string, error)
GetGPTResponse interacts with OpenAI's ChatGPT API and returns the response.
type Config ¶
type Config struct {
API struct {
URL string `json:"URL"`
ContentType string `json:"ContentType"`
} `json:"API"`
ChatGPT struct {
Model string `json:"Model"`
Temperature int `json:"Temperature"`
MaxTokens int `json:"MaxTokens"`
} `json:"ChatGPT"`
}
Config holds the configuration for the API and ChatGPT.
func LoadConfig ¶
LoadConfig loads the configuration from the given file path.
Click to show internal directories.
Click to hide internal directories.