fix: Use eval_duration for output TPS calculations in Ollama LLM provider#4568
Merged
timothycarambat merged 8 commits intoMintplex-Labs:masterfrom Nov 20, 2025
Merged
Conversation
shatfield4
approved these changes
Oct 22, 2025
Collaborator
shatfield4
left a comment
There was a problem hiding this comment.
LGTM, refactored to work with streaming and utilizes LLMPerformanceMonitor.
timothycarambat
requested changes
Oct 24, 2025
Member
timothycarambat
left a comment
There was a problem hiding this comment.
This PR does not address duration timing in measureAsyncFunction and if we are going to fix it, we should do so in both places.
We should also either have duration be an override-able property in the PerformanceMontior or just change it specifically in Ollama's AI provider so its impact is limited.
If we make changes to the entire utility then we cannot be sure what the side-effects are.
Since we are going to override eval_duration it should be a custom property name so that it does not get confused with the actual value from ollama if we ever want to try to use it in another place.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Relevant Issues
resolves #4567
What is in this change?
What is in this change?
LLMPerformanceMonitorto support provider duration timing for more accurate output TPS calculationsmeasureAsyncFunctionacceptsdurationfromoutput.usage.durationmeasureStreamto acceptdurationfromreportedUsage.durationif provided by the LLM providereval_durationfor more accurate TPS calculationThis is a generic enhancement that any provider can leverage to supply more accurate timing information, while maintaining backward compatibility with providers that don't supply duration metrics.
Developer Validations
yarn lintfrom the root of the repo & committed changes