sashabaranov / go-openai

OpenAI ChatGPT, GPT-3, GPT-4, DALL·E, Whisper API wrapper for Go
Apache License 2.0
9.03k stars 1.39k forks source link

Support Project ID #766

Open pkosiec opened 3 months ago

pkosiec commented 3 months ago

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 https://platform.openai.com/docs/api-reference/organizations-and-projects-optional

Describe your solution I've added an optional header, same as the Organization ID.

As @massenz mentioned here, while the Project ID it is optional, it would be great to match the official OpenAI client and have a double check for the project scope.

Tests I've tested the changes manually.

Resolves https://github.com/sashabaranov/go-openai/issues/757

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 98.51%. Comparing base (774fc9d) to head (a666b26). Report is 18 commits behind head on master.

Files Patch % Lines
client.go 0.00% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #766 +/- ## ========================================== + Coverage 98.46% 98.51% +0.05% ========================================== Files 24 24 Lines 1364 1143 -221 ========================================== - Hits 1343 1126 -217 + Misses 15 10 -5 - Partials 6 7 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

massenz commented 3 months ago

Thanks for the patch! The change looks good to me ✅