Nomad changes
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s

This commit is contained in:
Henrik Jess Nielsen
2026-06-01 23:40:55 +02:00
parent 72b1a0a6ed
commit b4c07d3693
5723 changed files with 1130655 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
```php title="PHP"
<?php
declare(strict_types=1);
use Kreuzberg\Kreuzberg;
use Kreuzberg\ExtractionConfig;
use Kreuzberg\ChunkingConfig;
use Kreuzberg\EmbeddingConfig;
$config = new ExtractionConfig(
chunking: new ChunkingConfig(
maxCharacters: 500,
overlap: 50,
embedding: new EmbeddingConfig(
normalize: true,
batchSize: 32
)
)
);
$result = Kreuzberg::extractFileSync('research_paper.pdf', null, $config);
if ($result->getChunks()) {
foreach ($result->getChunks() as $chunk) {
$metadata = $chunk->getMetadata();
if ($metadata) {
echo "Chunk " . ($metadata->getChunkIndex() + 1) . "/" . $metadata->getTotalChunks() . "\n";
echo "Position: " . $metadata->getByteStart() . "-" . $metadata->getByteEnd() . "\n";
echo "Content: " . substr($chunk->getContent(), 0, 100) . "...\n";
if ($chunk->getEmbedding()) {
echo "Embedding: " . count($chunk->getEmbedding()) . " dimensions\n";
}
}
echo "\n";
}
}
?>
```