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,38 @@
```elixir title="Elixir"
defmodule MinLengthValidator do
@behaviour Kreuzberg.Plugin.Validator
@min_length 50
def name, do: "min_length_validator"
def validate(result) do
if String.length(result.content) >= @min_length do
:ok
else
{:error, "Content too short"}
end
end
def should_validate?(_result), do: true
def priority, do: 1
def initialize, do: :ok
def shutdown, do: :ok
def version, do: "1.0.0"
end
# Register the validator
Kreuzberg.Plugin.register_validator(MinLengthValidator)
# Example usage with extraction
{:ok, result} = Kreuzberg.extract_file(
"document.pdf",
nil
)
case result do
result ->
IO.puts("Extraction successful")
IO.puts("Content length: #{String.length(result.content)}")
end
```