summaryrefslogtreecommitdiff
path: root/Omni/Bild/Example.rs
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-01 04:29:51 -0500
committerBen Sima <ben@bensima.com>2025-12-01 04:29:51 -0500
commit3945b6fad4f1620612beb259e8601d165b9f4f12 (patch)
tree04958c178b59e92022c44567ebef071e13998199 /Omni/Bild/Example.rs
parent7df031715fabd6eb84ef315e8fe78dc7d0b7344d (diff)
Fix cost reporting - parse actual cost from OpenRouter API response
I have successfully completed task t-197.8 to fix cost reporting by pars **Omni/Agent/Engine.hs:** 1. Added `usageCost :: Maybe Double` field to the `Usage` type to captur 2. Updated `FromJSON` instance to parse the optional `"cost"` field 3. Modified `ChatCompletionRequest` ToJSON instance to include `"usage": 4. Changed cost types from `Int` to `Double` throughout (engineOnCost ca 5. Updated `estimateCost` to use floating-point division instead of inte 6. Modified `runAgent` to use actual cost from API when available, conve 7. Added new test case for parsing usage with cost field **Omni/Agent/Worker.hs:** 1. Updated `runWithEngine` signature to return `Double` for cost 2. Changed `totalCostRef` from `IORef Int` to `IORef Double` 3. Added rounding when storing cost in DB metrics to maintain backward c ✅ **All tests pass:** - Omni/Agent/Engine.hs - 16 unit tests pass - Omni/Agent/Worker.hs - Builds successfully - Omni/Agent.hs - All integration tests pass - Omni/Jr.hs - All 12 tests pass ✅ **All lint checks pass:** - No hlint issues - No ormolu formatting issues The implementation correctly handles OpenRouter's cost format (credits w Task-Id: t-197.8
Diffstat (limited to 'Omni/Bild/Example.rs')
0 files changed, 0 insertions, 0 deletions