Skip to content

Commit 68ac58e

Browse files
committed
feature #493 [Platform] Rename FileNormalizer to DocumentNormalizer in OpenAI contract (OskarStark)
This PR was merged into the main branch. Discussion ---------- [Platform] Rename `FileNormalizer` to `DocumentNormalizer` in OpenAI contract | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | no | Issues | -- | License | MIT This change renames the `FileNormalizer` to `DocumentNormalizer` in the OpenAI contract to better reflect its purpose of normalizing document files. Commits ------- e522482 Rename FileNormalizer to DocumentNormalizer in OpenAI contract
2 parents 5b1d0c9 + e522482 commit 68ac58e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/platform/src/Bridge/OpenAi/Contract/FileNormalizer.php renamed to src/platform/src/Bridge/OpenAi/Contract/DocumentNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* @author Guillermo Lengemann <guillermo.lengemann@gmail.com>
2121
*/
22-
class FileNormalizer extends ModelContractNormalizer
22+
class DocumentNormalizer extends ModelContractNormalizer
2323
{
2424
/**
2525
* @param File $data

src/platform/src/Bridge/OpenAi/Contract/OpenAiContract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static function create(NormalizerInterface ...$normalizer): Contract
2424
{
2525
return parent::create(
2626
new AudioNormalizer(),
27-
new FileNormalizer(),
27+
new DocumentNormalizer(),
2828
...$normalizer
2929
);
3030
}

src/platform/tests/Bridge/OpenAi/Contract/DocumentNormalizerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
use PHPUnit\Framework\Attributes\DataProvider;
1616
use PHPUnit\Framework\Attributes\Medium;
1717
use PHPUnit\Framework\TestCase;
18-
use Symfony\AI\Platform\Bridge\OpenAi\Contract\FileNormalizer;
18+
use Symfony\AI\Platform\Bridge\OpenAi\Contract\DocumentNormalizer;
1919
use Symfony\AI\Platform\Bridge\OpenAi\Gpt;
2020
use Symfony\AI\Platform\Contract;
2121
use Symfony\AI\Platform\Contract\Normalizer\Message\MessageBagNormalizer;
2222
use Symfony\AI\Platform\Message\Content\Document;
2323
use Symfony\AI\Platform\Message\Content\File;
2424

2525
#[Medium]
26-
#[CoversClass(FileNormalizer::class)]
26+
#[CoversClass(DocumentNormalizer::class)]
2727
#[CoversClass(MessageBagNormalizer::class)]
2828
final class DocumentNormalizerTest extends TestCase
2929
{
3030
public function testSupportsNormalization()
3131
{
32-
$normalizer = new FileNormalizer();
32+
$normalizer = new DocumentNormalizer();
3333

3434
$this->assertTrue($normalizer->supportsNormalization(new Document('some content', 'application/pdf'), context: [
3535
Contract::CONTEXT_MODEL => new Gpt(),
@@ -42,7 +42,7 @@ public function testSupportsNormalization()
4242

4343
public function testGetSupportedTypes()
4444
{
45-
$normalizer = new FileNormalizer();
45+
$normalizer = new DocumentNormalizer();
4646

4747
$expected = [
4848
File::class => true,
@@ -54,7 +54,7 @@ public function testGetSupportedTypes()
5454
#[DataProvider('normalizeDataProvider')]
5555
public function testNormalize(File $file, array $expected)
5656
{
57-
$normalizer = new FileNormalizer();
57+
$normalizer = new DocumentNormalizer();
5858

5959
$normalized = $normalizer->normalize($file);
6060

0 commit comments

Comments
 (0)