LangExtract.ChunkResult (LangExtract v0.9.0)

Copy Markdown View Source

A successfully processed chunk: its byte range in the source and the spans extracted from it.

The per-chunk success unit yielded by LangExtract.stream/4, sibling of LangExtract.ChunkError. Span byte offsets are already adjusted to the original document, not the chunk.

Summary

Functions

Builds a result carrying chunk's byte range and the request's usage.

Types

t()

@type t() :: %LangExtract.ChunkResult{
  byte_end: non_neg_integer(),
  byte_start: non_neg_integer(),
  spans: [LangExtract.Span.t()],
  usage: LangExtract.Provider.Response.usage() | nil
}

Functions

from_chunk(chunk, spans, usage \\ nil)

Builds a result carrying chunk's byte range and the request's usage.