-
Notifications
You must be signed in to change notification settings - Fork 600
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
OpenAI: Update response headers #2507
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following response headers should be captured if they're available: * response.headers.ratelimitLimitTokensUsageBased * response.headers.ratelimitResetTokensUsageBased * response.headers.ratelimitRemainingTokensUsageBased We haven't been able to craft a request that returns these headers.
kaylareopelle
commented
Mar 13, 2024
Comment on lines
+55
to
+57
remaining_headers(headers) | ||
reset_headers(headers) | ||
tokens_usage_based_headers(headers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The branch condition for the method was getting to be too high, so I grouped headers with similar names into their own methods
Some response headers are expected to be Integers. Others are expected to be strings. Now, they match the spec.
kaylareopelle
changed the title
Add "tokens usage based" response headers
Update response headers
Mar 13, 2024
kaylareopelle
requested review from
fallwith,
hannahramadan and
tannalynn
as code owners
March 13, 2024 22:49
kaylareopelle
changed the title
Update response headers
OpenAI: Update response headers
Mar 13, 2024
fallwith
reviewed
Mar 13, 2024
This brings the instance variable names into closer alignment with the constant and the final attribute name. Also, update rate_limit_requests to ratelimit_limit_requests and rate_limit_tokens to ratelimit_limit_tokens to be closer to the header name
Some of the headers had fake values that were confusing in the context. Now, it's easier to tell why some attributes are strings and others are integers.
fallwith
approved these changes
Mar 14, 2024
#first cannot be operated on nil. It's safe to assume that when a value reaches #to_i, it will not be nil. If it was to be nil, we could have some false data sent, as nil.to_i returns zero, which would be recorded by the custom event api.
SimpleCov Report
|
tannalynn
approved these changes
Mar 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LlmEmbedding and LlmChatCompletionSummary events generated by OpenAI have attributes pulled from response headers.
The following response headers should be captured if they're available:
We haven't been able to craft a request that returns these headers.
In addition, this PR updates the data types of the response headers to match the spec (internal).
Closes #2461