Skip to content

Commit

Permalink
Add test for Encoding class
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Oct 13, 2024
1 parent 80c69a3 commit d91b3de
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/php/com/openai/unittest/EncodingTest.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php namespace com\openai\unittest;

use com\openai\Encoding;
use test\{Assert, Test, Values};

class EncodingTest {

#[Test]
public function named() {
Assert::equals(Encoding::$cl100k_base, Encoding::named('cl100k_base'));
}

#[Test, Values(['gpt-4o', 'gpt-4o-2024-05-13', 'o1-preview', 'omni'])]
public function for_omni_and_o1($model) {
Assert::equals(Encoding::$o200k_base, Encoding::for($model));
}

#[Test, Values(['gpt-4', 'gpt-4-0314', 'gpt-3.5-turbo-0301', 'gpt-35'])]
public function for_gpt35_and_40($model) {
Assert::equals(Encoding::$cl100k_base, Encoding::for($model));
}
}

0 comments on commit d91b3de

Please sign in to comment.