Inspired by: Python Edge GPT
A reverse-engineered Bing Chat API (not production ready).
Your bridge to Bing Chat from the command line.
Built with GoLang, go-EdgeGPT
lets you access Bing Chat from any CLI or application!
Screen.Recording.2023-08-10.at.19.39.26.mov
- Command-Line Access 💻: Effortlessly interact with Bing Chat directly from your terminal.
- Integration Ready 🚀: Designed for easy integration into other applications.
- Fast & Efficient ⚡: Written in Go, expect lightning-fast responses and minimal overhead. Efficient use of lightweight goroutines.
- Open Source Love 🧡: Dive into the code, contribute, or fork as per your needs!
- GoLang installed on your system.
- Clone the repo:
git clone https://github.com/StepanTita/go-EdgeGPT.git
- Build the app:
go build -o ./app -gcflags all=-N github.com/StepanTita/go-EdgeGPT
- Run the app:
./app --log-level warn --rich --prompt 'Please, add duck emoji to every message you send' run
go get github.com/StepanTita/go-EdgeGPT
package main
import (
"context"
"fmt"
chat_bot "github.com/StepanTita/go-EdgeGPT"
"github.com/sirupsen/logrus"
)
func main() {
bot := chat_bot.New(cfg.BingConfig())
log := logrus.New()
responseFrameChan, err := bot.Ask(context.Background(), "Tell me a joke", "Add a duck emoji to all of your replies", "creative", true, "english")
if err != nil {
log.Fatal(err)
}
go func() {
var content string
var prevContent string
for msg := range responseFrameChan {
if msg.ErrBody != nil {
log.WithFields(logrus.Fields{
"message": msg.ErrBody.Message,
"reason": msg.ErrBody.Reason,
}).Warn("failed to send message")
content = "__Sorry, something went wrong...\nPlease, reset dialog__"
}
if msg.Skip {
continue
}
if msg.Text != "" {
content = msg.Text
} else if msg.AdaptiveCards != "" {
content = msg.AdaptiveCards
}
if content == prevContent {
continue
}
prevContent = content
fmt.Println(content)
}
}()
}
go-EdgeGPT
is an open-source software licensed under the MIT License. Dive into the LICENSE.md for more details.