zacherystuart 0f9f4aa343 Add Suffix to CompletionRequest for insert mode (#36)
Add "Suffix" to "CompletionRequest" to support the new insert mode.

Insert mode info: https://openai.com/blog/gpt-3-edit-insert/
New Completion Request API Reference: https://beta.openai.com/docs/api-reference/completions/create#completions/create-prompt
2022-12-02 14:54:56 +04:00
2022-07-01 21:13:12 +06:00
2020-08-19 12:57:32 +03:00
2022-08-11 15:29:23 +06:00
2022-08-11 15:29:23 +06:00
2022-08-11 15:29:23 +06:00
2022-08-11 15:29:23 +06:00
2022-08-11 15:29:23 +06:00
2022-08-11 15:29:23 +06:00
2022-08-11 15:29:23 +06:00
2021-12-15 22:24:34 +03:00
2020-08-18 17:42:55 +03:00
2022-08-11 15:29:23 +06:00
2022-08-11 15:29:23 +06:00
2022-08-11 15:29:23 +06:00

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: "ada",
		MaxTokens: 5,
		Prompt:    "Lorem ipsum",
	}
	resp, err := c.CreateCompletion(ctx, req)
	if err != nil {
		return
	}
	fmt.Println(resp.Choices[0].Text)

	searchReq := gogpt.SearchRequest{
		Documents: []string{"White House", "hospital", "school"},
		Query:     "the president",
	}
	searchResp, err := c.Search(ctx, "ada", searchReq)
	if err != nil {
		return
	}
	fmt.Println(searchResp.SearchResults)
}
Description
No description provided
Readme Apache-2.0 952 KiB
Languages
Go 100%