{"id":13619838,"url":"https://github.com/PullRequestInc/go-gpt3","last_synced_at":"2025-04-14T18:32:31.033Z","repository":{"id":40795978,"uuid":"284095332","full_name":"PullRequestInc/go-gpt3","owner":"PullRequestInc","description":"An OpenAI GPT-3 API client enabling Go/Golang programs to interact with the gpt3 APIs.","archived":false,"fork":false,"pushed_at":"2024-07-11T21:05:55.000Z","size":58,"stargazers_count":390,"open_issues_count":10,"forks_count":65,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-12-08T10:42:39.961Z","etag":null,"topics":["go","golang","gpt-3","gpt3","openai"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PullRequestInc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-31T17:40:49.000Z","updated_at":"2024-12-01T06:38:16.000Z","dependencies_parsed_at":"2023-02-13T07:35:30.071Z","dependency_job_id":"c288efba-3e75-46ff-ba30-aef38e462016","html_url":"https://github.com/PullRequestInc/go-gpt3","commit_stats":{"total_commits":51,"total_committers":16,"mean_commits":3.1875,"dds":0.7058823529411764,"last_synced_commit":"c6cd5993c9bc990612dae5ca94533520ef73a67f"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PullRequestInc%2Fgo-gpt3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PullRequestInc%2Fgo-gpt3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PullRequestInc%2Fgo-gpt3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PullRequestInc%2Fgo-gpt3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PullRequestInc","download_url":"https://codeload.github.com/PullRequestInc/go-gpt3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248936933,"owners_count":21186129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","gpt-3","gpt3","openai"],"created_at":"2024-08-01T21:00:49.375Z","updated_at":"2025-04-14T18:32:30.710Z","avatar_url":"https://github.com/PullRequestInc.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# go-gpt3\n\nAn OpenAI GPT-3 API client enabling Go/Golang programs to interact with the gpt3 APIs.\n\nSupports using the completion APIs with or without streaming.\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/PullRequestInc/go-gpt3)](https://pkg.go.dev/github.com/PullRequestInc/go-gpt3)\n\n## Usage\n\nSimple usage to call the main gpt-3 API, completion:\n\n```go\nclient := gpt3.NewClient(apiKey)\nresp, err := client.Completion(ctx, gpt3.CompletionRequest{\n    Prompt: []string{\"2, 3, 5, 7, 11,\"},\n})\n\nfmt.Print(resp.Choices[0].Text)\n// prints \" 13, 17, 19, 23, 29, 31\", etc\n```\n\n## Documentation\n\nCheck out the go docs for more detailed documentation on the types and methods provided: https://pkg.go.dev/github.com/PullRequestInc/go-gpt3\n\n### Full Examples\n\nTry out any of these examples with putting the contents in a `main.go` and running `go run main.go`.\nI would recommend using go modules in which case you will also need to run `go mod init` within your\ntest repo. Alternatively you can clone this repo and run the test script with `go run cmd/test/main.go`.\n\nYou will also need to have a `.env` file that looks like this to use these examples:\n\n```\nAPI_KEY=\u003copenAI API Key\u003e\n```\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/PullRequestInc/go-gpt3\"\n\t\"github.com/joho/godotenv\"\n)\n\nfunc main() {\n\tgodotenv.Load()\n\n\tapiKey := os.Getenv(\"API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatalln(\"Missing API KEY\")\n\t}\n\n\tctx := context.Background()\n\tclient := gpt3.NewClient(apiKey)\n\n\tresp, err := client.Completion(ctx, gpt3.CompletionRequest{\n\t\tPrompt:    []string{\"The first thing you should know about javascript is\"},\n\t\tMaxTokens: gpt3.IntPtr(30),\n\t\tStop:      []string{\".\"},\n\t\tEcho:      true,\n\t})\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tfmt.Println(resp.Choices[0].Text)\n}\n```\n\n## Support\n\n- [x] List Engines API\n- [x] Get Engine API\n- [x] Completion API (this is the main gpt-3 API)\n- [x] Streaming support for the Completion API\n- [x] Document Search API\n- [x] Overriding default url, user-agent, timeout, and other options\n\n## Powered by\n\n[\u003cimg src=\"https://www.pullrequest.com/images/pullrequest-logo.svg\" width=\"200\"\u003e](https://www.pullrequest.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPullRequestInc%2Fgo-gpt3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPullRequestInc%2Fgo-gpt3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPullRequestInc%2Fgo-gpt3/lists"}