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

can model blocks expose tokens consumed data (request from user) #746

Open
starpit opened this issue Mar 11, 2025 · 2 comments
Open

can model blocks expose tokens consumed data (request from user) #746

starpit opened this issue Mar 11, 2025 · 2 comments
Labels

Comments

@starpit
Copy link
Member

starpit commented Mar 11, 2025

Is your feature request related to a problem? Please describe.

Is there a way to extract prompt (input) and completion (output) tokens from LiteLLM in PDL? For a comparison between 2 approaches, I want to see if one approach consumes additional tokens. I would like to get these stats for the entire agent trajectory per turn

Describe the solution you'd like
This info is available in the litellm completion response. We would need to store it somewhere...

Describe alternatives you've considered
n/a

Additional context
n/a

@esnible
Copy link
Member

esnible commented Mar 11, 2025

To get more data from LiteLLM, use "Custom Callbacks" https://docs.litellm.ai/docs/observability/custom_callback

I don't know exactly what LiteLLM supplies. This is the technique used to send OpenTelemetry, so the data is at least as good as what we send to Jaeger.

The idea would be to attach to the trace of a ModelBlock the arguments of every callback received during its execution.

@starpit
Copy link
Member Author

starpit commented Mar 11, 2025

i think the token info is in the response we already get!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants