Registry / http-client / sashabaranov-go-gpt3

sashabaranov-go-gpt3

JSON →
library1.41.2gogounverified

A Go client library for interacting with the OpenAI GPT-3 and GPT-4 APIs, providing types and functions for completions, embeddings, and more.

go get github.com/sashabaranov/go-gpt3
INSTALL
IMPORT
SIG · SASHABARANOV-GO-GP
S
sashabaranov-go-gpt3
http-clientgov1.41.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gpt3
github.com/sashabaranov/go-gpt3

Creates a GPT-3 client and sends a simple completion request.

package main import ( "context" "fmt" "github.com/sashabaranov/go-gpt3" ) func main() { c := gpt3.NewClient("your-api-key") resp, err := c.Completion(context.Background(), gpt3.CompletionRequest{Prompt: "Hello", MaxTokens: 5}) if err != nil { panic(err) } fmt.Println(resp.Choices[0].Text) }
Debug
Known issues
gotchaAPI key required; the library does not provide a default key.
fix
Set the API key via environment variable OPENAI_API_KEY or pass it directly to NewClient.
affects: all
Upgrade
Version history
1.41.2latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
sashabaranov-go-gpt3 — go get sashabaranov-go-gpt3 · libregistry