Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor library #1

Merged
merged 30 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.18'
go-version: '1.19'
- name: Run vet
run: |
go vet .
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
# # Run testing on the code
# - name: Run testing
# run: cd test && go test -v
- name: Run testing
run: go test -v
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ linters:
- gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
- goprintffuncname # Checks that printf-like functions are named with f at the end
- gosec # Inspects source code for security problems
- lll # Reports long lines
# - lll # Reports long lines
- makezero # Finds slice declarations with non-zero initial length
# - nakedret # Finds naked returns in functions greater than a specified function length
- nestif # Reports deeply nested if statements
Expand All @@ -205,7 +205,7 @@ linters:
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
- stylecheck # Stylecheck is a replacement for golint
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
- testpackage # linter that makes you use a separate _test package
# - testpackage # linter that makes you use a separate _test package
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
- unconvert # Remove unnecessary type conversions
- unparam # Reports unused function parameters
Expand Down
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# go-gpt3
[![GoDoc](http://img.shields.io/badge/GoDoc-Reference-blue.svg)](https://godoc.org/github.com/sashabaranov/go-gpt3)
[![Go Report Card](https://goreportcard.com/badge/github.com/sashabaranov/go-gpt3)](https://goreportcard.com/report/github.com/sashabaranov/go-gpt3)
# openai
[![GoDoc](http://img.shields.io/badge/GoDoc-Reference-blue.svg)](https://godoc.org/github.com/fabiustech/openai)
[![Go Report Card](https://goreportcard.com/badge/github.com/sashabaranov/go-gpt3)](https://goreportcard.com/report/github.com/fabiustech/openai)


[OpenAI GPT-3](https://beta.openai.com/) API wrapper for Go
Zero dependency Go Client for [OpenAI](https://beta.openai.com/) API endpoints. Built upon the great work done [here](https://github.com/sashabaranov/go-gpt3).

Installation:
```
go get github.com/sashabaranov/go-gpt3
go get github.com/fabiustech/openai
```


Example usage:

```go
Expand All @@ -19,22 +17,23 @@ package main
import (
"context"
"fmt"
gogpt "github.com/sashabaranov/go-gpt3"

"github.com/fabiustech/openai"
"github.com/fabiustech/openai/models"
)

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

req := gogpt.CompletionRequest{
Model: gogpt.GPT3Ada,
MaxTokens: 5,
var c = openai.NewClient("your token")

var resp, err = c.CreateCompletion(context.Background(), &openai.CompletionRequest{
Model: models.TextDavinci003,
MaxTokens: 100,
Prompt: "Lorem ipsum",
}
resp, err := c.CreateCompletion(ctx, req)
})
if err != nil {
return
}

fmt.Println(resp.Choices[0].Text)
}
```
51 changes: 0 additions & 51 deletions answers.go

This file was deleted.

85 changes: 0 additions & 85 deletions api.go

This file was deleted.

Loading