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,40 @@
```php title="PHP"
<?php
declare(strict_types=1);
use Kreuzberg\Kreuzberg;
use function Kreuzberg\batch_extract_files_async;
$kreuzberg = new Kreuzberg();
// Async batch file extraction
$files = ['doc1.pdf', 'doc2.docx', 'doc3.xlsx'];
$deferred = $kreuzberg->batchExtractFilesAsync($files);
// Do other work while extraction runs...
processOtherTasks();
// Block until all results are ready
$results = $deferred->getResults();
foreach ($results as $i => $result) {
echo "{$files[$i]}: " . strlen($result->content) . " chars\n";
}
// With timeout
$deferred = $kreuzberg->batchExtractFilesAsync($files);
$results = $deferred->waitBatch(10000); // 10 second timeout
if ($results !== null) {
foreach ($results as $result) {
echo $result->content . "\n";
}
} else {
echo "Batch extraction timed out\n";
}
// Procedural API
$deferred = batch_extract_files_async($files);
$results = $deferred->getResults();
```