Commit b396671
Mateusz
fix(types): widen UsageNormalizer signatures to match actual runtime behavior
- Add UsageSummary to normalize() parameter type (was handled at runtime
but not declared in the signature)
- Change merge_streaming_usage() params to accept None and dict[str, Any]
(was handling None at runtime but typed as dict[str, int])
- Change merge_streaming_usage() return type to dict[str, Any] to reflect
that it preserves nested dicts (completion_tokens_details, cost, etc.)
- Remove unreachable isinstance(usage, dict) guard after type narrowing1 parent b8193f3 commit b396671
2 files changed
Lines changed: 11 additions & 16 deletions
File tree
- src/core/transport/fastapi/adapters/usage
- tests/unit/transport/fastapi/adapters/usage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 66 | | |
72 | 67 | | |
73 | 68 | | |
| |||
180 | 175 | | |
181 | 176 | | |
182 | 177 | | |
183 | | - | |
184 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
185 | 182 | | |
186 | 183 | | |
187 | 184 | | |
188 | | - | |
189 | | - | |
| 185 | + | |
| 186 | + | |
190 | 187 | | |
191 | 188 | | |
192 | 189 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
182 | | - | |
| 180 | + | |
183 | 181 | | |
184 | 182 | | |
185 | 183 | | |
| |||
0 commit comments