|
32 | 32 | (shared/assoc-some {} :a 1 :b))))) |
33 | 33 |
|
34 | 34 | (deftest tokens->cost-test |
35 | | - (let [db {:models {"provider/my-model" {:input-token-cost 0.01 |
36 | | - :output-token-cost 0.02 |
37 | | - :input-cache-creation-token-cost 0.005 |
38 | | - :input-cache-read-token-cost 0.001}}}] |
| 35 | + (let [model-capabilities {:input-token-cost 0.01 |
| 36 | + :output-token-cost 0.02 |
| 37 | + :input-cache-creation-token-cost 0.005 |
| 38 | + :input-cache-read-token-cost 0.001}] |
39 | 39 | (testing "basic input/output cost" |
40 | | - (is (= "0.70" (shared/tokens->cost 30 nil nil 20 "provider/my-model" db)))) |
| 40 | + (is (= "0.70" (shared/tokens->cost 30 nil nil 20 model-capabilities)))) |
41 | 41 | (testing "with cache creation tokens" |
42 | | - (is (= "0.75" (shared/tokens->cost 30 10 nil 20 "provider/my-model" db)))) |
| 42 | + (is (= "0.75" (shared/tokens->cost 30 10 nil 20 model-capabilities)))) |
43 | 43 | (testing "with cache read tokens" |
44 | | - (is (= "0.73" (shared/tokens->cost 30 nil 30 20 "provider/my-model" db)))) |
| 44 | + (is (= "0.73" (shared/tokens->cost 30 nil 30 20 model-capabilities)))) |
45 | 45 | (testing "with both cache creation and read tokens" |
46 | | - (is (= "0.78" (shared/tokens->cost 30 10 30 20 "provider/my-model" db)))) |
| 46 | + (is (= "0.78" (shared/tokens->cost 30 10 30 20 model-capabilities)))) |
47 | 47 | (testing "returns nil when model is missing from db" |
48 | | - (is (nil? (shared/tokens->cost 30 nil nil 20 "unknown" db)))) |
| 48 | + (is (nil? (shared/tokens->cost 30 nil nil 20 {})))) |
49 | 49 | (testing "returns nil when mandatory costs are missing" |
50 | | - (is (nil? (shared/tokens->cost 30 nil nil 20 "my-model-missing" |
51 | | - {:models {"my-model-missing" {:input-token-cost 0.01}}})))))) |
| 50 | + (is (nil? (shared/tokens->cost 30 nil nil 20 {:input-token-cost 0.01})))))) |
0 commit comments