Tracking token usage when using RunnableWithMessageHistory and Tool #27679
Unanswered
lorerave85
asked this question in
Q&A
Replies: 2 comments 2 replies
-
did you ever get an answer to this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
no, but I solved it. I modified a class of the library to be able to create a dedicated data; in particular langserve/schema.py then I used an http middleware to parse and add the tokens of each step: it is not a clean solution, but I have not found any alternatives Lorenzo |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I'm implementing an agent that interacts with the user through tools and history saved on redis.
this chain will then be exposed through langserve, but it is important to know the tokens consumed by each call (I use invoke).
I have already tried to use the various callback methods but none of them return the tokens.
how can I do it? on langsmith I saw that the total token is shown, so this information is present somewhere.
thanks
System Info
langchain==0.3.4
langchain-chroma==0.1.4
langchain-community==0.3.2
langchain-core==0.3.13
langchain-openai==0.2.0
langchain-text-splitters==0.3.0
Beta Was this translation helpful? Give feedback.
All reactions