Files
fil/docs/snippets/kotlin/utils/token_reduction_example.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

20 lines
545 B
Markdown

```kotlin title="Kotlin"
import dev.kreuzberg.*
import java.nio.file.Paths
import java.util.Optional
fun main() {
val tokenReduction = TokenReductionOptions.builder()
.withMode("moderate")
.withPreserveImportantWords(true)
.build()
val config = ExtractionConfig.builder()
.withTokenReduction(Optional.of(tokenReduction))
.build()
val result = Kreuzberg.extractFileSync(Paths.get("verbose_document.pdf"), null, config)
println("Reduced content length: ${result.content().length}")
}
```