-
Notifications
You must be signed in to change notification settings - Fork 47
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
[BUG] Problematic token usage result in the trace #1193
Comments
Hey @Howie-Arup thanks for the report. The double counting is definitely incorrect but I believe from looking at your screenshot above it's due to you having both openAI instrumentation and llamaindex instrumentation. At the current moment these two instrumentations don't compose together as we wanted to have llamaindex be fully instrumented (including llm calls). In this scenario, we recommend just using the llamaindex instrumentation as using both does double count. We will explore better solutions for composition in the near future but hopefully this is enough to unblock you for now. Thanks for using Phoenix! |
@mikeldking Thanks for your reply! You are right I was having both openAI and llamaindex instrumentations in the llamaindex workflow. I have removed openAI instrumentation and it worked fine. But in the llamaindex workflow I have one step with llamaindex ReAct agent and the other step with crew AI agent. I used the below codes for the crew AI according to the documentation but it turned out there is double counting as shown in the screenshot. I tried deleting the
|
@mikeldking Sorry I found that that it's because I used jupyter notebook to run so the LiteLLMInstrumentor may be still there. After I re-opened the notebook and used the codes below there is no double counting.
But in this case I actually didn't follow the recommendation in the documentation as I removed the LiteLLMInstrumentor and the trace for the crew AI is like below screenshot which doesn't have the llm call to see the input and output messages? |
Hi, I found that the token counting seems problematic. When calculating the total tokens in the
image 1
below, I found it just adds together the numbers of tokens showed up in the trace detail like theimage 2
below. However, it seems that there are repetitive adding for two same processes. For example, in theimage 2
, the OpenAI.Chat and ChatCompletion in the red rectangular consume the same number of tokens, and when I clicked them the input and output messages are the same, but it added the two numbers (i.e., 580+580 in this case) for calculating total tokens in theimage 1
.Image 1
:Image 2
:Environment:
Windows 11
Jupyter
Chrome
The text was updated successfully, but these errors were encountered: