This commit is contained in:
17
docs/snippets/elixir/advanced/token_reduction_config.md
Normal file
17
docs/snippets/elixir/advanced/token_reduction_config.md
Normal file
@@ -0,0 +1,17 @@
|
||||
```elixir title="Elixir"
|
||||
config_json = Jason.encode!(%{
|
||||
"token_reduction" => %{
|
||||
"mode" => "moderate",
|
||||
"preserve_markdown" => true
|
||||
}
|
||||
})
|
||||
|
||||
{:ok, result} = Kreuzberg.extract_file_sync("verbose_document.pdf", "application/pdf", config_json)
|
||||
|
||||
if result.original_token_count do
|
||||
IO.puts("Original tokens: #{result.original_token_count}")
|
||||
end
|
||||
if result.reduced_token_count do
|
||||
IO.puts("Reduced tokens: #{result.reduced_token_count}")
|
||||
end
|
||||
```
|
||||
Reference in New Issue
Block a user