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

Completion API: add new params #870

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

isaacseymour
Copy link
Contributor

@isaacseymour isaacseymour commented Oct 8, 2024

Describe the change

  • store in request: this param allows you to opt a completion request in to being stored, for use in distillations and evals.
  • usage.completion_tokens_details.audio_tokens in response: tracking audio tokens generated
  • usage.prompt_tokens_details in response: tracking tokens used in the prompt

Provide OpenAI documentation link
https://platform.openai.com/docs/api-reference/chat/create#chat-create-store
https://platform.openai.com/docs/api-reference/chat/object#chat/object-usage

Describe your solution
Currently it's not possible to opt a completion request in to being stored using go-openai, blocking usage of distillations and evals.

It's also not possible to track usage of audio tokens, nor prompt caching.

Tests
These are optional new params, so I've not added specific test cases.

This param allows you to opt a completion request in to being stored,
for use in distillations and evals.
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.04%. Comparing base (774fc9d) to head (c85f781).
Report is 60 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #870      +/-   ##
==========================================
+ Coverage   98.46%   99.04%   +0.58%     
==========================================
  Files          24       26       +2     
  Lines        1364     1461      +97     
==========================================
+ Hits         1343     1447     +104     
+ Misses         15        8       -7     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@isaacseymour isaacseymour changed the title Completion API: add 'store' param Completion API: add new params Oct 8, 2024
Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thank you!

@sashabaranov sashabaranov merged commit 9913264 into sashabaranov:master Oct 9, 2024
3 checks passed
@lawrencejones lawrencejones deleted the add-store-param branch October 22, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants