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

merge main branch #1

Open
wants to merge 206 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
be253c2
change azure engine config to modelMapper (#306)
GargantuaX May 10, 2023
83d03fc
Adjust the azure model deployment name call corresponding to README (…
zjy282 May 15, 2023
21eef5b
Move form_builder into internal pkg. (#311)
JiayueShi May 16, 2023
b62a325
Azure OpenAI API version 2023-05-15 (#316)
iktakahiro May 19, 2023
faae8b4
Update README.md (#319)
TomHennessy May 22, 2023
a18c18d
Update README.md with Azure OpenAI Embeddings example (#318)
coggsfl May 22, 2023
980504b
docs(readme): update format (#317)
appleboy May 27, 2023
62eb4be
move marshaller and unmarshaler into internal pkg (#304) (#325)
vvatanabe May 28, 2023
61ba5f3
move request_builder into internal pkg (#304) (#329)
vvatanabe May 31, 2023
fa694c6
Implement optional io.Reader in AudioRequest (#303) (#265) (#331)
mdarc Jun 5, 2023
1394329
move error_accumulator into internal pkg (#304) (#335)
vvatanabe Jun 5, 2023
6830e00
Support Retrieve model API (#340) (#341)
vvatanabe Jun 5, 2023
b8c13e4
Refactor streamReader: Replace goto Statement with Loop in Recv Metho…
YukiBobier Jun 8, 2023
06b16a7
fix json marshaling error response of azure openai (#343) (#345)
vvatanabe Jun 8, 2023
a243e73
Support Retrieve file content API (#347) (#348)
vvatanabe Jun 11, 2023
b616090
refactoring tests with mock servers (#30) (#356)
vvatanabe Jun 12, 2023
3f4e3bb
models: add *-0613 models (#361)
simonklee Jun 13, 2023
646989c
Improve (#356) to support registration of wildcard URLs (#359)
coggsfl Jun 14, 2023
7e76a68
Add 16k 0613 model (#365)
beichideyuwan Jun 14, 2023
2bd65aa
feat(chat): support function call api (#369)
Ccheers Jun 15, 2023
43de771
Create FUNDING.yml (#371)
sashabaranov Jun 15, 2023
0bd14f9
refactor: ChatCompletionStreamChoice.FinishReason from string to Fini…
liushuangls Jun 15, 2023
ac25f31
add items, which is required for array type (#373)
nftechie Jun 16, 2023
f0770cf
audio: add items to AudioResponseFormat enum (#382)
romazu Jun 16, 2023
e49d771
support for parsing error response message fields even if they are ar…
vvatanabe Jun 17, 2023
b095938
extract and split integration tests (#389)
vvatanabe Jun 18, 2023
68f9ef9
split integration test using go build tag (#392)
vvatanabe Jun 19, 2023
7203770
feat: added function call info to chat completions (#390)
cem-unuvar Jun 20, 2023
e948150
fix: chat stream returns an error response with a 'data: ' prefix (#396)
liushuangls Jun 20, 2023
f22da8a
feat: allow more input types to functions, fix tests (#377)
stillmatic Jun 21, 2023
e19b074
docs: add requires go version in README.md (#397)
vvatanabe Jun 21, 2023
ffa7abc
Update README.md (#399)
sashabaranov Jun 21, 2023
157de06
add vvatanabe to FUNDING.yml (#402)
vvatanabe Jun 22, 2023
f1b6696
refactor: refactoring http request creation and sending (#395)
vvatanabe Jun 22, 2023
5f4ef29
Update README.md (#406)
sashabaranov Jun 23, 2023
0ca4ea4
move json schema to directory/package (#407)
jmacwhyte Jun 24, 2023
a3c0b36
chore: add an issue template for feature request (#410)
vvatanabe Jun 26, 2023
581f70b
chore: add an issue template for bug report (#408)
vvatanabe Jun 26, 2023
86d0f48
chore: add a pull request template (#412)
vvatanabe Jun 28, 2023
9c99f36
replace deprecated FunctionDefine in chat_test.go (#416)
ryomak Jun 29, 2023
1efcf2d
fix: move pull request template (#420)
vvatanabe Jun 30, 2023
177c143
Fix OpenAI error when properties is empty in function call : object s…
royalrick Jun 30, 2023
2042608
docs: remove medatada in PULL_REQUEST_TEMPLATE.md (#423)
vvatanabe Jul 3, 2023
5c7d882
Allow embeddings requests to be tokens or strings (#417)
jacksors Jul 5, 2023
619ad71
docs: added instructions for obtaining OpenAI API key to README (#421)
vvatanabe Jul 5, 2023
7b22898
Implement OpenAI July 2023 Updates (#427)
liushuangls Jul 9, 2023
181fc2a
docs: explanation about LogitBias. (129) (#426)
vvatanabe Jul 9, 2023
f028c28
fix: function call error due to nil properties (429) (#431)
vvatanabe Jul 9, 2023
c3b2451
fix: invalid schema for function 'func_name': None is not of type 'ob…
vvatanabe Jul 11, 2023
39b2acb
ci: set up closing-inactive-issues in GitHub Action (129) (#428)
vvatanabe Jul 12, 2023
e22a29d
Check if the model param is valid for moderations endpoint (#437)
MunarYesen Jul 13, 2023
0234c1e
add example: fine tune (#438)
mehulgohil Jul 14, 2023
1876e0c
update to json.RawMessage (#441)
Jul 15, 2023
1153eb2
Add support for azure openai new version API (2023-07-01-preview) (#451)
ZeroDeng01 Jul 20, 2023
62dc817
feat: make finish reason nullable in json marshal (#449)
yuikns Jul 28, 2023
71a2493
docs: add Frequently Asked Questions to README.md (#462)
vvatanabe Jul 30, 2023
3456989
Compatible with the 2023-07-01-preview API interface of Azure Openai,…
ZeroDeng01 Aug 9, 2023
a14bc10
docs: Add Contributing Guidelines (#463)
vvatanabe Aug 9, 2023
a2ca01b
feat: implement new fine tuning job API (#479)
henomis Aug 29, 2023
25da859
Chore Deprecate legacy fine tunes API (#484)
henomis Aug 31, 2023
3589837
Update OpenAPI file return struct (#486)
NullpointerW Sep 7, 2023
8e4b796
Chore Support base64 embedding format (#485)
henomis Sep 11, 2023
0d5256f
added delete fine tune model endpoint (#497)
BrendanMartin Sep 25, 2023
84f77a0
Add DotProduct Method and README Example for Embedding Similarity Sea…
ealvar3z Oct 2, 2023
533935e
fix: use any for n_epochs (#499)
henomis Oct 6, 2023
8e165dc
Feat Add headers to openai responses (#506)
henomis Oct 9, 2023
b77d01e
Support get http header and x-ratelimit-* headers (#507)
liushuangls Oct 10, 2023
c47ddfc
Update README.md (#511)
sashabaranov Oct 10, 2023
6c52952
feat(completion): add constants for new GPT models (#520)
simonklee Nov 6, 2023
9e0232f
Fix typo in README: AdaEmbeddingV2 (#516)
eliben Nov 6, 2023
0664105
lint: fix linter warnings reported by golangci-lint (#522)
simonklee Nov 7, 2023
d07833e
Doc ways to improve reproducability besides Temp (#532)
carsonkahn-external Nov 7, 2023
6d9c3a6
Feat Support chat completion response format and seed new fields (#525)
henomis Nov 7, 2023
3063e67
Feat Implement assistants API (#535)
henomis Nov 7, 2023
1ad6b6f
Feat Support tools and tools choice new fileds (#526)
henomis Nov 7, 2023
a20eb08
fix: use pointer for ChatCompletionResponseFormat (#544)
henomis Nov 7, 2023
a0159ad
Support new fields for /v1/images/generation API (#530)
mikecutalo Nov 8, 2023
a2d2bf6
Fix Refactor assistant api (#545)
henomis Nov 8, 2023
08c167f
test: fix compile error in api integration test (#548)
vvatanabe Nov 8, 2023
bc89139
Feat Implement threads API (#536)
henomis Nov 9, 2023
e3e065d
Add SystemFingerprint and chatMsg.ToolCallID field (#543)
gburt Nov 9, 2023
8127072
fix test server setup: (#549)
urjitbhatia Nov 9, 2023
78862a2
fix: add missing fields in tool_calls (#558)
henomis Nov 9, 2023
d6f3bdc
Feat implement Run APIs (#560)
henomis Nov 9, 2023
35495cc
Add `json:"metadata,omitempty"` to RunRequest struct (#561)
kb Nov 12, 2023
9fefd50
Fix typo in chat_test.go (#564)
eltociear Nov 12, 2023
b7cac70
Feat/messages api (#546)
urjitbhatia Nov 13, 2023
515de02
feat: initial TTS support (#528)
stillmatic Nov 13, 2023
fe67abb
fix: add beta assistant header to CreateMessage call (#566)
floodfx Nov 15, 2023
71848cc
feat: support direct bytes for file upload (#568)
floodfx Nov 15, 2023
464b85b
Pagination fields are missing from assistants list beta API (#571)
liron-l Nov 15, 2023
3220f19
feat(runapi): add RunStepList response args https://platform.openai.…
Ccheers Nov 15, 2023
1846572
Add missing struct properties. (#579)
revett Nov 15, 2023
4fd904c
Add File purposes as constants (#577)
revett Nov 18, 2023
9efad28
Updates the tool call struct (#595)
albertpurnama Nov 18, 2023
a130cfe
Add missing response fields for pagination (#584)
albertpurnama Nov 18, 2023
f879095
Add canary-tts to speech models (#603)
pjuhasz Nov 24, 2023
7260991
Update PULL_REQUEST_TEMPLATE.md (#606)
sashabaranov Nov 24, 2023
03caea8
Add support for multi part chat messages (and gpt-4-vision-preview mo…
rkintzi Nov 24, 2023
a09cb0c
Add completion-with-tool example (#598)
mikeb26 Nov 26, 2023
c9615e0
Added support for createImage Azure models (#608)
zjy282 Jan 3, 2024
f10955c
Log probabilities for chat completion output tokens (#625)
danai-antoniou Jan 9, 2024
682b7ad
Update README.md (#631)
Kledal Jan 11, 2024
e01a2d7
convert EmbeddingModel to string type (#629)
jaffee Jan 15, 2024
09f6920
fixed #594 (#609)
HongminHan Jan 15, 2024
4ce03a9
Fix Azure embeddings model detection by passing string to `fullURL` (…
greysteil Jan 16, 2024
eff8dc1
fix(audio): fix audioTextResponse decode (#638)
WqyJh Jan 17, 2024
4c41f24
Support January 25, 2024, models update. (#644)
bazuker Jan 26, 2024
06ff541
Add new struct filed dimensions for embedding API (#645)
chenhhA Jan 29, 2024
bc8cdd3
add GPT3Dot5Turbo0125 model (#648)
liushuangls Feb 2, 2024
bb6ed54
Fix: Add RunStatusCancelled (#650)
shadowpigy Feb 2, 2024
69e3fcb
Fix typo assitantInstructions (#655)
chrbsg Feb 6, 2024
6c2e316
Added support for CreateSpeech Azure models (#657)
zjy282 Feb 8, 2024
a7954c8
Feat: Add assistant usage (#649)
shadowpigy Feb 8, 2024
11ad4b6
make linter happy (#661)
sashabaranov Feb 15, 2024
66bae3e
Content-type fix (#659)
grulex Feb 15, 2024
ff61bbb
Add RunRequest field AdditionalInstructions (#656)
chrbsg Feb 15, 2024
69e3bbb
Update client.go - allow to skip Authorization header (#658)
7flash Feb 16, 2024
e8b3478
fix:fix open ai original validation. modify Tool's Function to pointe…
CaoPengflying Feb 19, 2024
7381d18
Fix for broken Azure Assistants url (#665)
coggsflod Feb 21, 2024
c5401e9
Fix for broken Azure Threads url (#668)
coggsflod Feb 26, 2024
f220443
Added fields for moderation (#662)
raphoester Feb 26, 2024
4103778
fix: when no Assistant Tools are specified, an empty list should be s…
guillaume-dussault Feb 26, 2024
bb6149f
fix: repair json decoding of moderation response (#670)
mheck136 Feb 28, 2024
38b16a3
Added 'wav' and 'pcm' Audio Formats (#671)
GopherGhaznix Mar 7, 2024
699f397
Update streamReader Close() method to return error (#681)
sunshineplan Mar 11, 2024
0925563
Fix broken implementation AssistantModify implementation (#685)
qhenkart Mar 15, 2024
2646bce
feat: get header from sendRequestRaw (#694)
WqyJh Apr 5, 2024
774fc9d
make linter happy (#701)
sashabaranov Apr 5, 2024
187f416
[BREAKING_CHANGES] Fix update message payload (#699)
qhenkart Apr 9, 2024
e0d0801
feat: add GPT4Turbo and GPT4Turbo20240409 (#703)
liushuangls Apr 11, 2024
ea551f4
Fixing typos (#706)
deining Apr 13, 2024
2446f08
Bump GitHub workflow actions to latest versions (#707)
deining Apr 13, 2024
a42f519
[New_Features] Adds recently added Assistant cost saving parameters (…
qhenkart Apr 16, 2024
c6a63ed
Add PromptFilterResult (#702)
jchaykow Apr 16, 2024
8d15a37
Remove hardcoded assistants version (#719)
danai-antoniou Apr 24, 2024
2d58f8f
chore: add SystemFingerprint for chat completion stream response (#716)
winrey Apr 24, 2024
c84ab5f
feat: support cloudflare AI Gateway flavored azure openai (#715)
woorui Apr 24, 2024
c9953a7
Fixup minor copy-pasta comment typo (#728)
agcom Apr 27, 2024
3334a9c
Add support for word-level audio transcription timestamp granularity …
agcom May 7, 2024
6af3220
feat: support stream_options (#736)
liushuangls May 7, 2024
3b25e09
enhancement: Add new GPT4-o and alias to completion enums (#744)
kmesiab May 13, 2024
9f19d1c
Add gpt4o (#742)
May 13, 2024
4f4a856
Added DALL.E 3 to readme.md (#741)
Kshirodram May 13, 2024
211cb49
Update client.go to get response header whether there is an error or …
ando-masaki May 24, 2024
30cf7b8
feat: add params to RunRequest (#754)
TheAdamSmith Jun 3, 2024
8618492
feat: add incomplete run status (#763)
shosato0306 Jun 5, 2024
fd41f7a
Fix integration test (#762)
TheAdamSmith Jun 13, 2024
7e96c71
run integration tests (#769)
sashabaranov Jun 13, 2024
c69c3bb
integration tests: pass openai secret (#770)
sashabaranov Jun 13, 2024
99cc170
feat: support batches api (#746)
eiixy Jun 13, 2024
68acf22
Support Tool Resources properties for Threads (#760)
pkosiec Jun 13, 2024
0a42130
feat: provide vector store (#772)
Pengguancheng Jun 19, 2024
e311859
remove errors.Join (#778)
sashabaranov Jun 26, 2024
03851d2
allow custom voice and speech models (#691)
adrianliechti Jun 30, 2024
727944c
feat: ParallelToolCalls to ChatCompletionRequest with helper function…
structwafel Jul 12, 2024
3e47e6f
fix: #790 (#798)
eiixy Jul 19, 2024
27c1c56
feat: Add GPT-4o Mini model support (#796)
danielchalef Jul 19, 2024
92f4830
fix: #794 (#797)
eiixy Jul 19, 2024
ae903d7
fix: Updated ThreadMessage struct with latest fields based on OpenAI …
ecoralic Jul 19, 2024
a7e9f0e
add hyperparams (#793)
janukobytsch Jul 19, 2024
966ee68
Add New Optional Parameters to `AssistantRequest` Struct (#795)
Vanessamae23 Jul 19, 2024
581da2f
fix: #804 (#807)
eiixy Jul 28, 2024
dbe726c
Add support for `gpt-4o-2024-08-06` (#812)
danielchalef Aug 7, 2024
623074c
feat: Support Structured Outputs (#813)
eiixy Aug 7, 2024
6439e1f
Make reponse format JSONSchema optional (#820)
tylergannon Aug 7, 2024
1880333
Run integration tests for PRs (#823)
HaraldNordgren Aug 9, 2024
2c6889e
fix: #788 (#800)
eiixy Aug 10, 2024
dd7f582
fix: fullURL endpoint generation (#817)
eiixy Aug 16, 2024
d86425a
Allow structured outputs via function calling (#828)
greysteil Aug 16, 2024
6d02119
feat: Support Delete Message API (#799)
kappa-lab Aug 22, 2024
5162adb
Support http client middlewareing (#830)
michurin Aug 23, 2024
a3bd256
Improve handling of JSON Schema in OpenAI API Response Context (#819)
eiixy Aug 24, 2024
030b7cb
fix integration tests (#834)
sashabaranov Aug 24, 2024
c37cf9a
Dynamic model (#838)
mathisen99 Sep 1, 2024
643da8d
depricated model GPT3Ada changed to GPT3Babbage002 (#843)
Arundas666 Sep 4, 2024
194a03e
Add refusal (#844)
qhenkart Sep 11, 2024
a5fb553
Support OpenAI reasoning models (#850)
abatilo Sep 17, 2024
1ec8c24
fix: jsonschema integer validation (#852)
WeiAnAn Sep 20, 2024
9add1c3
add max_completions_tokens for o1 series models (#857)
chococola Sep 20, 2024
9a4f3a7
feat: add ParallelToolCalls to RunRequest (#847)
kenshin54 Sep 20, 2024
e095df5
run_id string Optional (#855)
floodwm Sep 20, 2024
38bdc81
Optimize Client Error Return (#856)
eiixy Sep 26, 2024
7f80303
Fix max_completion_tokens (#860)
alexsacr Sep 26, 2024
e9d8485
fix: ParallelToolCalls should be added to RunRequest (#861)
kenshin54 Sep 26, 2024
fdd59d9
feat: usage struct add CompletionTokensDetails (#863)
liushuangls Sep 26, 2024
bac7d59
fix MaxCompletionTokens typo (#862)
l-winston Oct 3, 2024
7c145eb
add jailbreak filter result, add ContentFilterResults on output (#864)
juliomartinsdev Oct 3, 2024
9913264
Completion API: add new params (#870)
isaacseymour Oct 9, 2024
cfe15ff
return response body as byte slice for RequestError type (#873)
AyushSawant18588 Oct 14, 2024
21f7134
Adding new moderation model constants (#875)
Mhjacobs Oct 14, 2024
b162541
Cleanup (#879)
sashabaranov Oct 15, 2024
9fe2c6c
Completion API: add Store and Metadata parameters (#878)
smackcrane Oct 15, 2024
fb15ff9
Handling for non-json response (#881)
AyushSawant18588 Oct 21, 2024
3672c0d
fix: Updated Assistent struct with latest fields based on OpenAI docs…
ecoralic Oct 21, 2024
6e08732
Updated checkPromptType function to handle prompt list in completions…
AyushSawant18588 Oct 25, 2024
d10f1b8
add chatcompletion stream delta refusal and logprobs (#882)
Yu0u Oct 29, 2024
f5e6e0e
Added Vector Store File List properties that allow for pagination (#891)
MattDavisRV Nov 8, 2024
6d066bb
Support Attachments in MessageRequest (#890)
kodernubie Nov 8, 2024
b3ece4d
Updated client_test to solve lint error (#900)
AyushSawant18588 Nov 19, 2024
1687616
o1 model support stream (#904)
ldnvnbl Nov 20, 2024
74ed75f
Make user field optional in embedding request (#899)
nagar-ajay Nov 20, 2024
21fa42c
feat: add gpt-4o-2024-11-20 model (#905)
liushuangls Nov 30, 2024
c203ca0
feat: add RecvRaw (#896)
WqyJh Nov 30, 2024
af5355f
Fix ID field to be optional (#911)
TimMisiak Dec 8, 2024
56a9acf
Ignore test.mp3 (#913)
sashabaranov Dec 8, 2024
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
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [sashabaranov, vvatanabe]
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

Your issue may already be reported!
Please search on the [issue tracker](https://github.com/sashabaranov/go-openai/issues) before creating one.

**Describe the bug**
A clear and concise description of what the bug is. If it's an API-related bug, please provide relevant endpoint(s).

**To Reproduce**
Steps to reproduce the behavior, including any relevant code snippets.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots/Logs**
If applicable, add screenshots to help explain your problem. For non-graphical issues, please provide any relevant logs or stack traces.

**Environment (please complete the following information):**
- go-openai version: [e.g. v1.12.0]
- Go version: [e.g. 1.18]
- OpenAI API version: [e.g. v1]
- OS: [e.g. Ubuntu 20.04]

**Additional context**
Add any other context about the problem here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

Your issue may already be reported!
Please search on the [issue tracker](https://github.com/sashabaranov/go-openai/issues) before creating one.

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
A similar PR may already be submitted!
Please search among the [Pull request](https://github.com/sashabaranov/go-openai/pulls) before creating one.

If your changes introduce breaking changes, please prefix the title of your pull request with "[BREAKING_CHANGES]". This allows for clear identification of such changes in the 'What's Changed' section on the release page, making it developer-friendly.

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request.

**Describe the change**
Please provide a clear and concise description of the changes you're proposing. Explain what problem it solves or what feature it adds.

**Provide OpenAI documentation link**
Provide a relevant API doc from https://platform.openai.com/docs/api-reference

**Describe your solution**
Describe how your changes address the problem or how they add the feature. This should include a brief description of your approach and any new libraries or dependencies you're using.

**Tests**
Briefly describe how you have tested these changes. If possible — please add integration tests.

**Additional context**
Add any other context or screenshots or logs about your pull request here. If the pull request relates to an open issue, please link to it.

Issue: #XXXX
23 changes: 23 additions & 0 deletions .github/workflows/close-inactive-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
exempt-issue-labels: 'bug,enhancement'
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Integration tests

on:
push:
branches:
- master

jobs:
integration_tests:
name: Run integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Run integration tests
env:
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
run: go test -v -tags=integration ./api_integration_test.go
10 changes: 5 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ jobs:
name: Sanity check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.19'
go-version: '1.21'
- name: Run vet
run: |
go vet .
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
- name: Run tests
run: go test -race -covermode=atomic -coverprofile=coverage.out -v .
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@

# Auth token for tests
.openai-token
.idea
.idea

# Generated by tests
test.mp3
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ linters-settings:
# Default: true
skipRecvDeref: false

gomnd:
mnd:
# List of function patterns to exclude from analysis.
# Values always ignored: `time.Date`
# Default: []
Expand Down Expand Up @@ -167,7 +167,7 @@ linters:
- durationcheck # check for two durations multiplied together
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds
# Removed execinquery (deprecated). execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds
- exhaustive # check exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
- forbidigo # Forbids identifiers
Expand All @@ -180,14 +180,14 @@ linters:
- gocyclo # Computes and checks the cyclomatic complexity of functions
- godot # Check if comments end in a period
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
- gomnd # An analyzer to detect magic numbers.
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
- 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
- makezero # Finds slice declarations with non-zero initial length
# - nakedret # Finds naked returns in functions greater than a specified function length
- mnd # An analyzer to detect magic numbers.
- nestif # Reports deeply nested if statements
- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
- nilnil # Checks that there is no simultaneous return of nil error and an invalid value.
Expand Down
88 changes: 88 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Contributing Guidelines

## Overview
Thank you for your interest in contributing to the "Go OpenAI" project! By following this guideline, we hope to ensure that your contributions are made smoothly and efficiently. The Go OpenAI project is licensed under the [Apache 2.0 License](https://github.com/sashabaranov/go-openai/blob/master/LICENSE), and we welcome contributions through GitHub pull requests.

## Reporting Bugs
If you discover a bug, first check the [GitHub Issues page](https://github.com/sashabaranov/go-openai/issues) to see if the issue has already been reported. If you're reporting a new issue, please use the "Bug report" template and provide detailed information about the problem, including steps to reproduce it.

## Suggesting Features
If you want to suggest a new feature or improvement, first check the [GitHub Issues page](https://github.com/sashabaranov/go-openai/issues) to ensure a similar suggestion hasn't already been made. Use the "Feature request" template to provide a detailed description of your suggestion.

## Reporting Vulnerabilities
If you identify a security concern, please use the "Report a security vulnerability" template on the [GitHub Issues page](https://github.com/sashabaranov/go-openai/issues) to share the details. This report will only be viewable to repository maintainers. You will be credited if the advisory is published.

## Questions for Users
If you have questions, please utilize [StackOverflow](https://stackoverflow.com/) or the [GitHub Discussions page](https://github.com/sashabaranov/go-openai/discussions).

## Contributing Code
There might already be a similar pull requests submitted! Please search for [pull requests](https://github.com/sashabaranov/go-openai/pulls) before creating one.

### Requirements for Merging a Pull Request

The requirements to accept a pull request are as follows:

- Features not provided by the OpenAI API will not be accepted.
- The functionality of the feature must match that of the official OpenAI API.
- All pull requests should be written in Go according to common conventions, formatted with `goimports`, and free of warnings from tools like `golangci-lint`.
- Include tests and ensure all tests pass.
- Maintain test coverage without any reduction.
- All pull requests require approval from at least one Go OpenAI maintainer.

**Note:**
The merging method for pull requests in this repository is squash merge.

### Creating a Pull Request
- Fork the repository.
- Create a new branch and commit your changes.
- Push that branch to GitHub.
- Start a new Pull Request on GitHub. (Please use the pull request template to provide detailed information.)

**Note:**
If your changes introduce breaking changes, please prefix your pull request title with "[BREAKING_CHANGES]".

### Code Style
In this project, we adhere to the standard coding style of Go. Your code should maintain consistency with the rest of the codebase. To achieve this, please format your code using tools like `goimports` and resolve any syntax or style issues with `golangci-lint`.

**Run goimports:**
```
go install golang.org/x/tools/cmd/goimports@latest
```

```
goimports -w .
```

**Run golangci-lint:**
```
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
```

```
golangci-lint run --out-format=github-actions
```

### Unit Test
Please create or update tests relevant to your changes. Ensure all tests run successfully to verify that your modifications do not adversely affect other functionalities.

**Run test:**
```
go test -v ./...
```

### Integration Test
Integration tests are requested against the production version of the OpenAI API. These tests will verify that the library is properly coded against the actual behavior of the API, and will fail upon any incompatible change in the API.

**Notes:**
These tests send real network traffic to the OpenAI API and may reach rate limits. Temporary network problems may also cause the test to fail.

**Run integration test:**
```
OPENAI_TOKEN=XXX go test -v -tags=integration ./api_integration_test.go
```

If the `OPENAI_TOKEN` environment variable is not available, integration tests will be skipped.

---

We wholeheartedly welcome your active participation. Let's build an amazing project together!
35 changes: 0 additions & 35 deletions Makefile

This file was deleted.

Loading