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] DSPy connector not showing the token count, although it is returned in the request #3119
Comments
It looks like the issue with the token count not displaying in the Phoenix UI might be related to how the token count data is being handled and passed to the UI components. The Phoenix UI expects Ensure that the data from your model's response is correctly formatted and passed to the Phoenix backend. The backend should update the token count in the If the token count is correctly updated on the backend but still not displayed, check the data passed to the
|
@DamianB-BitFlipper Thanks for trying Phoenix. For DSPy, we do not grab token counts from the DSPy native spans themselves. Can you try instrumenting your application with our OpenAI instrumentation in addition to the DSPy instrumentation and see if that helps? https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-openai#openinference-openai-instrumentation |
Thanks for the reply. What do you mean by "instrumenting your application". Do you mean simply calling: |
Follow up: Adding |
To address the issue with the token count not displaying in the Phoenix UI, ensure the following steps are correctly implemented:
By following these steps, you should be able to resolve the issue with the token count not displaying in the Phoenix UI. Ensure that each step is correctly implemented and that the token count values are passed as numbers from the backend to the UI components.
|
@DamianB-BitFlipper Here is a code snippet.
|
Requirements:
|
Thanks for the quick reply. I tried exactly your code. I had to add I fear that there may not be a ready solution, and that this may be an issue that needs to be addressed in the DSPy instrumentation. What do you think. I am running the latest versions of everything:
|
For posterity's record, the changes I made were adding:
|
Thanks @DamianB-BitFlipper, glad you're unblocked. I've changed the label from bug to enhancement. We probably want those token counts showing up without the OpenAI instrumentation, as you pointed out. |
Thank you! |
Hi! I'm using dspy-ai[chromadb]==2.4.9 in Ubuntu, and even thought at the beginning I could not see any ChatCompletion traces after enabling the openai instrumentation, then suddenly, it started to work. After some research, I think that dspy has a cache for the requests to the openai gpt api, and no trace is recorded whenever the cache is hit. |
Yes. This is true. DamianOn 19. May 2024, at 06:36, David Hernando Sancha ***@***.***> wrote:
Hi!
I'm using dspy-ai[chromadb]==2.4.9 in Ubuntu, and even thought at the beginning I could not see the ChatCompletion trace after enabling the openapi instrumentation, then suddenly, it started to work.
After some research, I think that dspy has a cache for the requests to the openai gpt api, and no trace is recorded whenever the cache is hit.
image.png (view on web)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Describe the bug
I am querying DSPy with Phoenix as the UI to visualize the queries. This tool has been a real game changer! I cannot help but notice that the token counter is stuck at 0 at the top of the UI.
See:
This is although the response dict from my model has the information:
See:
To Reproduce
Here is the code I use to setup Phoenix with DSPy after installing both
arize-phoenix v3.25.0
andopeninference-instrumentation-dspy v0.1.7
.Expected behavior
The token count would be pulled from telemetry and displayed in the UI.
Environment (please complete the following information):
Thanks again for this amazing tool!
The text was updated successfully, but these errors were encountered: