ChatGPT - A Golang wrapper for the GPT model from OpenAI
ChatGPT is a wrapper for the GPT
model from OpenAI purely built on Golang. The application has various features, including asking questions and getting responses, remembering the context of the conversation, exporting the conversation to a file, and importing the conversation from a file.
The app also allows users to get the conversation history, use multiple models such as davinci
, gpt 3
, gpt 3.5
, and gpt 4
. Other features include API Key Authentication, Customizable temperature of the model, Inbuilt Tokenizer for the model, and http/https proxy support for the client.
Here are some notable features of the wrapper:
- Authenticate using the API Key, which can be obtained from the OpenAI Dashboard.
- Authenticate using the
access_token
oremail/password
. - Cache the authentication token for future use.
- Multiple Accounts support, with same cache file.
- Remember the context of the conversation.
- Export the conversation to a file.
- Get the conversation history.
- Models:
davinci
,gpt 3
,gpt 3.5
,gpt 4
. - API Key Authentication.
- Customizable temperature of the model.
- Inbuilt Tokenizer for the model.
- https Proxy support for the client.
- Support for streaming the response via a channel.
Below are some things that need to be added to the application:
- Implement the
internet plugin
for theGPT
model. - Add support for the
top_p
parameter.
You can find the complete documentation for the CHATGPT
package at GoDoc
You can install ChatGPT by running the following command on your terminal:
go get github.com/amarnathcjd/chatgpt
Or usking gopkg.in:
go get gopkg.in/chatgpt.v1
Here is an example of how to use ChatGPT package:
package chatgpt
import (
"fmt"
"context"
"github.com/amarnathcjd/chatgpt"
)
func main() {
client := chatgpt.NewClient(&chatgpt.Config{
Email: "email@domain.com",
Password: "password", // or ApiKey: "sk-xxxxxxxxxxxx",
})
if err := client.Start(); err != nil {
panic(err)
}
ask, err := client.Ask(context.Background(), "Hello, nice to meet you")
if err != nil {
panic(err)
}
fmt.Println("ChatGPT: ", ask.Message)
}
More examples can be found in the examples folder.
ChatGPT is released under the terms of the GPT-3 License. See LICENSE for more information or see The GPT-3 License.