This commit is contained in:
20
docs/snippets/php/advanced/token_reduction_config.md
Normal file
20
docs/snippets/php/advanced/token_reduction_config.md
Normal file
@@ -0,0 +1,20 @@
|
||||
```php title="PHP"
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Kreuzberg\Kreuzberg;
|
||||
use Kreuzberg\ExtractionConfig;
|
||||
use Kreuzberg\TokenReductionOptions;
|
||||
|
||||
$config = new ExtractionConfig(
|
||||
tokenReduction: new TokenReductionOptions(
|
||||
mode: 'moderate',
|
||||
preserveImportantWords: true
|
||||
)
|
||||
);
|
||||
|
||||
$result = Kreuzberg::extractFileSync('document.pdf', null, $config);
|
||||
|
||||
echo "Reduced content: " . substr($result->getContent(), 0, 100) . "...\n";
|
||||
?>
|
||||
```
|
||||
Reference in New Issue
Block a user