Skip to content

Commit ad590c8

Browse files
jeffpauldkotter
andauthored
Merge pull request #361 from dkotter/update/preferred-models
Update our preferred models Co-authored-by: dkotter <dkotter@git.wordpress.org>
2 parents 588d786 + c1c4dab commit ad590c8

File tree

2 files changed

+56
-48
lines changed

2 files changed

+56
-48
lines changed

includes/helpers.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,23 @@ function get_preferred_models_for_text_generation(): array {
143143
$preferred_models = array(
144144
array(
145145
'anthropic',
146-
'claude-haiku-4-5',
146+
'claude-sonnet-4-6',
147+
),
148+
array(
149+
'google',
150+
'gemini-3-flash-preview',
147151
),
148152
array(
149153
'google',
150154
'gemini-2.5-flash',
151155
),
152156
array(
153157
'openai',
154-
'gpt-4o-mini',
158+
'gpt-5.4-mini',
155159
),
156160
array(
157161
'openai',
158-
'gpt-4.1',
162+
'gpt-4.1-mini',
159163
),
160164
);
161165

@@ -235,18 +239,10 @@ function get_preferred_image_models(): array {
235239
'openai',
236240
'gpt-image-1.5',
237241
),
238-
array(
239-
'openai',
240-
'gpt-image-1',
241-
),
242242
array(
243243
'openai',
244244
'gpt-image-1-mini',
245245
),
246-
array(
247-
'openai',
248-
'dall-e-3',
249-
),
250246
);
251247

252248
/**
@@ -271,15 +267,23 @@ function get_preferred_vision_models(): array {
271267
$preferred_models = array(
272268
array(
273269
'anthropic',
274-
'claude-haiku-4-5-20251001',
270+
'claude-sonnet-4-6',
271+
),
272+
array(
273+
'google',
274+
'gemini-3-flash-preview',
275275
),
276276
array(
277277
'google',
278278
'gemini-2.5-flash',
279279
),
280280
array(
281281
'openai',
282-
'gpt-5-nano',
282+
'gpt-5.4-mini',
283+
),
284+
array(
285+
'openai',
286+
'gpt-4.1-mini',
283287
),
284288
);
285289

tests/Integration/Includes/HelpersTest.php

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -280,31 +280,37 @@ public function test_get_preferred_models_for_text_generation_returns_array() {
280280
public function test_get_preferred_models_for_text_generation_returns_default_models() {
281281
$result = \WordPress\AI\get_preferred_models_for_text_generation();
282282

283-
$this->assertCount( 4, $result, 'Should have 4 preferred models' );
283+
$this->assertCount( 5, $result, 'Should have 5 preferred models' );
284284

285285
// Check first model (anthropic).
286286
$this->assertIsArray( $result[0], 'First model should be an array' );
287287
$this->assertCount( 2, $result[0], 'First model should have 2 elements' );
288288
$this->assertEquals( 'anthropic', $result[0][0], 'First model provider should be anthropic' );
289-
$this->assertEquals( 'claude-haiku-4-5', $result[0][1], 'First model name should be claude-haiku-4-5' );
289+
$this->assertEquals( 'claude-sonnet-4-6', $result[0][1], 'First model name should be claude-sonnet-4-6' );
290290

291291
// Check second model (google).
292292
$this->assertIsArray( $result[1], 'Second model should be an array' );
293293
$this->assertCount( 2, $result[1], 'Second model should have 2 elements' );
294294
$this->assertEquals( 'google', $result[1][0], 'Second model provider should be google' );
295-
$this->assertEquals( 'gemini-2.5-flash', $result[1][1], 'Second model name should be gemini-2.5-flash' );
295+
$this->assertEquals( 'gemini-3-flash-preview', $result[1][1], 'Second model name should be gemini-3-flash-preview' );
296296

297-
// Check third model (openai).
297+
// Check third model (google).
298298
$this->assertIsArray( $result[2], 'Third model should be an array' );
299299
$this->assertCount( 2, $result[2], 'Third model should have 2 elements' );
300-
$this->assertEquals( 'openai', $result[2][0], 'Third model provider should be openai' );
301-
$this->assertEquals( 'gpt-4o-mini', $result[2][1], 'Third model name should be gpt-4o-mini' );
300+
$this->assertEquals( 'google', $result[2][0], 'Third model provider should be google' );
301+
$this->assertEquals( 'gemini-2.5-flash', $result[2][1], 'Third model name should be gemini-2.5-flash' );
302302

303303
// Check fourth model (openai).
304304
$this->assertIsArray( $result[3], 'Fourth model should be an array' );
305305
$this->assertCount( 2, $result[3], 'Fourth model should have 2 elements' );
306306
$this->assertEquals( 'openai', $result[3][0], 'Fourth model provider should be openai' );
307-
$this->assertEquals( 'gpt-4.1', $result[3][1], 'Fourth model name should be gpt-4.1' );
307+
$this->assertEquals( 'gpt-5.4-mini', $result[3][1], 'Fourth model name should be gpt-5.4-mini' );
308+
309+
// Check fifth model (openai).
310+
$this->assertIsArray( $result[4], 'Fifth model should be an array' );
311+
$this->assertCount( 2, $result[4], 'Fifth model should have 2 elements' );
312+
$this->assertEquals( 'openai', $result[4][0], 'Fifth model provider should be openai' );
313+
$this->assertEquals( 'gpt-4.1-mini', $result[4][1], 'Fifth model name should be gpt-4.1-mini' );
308314
}
309315

310316
/**
@@ -327,9 +333,9 @@ static function ( $models ) {
327333

328334
$result = \WordPress\AI\get_preferred_models_for_text_generation();
329335

330-
$this->assertCount( 5, $result, 'Should have 5 models after filter' );
331-
$this->assertEquals( 'custom', $result[4][0], 'Fifth model provider should be custom' );
332-
$this->assertEquals( 'custom-model', $result[4][1], 'Fifth model name should be custom-model' );
336+
$this->assertCount( 6, $result, 'Should have 6 models after filter' );
337+
$this->assertEquals( 'custom', $result[5][0], 'Sixth model provider should be custom' );
338+
$this->assertEquals( 'custom-model', $result[5][1], 'Sixth model name should be custom-model' );
333339

334340
remove_all_filters( 'wpai_preferred_text_models' );
335341
}
@@ -382,7 +388,7 @@ public function test_get_preferred_image_models_returns_array() {
382388
public function test_get_preferred_image_models_returns_default_models() {
383389
$result = \WordPress\AI\get_preferred_image_models();
384390

385-
$this->assertCount( 8, $result, 'Should have 7 preferred image models' );
391+
$this->assertCount( 6, $result, 'Should have 6 preferred image models' );
386392

387393
// Check first model (google).
388394
$this->assertIsArray( $result[0], 'First model should be an array' );
@@ -418,19 +424,7 @@ public function test_get_preferred_image_models_returns_default_models() {
418424
$this->assertIsArray( $result[5], 'Sixth model should be an array' );
419425
$this->assertCount( 2, $result[5], 'Sixth model should have 2 elements' );
420426
$this->assertEquals( 'openai', $result[5][0], 'Sixth model provider should be openai' );
421-
$this->assertEquals( 'gpt-image-1', $result[5][1], 'Sixth model name should be gpt-image-1' );
422-
423-
// Check seventh model (openai).
424-
$this->assertIsArray( $result[6], 'Seventh model should be an array' );
425-
$this->assertCount( 2, $result[6], 'Seventh model should have 2 elements' );
426-
$this->assertEquals( 'openai', $result[6][0], 'Seventh model provider should be openai' );
427-
$this->assertEquals( 'gpt-image-1-mini', $result[6][1], 'Seventh model name should be gpt-image-1-mini' );
428-
429-
// Check eight model (openai).
430-
$this->assertIsArray( $result[7], 'Eighth model should be an array' );
431-
$this->assertCount( 2, $result[7], 'Eighth model should have 2 elements' );
432-
$this->assertEquals( 'openai', $result[7][0], 'Eighth model provider should be openai' );
433-
$this->assertEquals( 'dall-e-3', $result[7][1], 'Eighth model name should be dall-e-3' );
427+
$this->assertEquals( 'gpt-image-1-mini', $result[5][1], 'Sixth model name should be gpt-image-1' );
434428
}
435429

436430
/**
@@ -453,9 +447,9 @@ static function ( $models ) {
453447

454448
$result = \WordPress\AI\get_preferred_image_models();
455449

456-
$this->assertCount( 9, $result, 'Should have 9 models after filter' );
457-
$this->assertEquals( 'custom', $result[8][0], 'Ninth model provider should be custom' );
458-
$this->assertEquals( 'custom-image-model', $result[8][1], 'Ninth model name should be custom-image-model' );
450+
$this->assertCount( 7, $result, 'Should have 7 models after filter' );
451+
$this->assertEquals( 'custom', $result[6][0], 'Seventh model provider should be custom' );
452+
$this->assertEquals( 'custom-image-model', $result[6][1], 'Seventh model name should be custom-image-model' );
459453

460454
remove_all_filters( 'wpai_preferred_image_models' );
461455
}
@@ -508,22 +502,32 @@ public function test_get_preferred_vision_models_returns_array() {
508502
public function test_get_preferred_vision_models_returns_default_models() {
509503
$result = \WordPress\AI\get_preferred_vision_models();
510504

511-
$this->assertCount( 3, $result, 'Should have 3 preferred vision models' );
505+
$this->assertCount( 5, $result, 'Should have 5 preferred vision models' );
512506

513507
$this->assertIsArray( $result[0], 'First model should be an array' );
514508
$this->assertCount( 2, $result[0], 'First model should have 2 elements' );
515509
$this->assertEquals( 'anthropic', $result[0][0], 'First model provider should be anthropic' );
516-
$this->assertEquals( 'claude-haiku-4-5-20251001', $result[0][1], 'First model name should be claude-haiku-4-5-20251001' );
510+
$this->assertEquals( 'claude-sonnet-4-6', $result[0][1], 'First model name should be claude-sonnet-4-6' );
517511

518512
$this->assertIsArray( $result[1], 'Second model should be an array' );
519513
$this->assertCount( 2, $result[1], 'Second model should have 2 elements' );
520514
$this->assertEquals( 'google', $result[1][0], 'Second model provider should be google' );
521-
$this->assertEquals( 'gemini-2.5-flash', $result[1][1], 'Second model name should be gemini-2.5-flash' );
515+
$this->assertEquals( 'gemini-3-flash-preview', $result[1][1], 'Second model name should be gemini-3-flash-preview' );
522516

523517
$this->assertIsArray( $result[2], 'Third model should be an array' );
524518
$this->assertCount( 2, $result[2], 'Third model should have 2 elements' );
525-
$this->assertEquals( 'openai', $result[2][0], 'Third model provider should be openai' );
526-
$this->assertEquals( 'gpt-5-nano', $result[2][1], 'Third model name should be gpt-5-nano' );
519+
$this->assertEquals( 'google', $result[2][0], 'Third model provider should be google' );
520+
$this->assertEquals( 'gemini-2.5-flash', $result[2][1], 'Third model name should be gemini-2.5-flash' );
521+
522+
$this->assertIsArray( $result[3], 'Fourth model should be an array' );
523+
$this->assertCount( 2, $result[3], 'Fourth model should have 2 elements' );
524+
$this->assertEquals( 'openai', $result[3][0], 'Fourth model provider should be openai' );
525+
$this->assertEquals( 'gpt-5.4-mini', $result[3][1], 'Fourth model name should be gpt-5.4-mini' );
526+
527+
$this->assertIsArray( $result[4], 'Fifth model should be an array' );
528+
$this->assertCount( 2, $result[4], 'Fifth model should have 2 elements' );
529+
$this->assertEquals( 'openai', $result[4][0], 'Fifth model provider should be openai' );
530+
$this->assertEquals( 'gpt-4.1-mini', $result[4][1], 'Fifth model name should be gpt-4.1-mini' );
527531
}
528532

529533
/**
@@ -545,9 +549,9 @@ static function ( $models ) {
545549

546550
$result = \WordPress\AI\get_preferred_vision_models();
547551

548-
$this->assertCount( 4, $result, 'Should have 4 models after filter' );
549-
$this->assertEquals( 'custom', $result[3][0], 'Fourth model provider should be custom' );
550-
$this->assertEquals( 'custom-vision-model', $result[3][1], 'Fourth model name should be custom-vision-model' );
552+
$this->assertCount( 6, $result, 'Should have 6 models after filter' );
553+
$this->assertEquals( 'custom', $result[5][0], 'Sixth model provider should be custom' );
554+
$this->assertEquals( 'custom-vision-model', $result[5][1], 'Sixth model name should be custom-vision-model' );
551555

552556
remove_all_filters( 'wpai_preferred_vision_models' );
553557
}

0 commit comments

Comments
 (0)