13
13
14
14
/**
15
15
* @author Junaid Farooq <[email protected] >
16
- *
17
- * @phpstan-type TokenUsageArray array{
18
- * prompt_tokens: ?int,
19
- * completion_tokens: ?int,
20
- * thinking_tokens: ?int,
21
- * cached_tokens: ?int,
22
- * remaining_tokens: ?int,
23
- * remaining_tokens_minute: ?int,
24
- * remaining_tokens_month: ?int,
25
- * total_tokens: ?int,
26
- * }
27
16
*/
28
17
final class TokenUsage implements \JsonSerializable
29
18
{
@@ -40,9 +29,18 @@ public function __construct(
40
29
}
41
30
42
31
/**
43
- * @return TokenUsageArray
32
+ * @return array{
33
+ * prompt_tokens: ?int,
34
+ * completion_tokens: ?int,
35
+ * thinking_tokens: ?int,
36
+ * cached_tokens: ?int,
37
+ * remaining_tokens: ?int,
38
+ * remaining_tokens_minute: ?int,
39
+ * remaining_tokens_month: ?int,
40
+ * total_tokens: ?int,
41
+ * }
44
42
*/
45
- public function toArray (): array
43
+ public function jsonSerialize (): array
46
44
{
47
45
return [
48
46
'prompt_tokens ' => $ this ->promptTokens ,
@@ -55,12 +53,4 @@ public function toArray(): array
55
53
'total_tokens ' => $ this ->totalTokens ,
56
54
];
57
55
}
58
-
59
- /**
60
- * @return TokenUsageArray
61
- */
62
- public function jsonSerialize (): array
63
- {
64
- return $ this ->toArray ();
65
- }
66
56
}
0 commit comments