🌐
GitHub
github.com › sashabaranov › go-openai
GitHub - sashabaranov/go-openai: OpenAI ChatGPT, GPT-5, GPT-Image-1, Whisper API clients for Go
OpenAI ChatGPT, GPT-5, GPT-Image-1, Whisper API clients for Go - sashabaranov/go-openai
Starred by 10.5K users
Forked by 1.7K users
Languages   Go
🌐
Go Packages
pkg.go.dev › github.com › ayush6624 › go-chatgpt
chatgpt package - github.com/ayush6624/go-chatgpt - Go Packages
Go-ChatGPT is an open-source GoLang client for ChatGPT, a large language model trained by OpenAI. With Go-ChatGPT, you can quickly and easily integrate ChatGPT's language processing capabilities into your Go applications. ... Get your API key from the OpenAI Dashboard - https://platform.op...
🌐
Rollbar
rollbar.com › home › how to use the chatgpt api with golang
How to Use the ChatGPT API with Golang | Rollbar
August 18, 2023 - This guide will take you step-by-step on how to bring together the text-generating wizardry of ChatGPT with the simplicity and efficiency of Golang.
🌐
Pipedream
pipedream.com › apps › openai › integrations › go
Integrate the OpenAI (ChatGPT) API with the Go API - Pipedream
import { axios } from "@pipedream/platform" export default defineComponent({ props: { openai: { type: "app", app: "openai", } }, async run({steps, $}) { return await axios($, { url: `https://api.openai.com/v1/models`, headers: { Authorization: `Bearer ${this.openai.$auth.api_key}`, }, }) }, })
🌐
DEV Community
dev.to › ernesto27 › create-a-golang-cli-using-openai-chatgpt-api-4hid
Create a golang cli using openAI-chatgpt API - DEV Community
March 5, 2023 - In this tutorial we are going to create a simple golang command line program that uses the openAI API to recreate a similar funcionality of the chatgpt web.
🌐
GitHub
github.com › kkdai › chatgpt
GitHub - kkdai/chatgpt: ChatGPT Console client in Golang
A Golang console client for ChatGPT (https://chat.openai.com) using GPT · go get -u -x github.com/kkdai/chatgpt · Request your OpenAPI key in https://beta.openai.com/account/api-keys · export API_KEY=YOUR_KEY chatgpt · Please open up an issue on GitHub before you put a lot efforts on pull request.
Starred by 247 users
Forked by 44 users
Languages   Go
🌐
Medium
medium.com › better-programming › chatgpt-golang-a7bd524e7563
Consume OpenAI (ChatGPT) With Golang | by Francisco Escher | Better Programming
September 11, 2023 - Consume OpenAI (ChatGPT) With Golang My Go client library for the OpenAI API Introduction Open AI exposes an API that is quite simple to use. It requires its clients to register an API Key with an …
🌐
GitHub
github.com › chatgp › chatgpt-go
GitHub - all-in-aigc/chatgpt-webapi: chatgpt go sdk
package main import ( "log" "net/http" "time" chatgpt "github.com/chatgp/chatgpt-go" ) func main() { // new chatgpt client token := `copy-from-cookies` cfValue := "copy-from-cookies" cookies := []*http.Cookie{ { Name: "__Secure-next-auth.session-token", Value: token, }, { Name: "cf_clearance", Value: cfValue, }, } cli := chatgpt.NewClient( chatgpt.WithDebug(true), chatgpt.WithTimeout(60*time.Second), chatgpt.WithCookies(cookies), ) // chat in continuous conversation // first message message := "say hello to me" text, err := cli.GetChatText(message) if err != nil { log.Fatalf("get chat text fai
Starred by 159 users
Forked by 25 users
Languages   Go
🌐
YouTube
youtube.com › watch
Go and OpenAI: A Beginner’s Guide to Building AI-Powered Apps - YouTube
#golang #chatgpt #openai #chatgptapi #ai #golangapiIn this tutorial we're going to create a Golang service that communicates with Chat GPT API. After watchin...
Published   April 12, 2024
Find elsewhere
🌐
Medium
medium.com › aimonks › implementing-chatgpt-api-using-golang-a-step-by-step-guide-cbb2f8a3c8d7
Implementing ChatGPT API Using Golang: A Step-by-Step Guide | by Sumair Zafar | 𝐀𝐈 𝐦𝐨𝐧𝐤𝐬.𝐢𝐨 | Medium
May 11, 2023 - ChatGPT, powered by the GPT-3.5 architecture, is a powerful language model that can understand and generate human-like text. In this article, we will explore how to implement the ChatGPT API using the Go programming language.
🌐
YouTube
youtube.com › grow adept
Put the Power of ChatGPT in Your Golang Apps - Golang Projects - YouTube
https://www.buymeacoffee.com/GrowAdepthttps://github.com/GrowAdept/youtubeWelcome, in this tutorial we are going to use ChatGPT to write code and create a Go
Published   March 7, 2023
Views   3K
🌐
GitHub
github.com › fengxxc › go-chatgpt
GitHub - fengxxc/go-chatgpt: a ChatGPT API client based on the Go
a ChatGPT API client based on the Go. Contribute to fengxxc/go-chatgpt development by creating an account on GitHub.
Author   fengxxc
🌐
ChatGPT
chatgpt.com › g › g-hz1nSk4cK-go-backend-api
ChatGPT - Go Backend API
ChatGPT is your AI chatbot for everyday use. Chat with the most advanced AI to explore ideas, solve problems, and learn faster.
🌐
Go Packages
pkg.go.dev › github.com › golang-infrastructure › go-ChatGPT
chatgpt package - github.com/golang-infrastructure/go-ChatGPT - Go Packages
github.com/golang-infrastructure/go-ChatGPT · Open Source Insights · 这是一个ChatGPT的Golang API库,让你能够把ChatGPT集成到你的Go应用中,注意这是基于逆向工程实现的并不是一个官方库。 · 优势: · 只需要提供自己的JWT就能够像在网页...
🌐
Go Packages
pkg.go.dev › github.com › linweiyuan › go-chatgpt-api › api › chatgpt
chatgpt package - github.com/linweiyuan/go-chatgpt-api/api/chatgpt - Go Packages
github.com/linweiyuan/go-chatgpt-api · Open Source Insights · func CreateConversation(c *gin.Context) func Login(c *gin.Context) type Author · type Content · type CreateConversationRequest · func (c *CreateConversationRequest) AddMessage(role string, content string) type CreateConversationResponse ·
🌐
Reddit
reddit.com › r/golang › trying to connect to gpt-chat
r/golang on Reddit: Trying to connect to GPT-chat
February 13, 2023 -

Hello all, trying to learn Go and API's. I'm using go-gpt3 api library found at: https://pkg.go.dev/github.com/PullRequestInc/go-gpt3#ChatCompletionResponseChoice

I've been able to connect and get simple answers back like, "what time is it", "what's your favorite color", etc.

But I'm having an issue finding how to change the personality of the AI and add better prompts. Like change the AI to be "someone who loves dad-jokes", "reply like an experienced hiker", or "reply like a secret agent".
I've been reading through the api documentation but am having issues. Anyone familiar with this library or even a good read/tutorial on how to use Gin? (it's what we use at work)

I don't count myself as a programming wiz or anything. Just trying to learn to provide a better life to my kids.

Top answer
1 of 1
3
When you first connect with OpenAI, you can set the behavior with a “System” message. The OpenAI Docs can teach you more about the structure. This Test from that go-gpt3 library can also help point you in the right direction. Example: 1. Set up the client (with your API key) gptClient := gpt3.NewClient(openAIAPIKey) 2. Set up your ChatCompletion object and save the response: ctx := context.Background() resp, err := gptClient.ChatCompletion(ctx, gpt3.ChatCompletionRequest{ Model: gpt3.GPT3Dot5Turbo, Messages: []gpt3.ChatCompletionRequestMessage{ { Role: "system", Content: "You are a dad who loves dad-jokes.", }, { Role: "user", Content: "Surely, you can tell me a good joke?", }, }, }) 3. Choose the response you want: This is the type structure of resp as well as used types. Choices can have multiple alternate answers. // ChatCompletionResponse is the full response from a request to the Chat Completions API type ChatCompletionResponse struct { ID string `json:"id"` Object string `json:"object"` Created int `json:"created"` Model string `json:"model"` Choices []ChatCompletionResponseChoice `json:"choices"` Usage ChatCompletionsResponseUsage `json:"usage"` } // ChatCompletionResponseChoice is one of the choices returned in the response to the Chat Completions API type ChatCompletionResponseChoice struct { Index int `json:"index"` FinishReason string `json:"finish_reason"` Message ChatCompletionResponseMessage `json:"message"` } // ChatCompletionResponseMessage is a message returned in the response to the Chat Completions API type ChatCompletionResponseMessage struct { Role string `json:"role"` Content string `json:"content"` } You can just loop through all of them or just get the first. for _, r := range resp.Choices { fmt.Println(r.Message.Content) } // Or just get the first one fmt.Println(resp.Choices[0].Message.Content)
🌐
Go Packages
pkg.go.dev › github.com › leokwsw › go-chatgpt-api › api › chatgpt
chatgpt package - github.com/leokwsw/go-chatgpt-api/api/chatgpt - Go Packages
const ( PublicApiPrefix = "https://chatgpt.com/public-api" ApiPrefix = "https://chatgpt.com/backend-api" AnonPrefix = "https://chatgpt.com/backend-anon" WebSocketProtocols = "json.reliable.webpubsub.azure.v1" ) View Source · var ( PowRetryTimes = 0 PowMaxDifficulty = "000032" ) func CalcProofToken(require *ChatRequirements) string ·
🌐
GitHub
github.com › ayush6624 › go-chatgpt
GitHub - ayush6624/go-chatgpt: Open-source GoLang client for ChatGPT
Go-ChatGPT is an open-source GoLang client for ChatGPT, a large language model trained by OpenAI. With Go-ChatGPT, you can quickly and easily integrate ChatGPT's language processing capabilities into your Go applications.
Starred by 28 users
Forked by 13 users
Languages   Go