Total Tokens & Total Cost by Model was not being output correctly… #53
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.
1. Issue Summary
2. Investigation Results
3. Interim Solutions Implemented
3.1 MetricsCollectorService Class Changes
Improved AI system inference logic:
Enhanced token processing in processSumMetric method:
Improved logging for better debugging and traceability.
3.2 LLMDc Class Changes
Enhanced config.yaml settings logging:
Improved token and cost calculation in collectData method:
Added separate methods for getting prompt and complete token prices:
4. Results After Modifications
5. Remaining Issues and Recommendations
Total Cost by Model Display: UI improvements needed to handle very small values.
openai.price.prompt.tokens.per.kilo: 0.0005 # 1M tokens = $0.50、---> 1k tokens = $0.0005
openai.price.complete.tokens.per.kilo: 0.0015 # 1M tokens = $1.50. ---> 1k tokens = $0.0015
Total Cost by Model Display: UI improvements needed to handle very small values.
Token Count and Cost Calculation Precision: May need adjustment.
AI System Name Inference: Current logic prioritizes OpenAI; should be expanded to equally handle WatsonX and Anthropic.
Multiple Price Inputs for Different Models: Support for entering different prices for different models, such as GPT-4 and GPT-3.5, to account for pricing variations.
These interim modifications have addressed the major issues.
Note:
These changes were implemented by a non-Java expert and are interim solutions.
The accuracy and completeness of the solutions are not guaranteed, and further review and testing by Java experts are recommended.
Contact: [email protected]