Structure representing a text chunk with embedding for semantic search.
Matches the Rust Chunk struct.
Fields
:content- The text content of this chunk:embedding- Vector embedding (list of floats) for semantic search:metadata- ChunkMetadata struct with position and token info
Summary
Functions
Creates a Chunk struct from a map.
Creates a new Chunk struct.
Converts a Chunk struct to a map.
Types
@type t() :: %Kreuzberg.Chunk{ content: String.t(), embedding: [float()] | nil, metadata: Kreuzberg.ChunkMetadata.t() }
Functions
Creates a Chunk struct from a map.
Examples
iex> Kreuzberg.Chunk.from_map(%{"content" => "chunk text", "embedding" => [0.1, 0.2]})
%Kreuzberg.Chunk{content: "chunk text", embedding: [0.1, 0.2]}
Creates a new Chunk struct.
Parameters
content- The text content of the chunkopts- Optional keyword list with:embeddingand:metadata
Converts a Chunk struct to a map.