Is the token usage aggregated across a chain of subchains? #27918
Unanswered
daniel-deychakiwsky
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked other resources
Commit to Help
Example Code
Description
Is the token usage aggregated across a chain of subchains? In the provided code snippet, I have two sub chains (chain_one and chain_two) which are chained together as sub chains to form a final chain (chain_all). I can intercept the token usage from each subchain by using listener functions on each of them however I'm curious to clarify if langchain already outputs an aggregate token usage from both subchains on the composed chain output (the ai_message which is returned from chain_all.invoke())?
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
Beta Was this translation helpful? Give feedback.
All reactions