Chunx.Chunker behaviour (chunx v0.1.0)

Copy Markdown View Source

Defines the interface for text chunking strategies.

Summary

Callbacks

Splits text into chunks using the given tokenizer.

Callbacks

chunk(text, tokenizer, opts)

@callback chunk(
  text :: String.t(),
  tokenizer :: Tokenizers.Tokenizer.t(),
  opts :: keyword()
) ::
  {:ok, [Chunx.Chunk.t()]} | {:error, any()}

Splits text into chunks using the given tokenizer.

Parameters

  • text - The text to chunk
  • tokenizer - The tokenizer to use
  • opts - Options specific to the chunking strategy