langchain
langchain copied to clipboard
count tokens used in chain
should be doable with callbacks
@hwchase17 , is this related to calculating token_usage in chain?
Yes, it would be idea to calculate token_usage for every chain/agent and add it to the output.
It should be doable with callbacks to the output
done! https://langchain.readthedocs.io/en/latest/modules/llms/examples/token_usage_tracking.html