This commit is contained in:
16
docs/snippets/wasm/utils/token_reduction_example.md
Normal file
16
docs/snippets/wasm/utils/token_reduction_example.md
Normal file
@@ -0,0 +1,16 @@
|
||||
```typescript title="WASM"
|
||||
import init, { extractFile } from "kreuzberg-wasm";
|
||||
|
||||
await init();
|
||||
|
||||
const config = {
|
||||
tokenReduction: {
|
||||
mode: "moderate",
|
||||
preserveImportantWords: true,
|
||||
},
|
||||
};
|
||||
|
||||
const result = await extractFile("verbose_document.pdf", undefined, config);
|
||||
console.log(`Content length: ${result.content.length}`);
|
||||
console.log(`MIME type: ${result.mimeType}`);
|
||||
```
|
||||
Reference in New Issue
Block a user