-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add explicit prompt/completion logging/attributes, skip tracing for synchronous components #240
Conversation
…ace async components by default
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@NickHeiner do you think this tracing/logging is good/comprehensive enough to remove the full render logging/token count attribute? Here's an example trace from the use-tools example |
Maybe I'm missing something, but where do we see how many tokens |
You can't -- my claim is that token counts are only meaningful in the context of a single model, so the token counts are only available on the That said, a more well-defined thing we could do is aggregate token usage as reported by the descendant model calls, but that's a different beast. (My inclination is also to do that aggregation downstream rather than in the code itself.) |
Ok, great point that the tokenizer means the count is only meaningful within the context of a single model. Broadly, the thing I'm trying to support is the ability to ask "how many tokens did I spend on docs vs API responses". My original solution was to give an output size for every component, but I agree with your points that there are some problems with that. Could we address that with your downstream aggregation suggestion? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with some aspects of how this is being done but don't want to block on it.
Can you update https://docs.ai-jsx.com/guides/observability to reflect these changes?
And perhaps add one or two more unit tests?
IIUC I think that scenario is already addressed with the newly added |
ai.jsx.result.tokenCount
span attribute, which doesn't have the opportunity to handle conversational messages correctly