https://github.com/canack/sentient
A small library that interacts with openAI's language model
https://github.com/canack/sentient
chatgpt chatgpt-api go openai openai-api
Last synced: about 2 months ago
JSON representation
A small library that interacts with openAI's language model
- Host: GitHub
- URL: https://github.com/canack/sentient
- Owner: canack
- License: gpl-3.0
- Created: 2023-01-13T17:56:12.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-23T20:53:09.000Z (over 2 years ago)
- Last Synced: 2024-06-20T05:22:05.503Z (11 months ago)
- Topics: chatgpt, chatgpt-api, go, openai, openai-api
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sentient
#### Warning: This library is still in development and is not yet ready for production use.
---
### Mini library which works with OpenAI's models
### Please check the mini [example](cmd/sentient/main.go)
````shell
git clone https://github.com/canack/sentient.gitcd sentient/cmd/sentient
OPENAI_API_KEY="API_KEY" go run .
````### Usage/Demo:
````shell
go get github.com/canack/sentient
````````go
package mainimport (
"fmt"
"log"
"os""github.com/canack/sentient/pkg/tools"
)func main() {
var davinci = tools.Davinci{
MaxTokens: 300,
Temperature: 0.05,
}chat := tools.NewChatBot(&davinci)
chat.Setup("OPENAI_API_KEY")log.Println("Testing connection to OpenAI API...")
if err := chat.TestConnection(); err != nil {
log.Printf("chatbot connection failed: %v\n", err)
os.Exit(1)
}
log.Println("Connection successful!")message := davinci.Query("Hi, how are you?")
fmt.Println(message.Pretty())
}
````### License: MIT