@@ -39,12 +39,10 @@ public function testCreateWithBasicProperties(): void
39
39
$ candidate = new Candidate (
40
40
$ message ,
41
41
FinishReasonEnum::stop (),
42
- 25
43
42
);
44
43
45
44
$ this ->assertSame ($ message , $ candidate ->getMessage ());
46
45
$ this ->assertEquals (FinishReasonEnum::stop (), $ candidate ->getFinishReason ());
47
- $ this ->assertEquals (25 , $ candidate ->getTokenCount ());
48
46
}
49
47
50
48
/**
@@ -58,7 +56,7 @@ public function testWithDifferentFinishReasons(FinishReasonEnum $finishReason):
58
56
{
59
57
$ message = new ModelMessage ([new MessagePart ('Response ' )]);
60
58
61
- $ candidate = new Candidate ($ message , $ finishReason, 10 );
59
+ $ candidate = new Candidate ($ message , $ finishReason );
62
60
63
61
$ this ->assertEquals ($ finishReason , $ candidate ->getFinishReason ());
64
62
}
@@ -103,13 +101,11 @@ public function testWithComplexMessage(): void
103
101
104
102
$ candidate = new Candidate (
105
103
$ message ,
106
- FinishReasonEnum::toolCalls (),
107
- 150
104
+ FinishReasonEnum::toolCalls ()
108
105
);
109
106
110
107
$ this ->assertCount (6 , $ candidate ->getMessage ()->getParts ());
111
108
$ this ->assertTrue ($ candidate ->getFinishReason ()->isToolCalls ());
112
- $ this ->assertEquals (150 , $ candidate ->getTokenCount ());
113
109
}
114
110
115
111
/**
@@ -134,7 +130,6 @@ public function testWithMessageContainingFiles(): void
134
130
$ candidate = new Candidate (
135
131
$ message ,
136
132
FinishReasonEnum::stop (),
137
- 85
138
133
);
139
134
140
135
$ parts = $ candidate ->getMessage ()->getParts ();
@@ -143,42 +138,6 @@ public function testWithMessageContainingFiles(): void
143
138
$ this ->assertEquals ('The image shows a flowchart of the process. ' , $ parts [2 ]->getText ());
144
139
}
145
140
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
-
182
141
/**
183
142
* Tests candidate rejects non-model message.
184
143
*
@@ -195,8 +154,7 @@ public function testRejectsNonModelMessage(): void
195
154
196
155
new Candidate (
197
156
$ userMessage ,
198
- FinishReasonEnum::stop (),
199
- 10
157
+ FinishReasonEnum::stop ()
200
158
);
201
159
}
202
160
@@ -217,8 +175,7 @@ public function testRejectsMessageWithDifferentRole(): void
217
175
218
176
new Candidate (
219
177
$ message ,
220
- FinishReasonEnum::stop (),
221
- 10
178
+ FinishReasonEnum::stop ()
222
179
);
223
180
}
224
181
@@ -238,7 +195,6 @@ public function testJsonSchema(): void
238
195
$ this ->assertArrayHasKey ('properties ' , $ schema );
239
196
$ this ->assertArrayHasKey (Candidate::KEY_MESSAGE , $ schema ['properties ' ]);
240
197
$ this ->assertArrayHasKey (Candidate::KEY_FINISH_REASON , $ schema ['properties ' ]);
241
- $ this ->assertArrayHasKey (Candidate::KEY_TOKEN_COUNT , $ schema ['properties ' ]);
242
198
243
199
// Check finishReason property
244
200
$ finishReasonSchema = $ schema ['properties ' ][Candidate::KEY_FINISH_REASON ];
@@ -250,16 +206,9 @@ public function testJsonSchema(): void
250
206
$ this ->assertContains ('tool_calls ' , $ finishReasonSchema ['enum ' ]);
251
207
$ this ->assertContains ('error ' , $ finishReasonSchema ['enum ' ]);
252
208
253
- // Check tokenCount property
254
- $ tokenCountSchema = $ schema ['properties ' ][Candidate::KEY_TOKEN_COUNT ];
255
- $ this ->assertEquals ('integer ' , $ tokenCountSchema ['type ' ]);
256
-
257
209
// Check required fields
258
210
$ 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 ' ]);
263
212
}
264
213
265
214
/**
@@ -273,12 +222,10 @@ public function testWithEmptyMessageParts(): void
273
222
274
223
$ candidate = new Candidate (
275
224
$ message ,
276
- FinishReasonEnum::stop (),
277
- 0
225
+ FinishReasonEnum::stop ()
278
226
);
279
227
280
228
$ this ->assertCount (0 , $ candidate ->getMessage ()->getParts ());
281
- $ this ->assertEquals (0 , $ candidate ->getTokenCount ());
282
229
}
283
230
284
231
/**
@@ -294,12 +241,10 @@ public function testWithMaxLengthFinishReason(): void
294
241
295
242
$ candidate = new Candidate (
296
243
$ message ,
297
- FinishReasonEnum::length (),
298
- 4096
244
+ FinishReasonEnum::length ()
299
245
);
300
246
301
247
$ this ->assertTrue ($ candidate ->getFinishReason ()->isLength ());
302
- $ this ->assertEquals (4096 , $ candidate ->getTokenCount ());
303
248
}
304
249
305
250
/**
@@ -315,8 +260,7 @@ public function testWithContentFilterFinishReason(): void
315
260
316
261
$ candidate = new Candidate (
317
262
$ message ,
318
- FinishReasonEnum::contentFilter (),
319
- 8
263
+ FinishReasonEnum::contentFilter ()
320
264
);
321
265
322
266
$ this ->assertTrue ($ candidate ->getFinishReason ()->isContentFilter ());
@@ -335,8 +279,7 @@ public function testWithErrorFinishReason(): void
335
279
336
280
$ candidate = new Candidate (
337
281
$ message ,
338
- FinishReasonEnum::error (),
339
- 9
282
+ FinishReasonEnum::error ()
340
283
);
341
284
342
285
$ this ->assertTrue ($ candidate ->getFinishReason ()->isError ());
@@ -356,19 +299,14 @@ public function testToArray(): void
356
299
357
300
$ candidate = new Candidate (
358
301
$ message ,
359
- FinishReasonEnum::stop (),
360
- 45
302
+ FinishReasonEnum::stop ()
361
303
);
362
304
363
305
$ json = $ this ->assertToArrayReturnsArray ($ candidate );
364
306
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 ]);
369
308
$ this ->assertIsArray ($ json [Candidate::KEY_MESSAGE ]);
370
309
$ this ->assertEquals (FinishReasonEnum::stop ()->value , $ json [Candidate::KEY_FINISH_REASON ]);
371
- $ this ->assertEquals (45 , $ json [Candidate::KEY_TOKEN_COUNT ]);
372
310
}
373
311
374
312
/**
@@ -393,14 +331,12 @@ public function testFromArray(): void
393
331
]
394
332
],
395
333
Candidate::KEY_FINISH_REASON => FinishReasonEnum::stop ()->value ,
396
- Candidate::KEY_TOKEN_COUNT => 75
397
334
];
398
335
399
336
$ candidate = Candidate::fromArray ($ json );
400
337
401
338
$ this ->assertInstanceOf (Candidate::class, $ candidate );
402
339
$ this ->assertEquals (FinishReasonEnum::stop (), $ candidate ->getFinishReason ());
403
- $ this ->assertEquals (75 , $ candidate ->getTokenCount ());
404
340
$ this ->assertCount (2 , $ candidate ->getMessage ()->getParts ());
405
341
$ this ->assertEquals ('Response text 1 ' , $ candidate ->getMessage ()->getParts ()[0 ]->getText ());
406
342
$ this ->assertEquals ('Response text 2 ' , $ candidate ->getMessage ()->getParts ()[1 ]->getText ());
@@ -419,12 +355,10 @@ public function testArrayRoundTrip(): void
419
355
new MessagePart ('Generated response ' ),
420
356
new MessagePart (new FunctionCall ('call_123 ' , 'search ' , ['q ' => 'test ' ]))
421
357
]),
422
- FinishReasonEnum::toolCalls (),
423
- 120
358
+ FinishReasonEnum::toolCalls ()
424
359
),
425
360
function ($ original , $ restored ) {
426
361
$ this ->assertEquals ($ original ->getFinishReason ()->value , $ restored ->getFinishReason ()->value );
427
- $ this ->assertEquals ($ original ->getTokenCount (), $ restored ->getTokenCount ());
428
362
$ this ->assertCount (
429
363
count ($ original ->getMessage ()->getParts ()),
430
364
$ restored ->getMessage ()->getParts ()
@@ -450,8 +384,7 @@ public function testImplementsWithArrayTransformationInterface(): void
450
384
{
451
385
$ candidate = new Candidate (
452
386
new ModelMessage ([new MessagePart ('test ' )]),
453
- FinishReasonEnum::stop (),
454
- 10
387
+ FinishReasonEnum::stop ()
455
388
);
456
389
$ this ->assertImplementsArrayTransformation ($ candidate );
457
390
}
0 commit comments