Skip to content

JohnJAS/go-gpt3

 
 

Repository files navigation

go-gpt3

GoDoc Go Report Card

OpenAI GPT-3 API wrapper for Go

Installation:

go get github.com/sashabaranov/go-gpt3

Example usage:

package main

import (
	"context"
	"fmt"
	gogpt "github.com/sashabaranov/go-gpt3"
)

func main() {
	c := gogpt.NewClient("your token")
	ctx := context.Background()

	req := gogpt.CompletionRequest{
		Model:     gogpt.GPT3Ada,
		MaxTokens: 5,
		Prompt:    "Lorem ipsum",
	}
	resp, err := c.CreateCompletion(ctx, req)
	if err != nil {
		return
	}
	fmt.Println(resp.Choices[0].Text)
}

About

OpenAI GPT-3 API wrapper for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 96.4%
  • Makefile 3.6%