- Issue created by @marcus_johansson
- 🇧🇪Belgium aspilicious
I'm investigating this at this moment.
Did you start coding? - 🇧🇪Belgium aspilicious
Here is a starting point, allows us to discuss if this is the direction you want.
- First commit to issue fork.
- Merge request !557Applied provided patch for testing purposes. #3517618 → (Open) created by MrDaleSmith
- 🇬🇧United Kingdom MrDaleSmith
Added as a fgork to allow tests to run, and you have some test fails so this will need further work.
- 🇧🇪Belgium aspilicious
I learned a lot about contributing 2.0.
The token functions are only available on chat level at this moment.
If it's needed on other output classes we probably should move these to a trait. - 🇮🇳India vakulrai
Just to add to the above , can we also think of a helper method to Add tracking for retry token usage and retry reasons in AI responses.
My thought is :
we are tracking the mentioned properties but it does not explicitly track retries — which can silently increase token usage and costs when outputs are malformed or invalid (e.g., bad JSON, failed function/tool calls, hallucinated responses, timeouts, etc.).These retries consume additional tokens and can skew both performance and cost reporting if left untracked.
While total input and output tokens might include retries, but they dont tell:
- How many times a retry occurred
- Why each retry happened
- Which prompt caused it
Can we do it as a feature in AI and tke it ofrard in a seperate ticket if this really can be a good add on.
Open for suggestionsThanks !