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

openai[patch]: add usage metadata details #27080

Merged
merged 18 commits into from
Oct 3, 2024
Merged

Conversation

baskaryan
Copy link
Collaborator

No description provided.

@efriis efriis added the partner label Oct 3, 2024
@efriis efriis self-assigned this Oct 3, 2024
Copy link

vercel bot commented Oct 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Oct 3, 2024 8:37pm

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 3, 2024
input_tokens=input_tokens,
output_tokens=output_tokens,
total_tokens=total_tokens,
input_token_details=InputTokenDetails(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need InputTokenDetails here? Does it do a 2nd instantiation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for lint, could type ignore

return ["reasoning_output", "cache_read_input"]

def invoke_with_cache_read_input(self, *, stream: bool = False) -> AIMessage:
with open(REPO_ROOT_DIR / "README.md", "r") as f:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we avoid loading a file here if ti's not necessary?

Copy link
Collaborator Author

@baskaryan baskaryan Oct 3, 2024

Choose a reason for hiding this comment

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

having a >2k token string literal seems not great for readability

@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Oct 3, 2024
Base automatically changed from bagatur/usage_metadata_details to master October 3, 2024 20:36
@baskaryan baskaryan merged commit c09da53 into master Oct 3, 2024
28 checks passed
@baskaryan baskaryan deleted the bagatur/oai_usage_details branch October 3, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging. partner size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants