Files
fil/docs/snippets/python/utils/token_reduction.md
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

452 B

import asyncio
from kreuzberg import ExtractionConfig, TokenReductionConfig, extract_file

async def main() -> None:
    config: ExtractionConfig = ExtractionConfig(
        token_reduction=TokenReductionConfig(
            mode="moderate", preserve_important_words=True
        )
    )
    result = await extract_file("document.pdf", config=config)
    print(f"Content length: {len(result.content)}")

asyncio.run(main())