Skip to content

Added cached_tokens to the usage monitoring. #555

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Christianm9000
Copy link

1.: Added cached tokens to the Usage class and "add" function.
2.: Extracted cached_tokens from the LLM response and appended it to the Usage object.
Note: This change is only made when pairing the Agents SDK with the responses API (not the chat-completions).

cached_tokens is now accessible via the llm_output.raw_responses[n].usage, where n is the response index.

Copy link
Collaborator

@rm-openai rm-openai left a comment

Choose a reason for hiding this comment

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

@Christianm9000 - this looks great, but any reason you didn't add it to ChatCompletions (and also the litellm implementation)?

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