We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b38681d commit 0e3722fCopy full SHA for 0e3722f
src/codemodder/llm.py
@@ -127,7 +127,13 @@ class TokenUsage:
127
completion_tokens: int = 0
128
prompt_tokens: int = 0
129
130
- def __iadd__(self, other: Self) -> Self:
+ def __add__(self, other: TokenUsage) -> TokenUsage:
131
+ return TokenUsage(
132
+ completion_tokens=self.completion_tokens + other.completion_tokens,
133
+ prompt_tokens=self.prompt_tokens + other.prompt_tokens,
134
+ )
135
+
136
+ def __iadd__(self, other: TokenUsage) -> Self:
137
self.completion_tokens += other.completion_tokens
138
self.prompt_tokens += other.prompt_tokens
139
return self
0 commit comments