@@ -39,12 +39,10 @@ public function testCreateWithBasicProperties(): void
3939 $ candidate = new Candidate (
4040 $ message ,
4141 FinishReasonEnum::stop (),
42- 25
4342 );
4443
4544 $ this ->assertSame ($ message , $ candidate ->getMessage ());
4645 $ this ->assertEquals (FinishReasonEnum::stop (), $ candidate ->getFinishReason ());
47- $ this ->assertEquals (25 , $ candidate ->getTokenCount ());
4846 }
4947
5048 /**
@@ -58,7 +56,7 @@ public function testWithDifferentFinishReasons(FinishReasonEnum $finishReason):
5856 {
5957 $ message = new ModelMessage ([new MessagePart ('Response ' )]);
6058
61- $ candidate = new Candidate ($ message , $ finishReason, 10 );
59+ $ candidate = new Candidate ($ message , $ finishReason );
6260
6361 $ this ->assertEquals ($ finishReason , $ candidate ->getFinishReason ());
6462 }
@@ -103,13 +101,11 @@ public function testWithComplexMessage(): void
103101
104102 $ candidate = new Candidate (
105103 $ message ,
106- FinishReasonEnum::toolCalls (),
107- 150
104+ FinishReasonEnum::toolCalls ()
108105 );
109106
110107 $ this ->assertCount (6 , $ candidate ->getMessage ()->getParts ());
111108 $ this ->assertTrue ($ candidate ->getFinishReason ()->isToolCalls ());
112- $ this ->assertEquals (150 , $ candidate ->getTokenCount ());
113109 }
114110
115111 /**
@@ -134,7 +130,6 @@ public function testWithMessageContainingFiles(): void
134130 $ candidate = new Candidate (
135131 $ message ,
136132 FinishReasonEnum::stop (),
137- 85
138133 );
139134
140135 $ parts = $ candidate ->getMessage ()->getParts ();
@@ -143,42 +138,6 @@ public function testWithMessageContainingFiles(): void
143138 $ this ->assertEquals ('The image shows a flowchart of the process. ' , $ parts [2 ]->getText ());
144139 }
145140
146- /**
147- * Tests candidate with different token counts.
148- *
149- * @dataProvider tokenCountProvider
150- * @param int $tokenCount
151- * @return void
152- */
153- public function testWithDifferentTokenCounts (int $ tokenCount ): void
154- {
155- $ message = new ModelMessage ([new MessagePart ('Response ' )]);
156-
157- $ candidate = new Candidate (
158- $ message ,
159- FinishReasonEnum::stop (),
160- $ tokenCount
161- );
162-
163- $ this ->assertEquals ($ tokenCount , $ candidate ->getTokenCount ());
164- }
165-
166- /**
167- * Provides different token counts.
168- *
169- * @return array
170- */
171- public function tokenCountProvider (): array
172- {
173- return [
174- 'zero ' => [0 ],
175- 'small ' => [10 ],
176- 'medium ' => [500 ],
177- 'large ' => [4000 ],
178- 'very_large ' => [100000 ],
179- ];
180- }
181-
182141 /**
183142 * Tests candidate rejects non-model message.
184143 *
@@ -195,8 +154,7 @@ public function testRejectsNonModelMessage(): void
195154
196155 new Candidate (
197156 $ userMessage ,
198- FinishReasonEnum::stop (),
199- 10
157+ FinishReasonEnum::stop ()
200158 );
201159 }
202160
@@ -217,8 +175,7 @@ public function testRejectsMessageWithDifferentRole(): void
217175
218176 new Candidate (
219177 $ message ,
220- FinishReasonEnum::stop (),
221- 10
178+ FinishReasonEnum::stop ()
222179 );
223180 }
224181
@@ -238,7 +195,6 @@ public function testJsonSchema(): void
238195 $ this ->assertArrayHasKey ('properties ' , $ schema );
239196 $ this ->assertArrayHasKey (Candidate::KEY_MESSAGE , $ schema ['properties ' ]);
240197 $ this ->assertArrayHasKey (Candidate::KEY_FINISH_REASON , $ schema ['properties ' ]);
241- $ this ->assertArrayHasKey (Candidate::KEY_TOKEN_COUNT , $ schema ['properties ' ]);
242198
243199 // Check finishReason property
244200 $ finishReasonSchema = $ schema ['properties ' ][Candidate::KEY_FINISH_REASON ];
@@ -250,16 +206,9 @@ public function testJsonSchema(): void
250206 $ this ->assertContains ('tool_calls ' , $ finishReasonSchema ['enum ' ]);
251207 $ this ->assertContains ('error ' , $ finishReasonSchema ['enum ' ]);
252208
253- // Check tokenCount property
254- $ tokenCountSchema = $ schema ['properties ' ][Candidate::KEY_TOKEN_COUNT ];
255- $ this ->assertEquals ('integer ' , $ tokenCountSchema ['type ' ]);
256-
257209 // Check required fields
258210 $ this ->assertArrayHasKey ('required ' , $ schema );
259- $ this ->assertEquals (
260- [Candidate::KEY_MESSAGE , Candidate::KEY_FINISH_REASON , Candidate::KEY_TOKEN_COUNT ],
261- $ schema ['required ' ]
262- );
211+ $ this ->assertEquals ([Candidate::KEY_MESSAGE , Candidate::KEY_FINISH_REASON ], $ schema ['required ' ]);
263212 }
264213
265214 /**
@@ -273,12 +222,10 @@ public function testWithEmptyMessageParts(): void
273222
274223 $ candidate = new Candidate (
275224 $ message ,
276- FinishReasonEnum::stop (),
277- 0
225+ FinishReasonEnum::stop ()
278226 );
279227
280228 $ this ->assertCount (0 , $ candidate ->getMessage ()->getParts ());
281- $ this ->assertEquals (0 , $ candidate ->getTokenCount ());
282229 }
283230
284231 /**
@@ -294,12 +241,10 @@ public function testWithMaxLengthFinishReason(): void
294241
295242 $ candidate = new Candidate (
296243 $ message ,
297- FinishReasonEnum::length (),
298- 4096
244+ FinishReasonEnum::length ()
299245 );
300246
301247 $ this ->assertTrue ($ candidate ->getFinishReason ()->isLength ());
302- $ this ->assertEquals (4096 , $ candidate ->getTokenCount ());
303248 }
304249
305250 /**
@@ -315,8 +260,7 @@ public function testWithContentFilterFinishReason(): void
315260
316261 $ candidate = new Candidate (
317262 $ message ,
318- FinishReasonEnum::contentFilter (),
319- 8
263+ FinishReasonEnum::contentFilter ()
320264 );
321265
322266 $ this ->assertTrue ($ candidate ->getFinishReason ()->isContentFilter ());
@@ -335,8 +279,7 @@ public function testWithErrorFinishReason(): void
335279
336280 $ candidate = new Candidate (
337281 $ message ,
338- FinishReasonEnum::error (),
339- 9
282+ FinishReasonEnum::error ()
340283 );
341284
342285 $ this ->assertTrue ($ candidate ->getFinishReason ()->isError ());
@@ -356,19 +299,14 @@ public function testToArray(): void
356299
357300 $ candidate = new Candidate (
358301 $ message ,
359- FinishReasonEnum::stop (),
360- 45
302+ FinishReasonEnum::stop ()
361303 );
362304
363305 $ json = $ this ->assertToArrayReturnsArray ($ candidate );
364306
365- $ this ->assertArrayHasKeys (
366- $ json ,
367- [Candidate::KEY_MESSAGE , Candidate::KEY_FINISH_REASON , Candidate::KEY_TOKEN_COUNT ]
368- );
307+ $ this ->assertArrayHasKeys ($ json , [Candidate::KEY_MESSAGE , Candidate::KEY_FINISH_REASON ]);
369308 $ this ->assertIsArray ($ json [Candidate::KEY_MESSAGE ]);
370309 $ this ->assertEquals (FinishReasonEnum::stop ()->value , $ json [Candidate::KEY_FINISH_REASON ]);
371- $ this ->assertEquals (45 , $ json [Candidate::KEY_TOKEN_COUNT ]);
372310 }
373311
374312 /**
@@ -393,14 +331,12 @@ public function testFromArray(): void
393331 ]
394332 ],
395333 Candidate::KEY_FINISH_REASON => FinishReasonEnum::stop ()->value ,
396- Candidate::KEY_TOKEN_COUNT => 75
397334 ];
398335
399336 $ candidate = Candidate::fromArray ($ json );
400337
401338 $ this ->assertInstanceOf (Candidate::class, $ candidate );
402339 $ this ->assertEquals (FinishReasonEnum::stop (), $ candidate ->getFinishReason ());
403- $ this ->assertEquals (75 , $ candidate ->getTokenCount ());
404340 $ this ->assertCount (2 , $ candidate ->getMessage ()->getParts ());
405341 $ this ->assertEquals ('Response text 1 ' , $ candidate ->getMessage ()->getParts ()[0 ]->getText ());
406342 $ this ->assertEquals ('Response text 2 ' , $ candidate ->getMessage ()->getParts ()[1 ]->getText ());
@@ -419,12 +355,10 @@ public function testArrayRoundTrip(): void
419355 new MessagePart ('Generated response ' ),
420356 new MessagePart (new FunctionCall ('call_123 ' , 'search ' , ['q ' => 'test ' ]))
421357 ]),
422- FinishReasonEnum::toolCalls (),
423- 120
358+ FinishReasonEnum::toolCalls ()
424359 ),
425360 function ($ original , $ restored ) {
426361 $ this ->assertEquals ($ original ->getFinishReason ()->value , $ restored ->getFinishReason ()->value );
427- $ this ->assertEquals ($ original ->getTokenCount (), $ restored ->getTokenCount ());
428362 $ this ->assertCount (
429363 count ($ original ->getMessage ()->getParts ()),
430364 $ restored ->getMessage ()->getParts ()
@@ -450,8 +384,7 @@ public function testImplementsWithArrayTransformationInterface(): void
450384 {
451385 $ candidate = new Candidate (
452386 new ModelMessage ([new MessagePart ('test ' )]),
453- FinishReasonEnum::stop (),
454- 10
387+ FinishReasonEnum::stop ()
455388 );
456389 $ this ->assertImplementsArrayTransformation ($ candidate );
457390 }
0 commit comments