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

fixes #1252 #1254

Merged
merged 1 commit into from
Dec 16, 2024
Merged

fixes #1252 #1254

merged 1 commit into from
Dec 16, 2024

Conversation

hnalla
Copy link
Contributor

@hnalla hnalla commented Dec 12, 2024

The PromptTokensDetails in CompletionUsage is currently broken as the actual details from openai sdk are not propagated into instructor.

This is happening due to a typo while Initializing instructors Completion usage package.

fixes: #1252

Reference docs for openai sdk:
https://github.com/openai/openai-python/blob/6e1161bc3ed20eef070063ddd5ac52fd9a531e88/src/openai/types/completion_usage.py#L53


Important

Fixes typo in initialize_usage() in instructor/retry.py to correctly propagate OpenAI SDK details.

  • Bug Fix:
    • Corrects typo in initialize_usage() in instructor/retry.py, changing prompt_token_details to prompt_tokens_details to ensure correct propagation of OpenAI SDK details.

This description was created by Ellipsis for 147e0ad. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 147e0ad in 29 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. instructor/retry.py:76
  • Draft comment:
    Fixes a typo in the initialization of CompletionUsage. The correct keyword is prompt_tokens_details, not prompt_token_details. This change ensures the correct propagation of token details.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_OVly3QOODAiROZen


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@jxnl jxnl merged commit f736fc1 into instructor-ai:main Dec 16, 2024
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.

prompt_tokens_details not being populated correctly in response model
2 participants