fastrag.ingestion.steps.chunking.refinement#

Opt-in, bounded chat boundary selection; source text is never rewritten.

Classes

ChatBoundaryRefiner(*, llm, identity[, ...])

Reuse an injected ChatModel with explicit permission and nonsecret identity.

RefinementResult([boundaries, calls, ...])

Validated proposal and runtime-only observations for a single request.

class fastrag.ingestion.steps.chunking.refinement.RefinementResult(boundaries=(), calls=0, cache_hit=False, fallback=None)[source]#

Bases: object

Validated proposal and runtime-only observations for a single request.

Parameters:
class fastrag.ingestion.steps.chunking.refinement.ChatBoundaryRefiner(*, llm, identity, allow_external_transmission=False, timeout=30.0, retries=0, backoff=0.1, concurrency=2, max_input_chars=12000, max_response_chars=16000, cache_size=0)[source]#

Bases: object

Reuse an injected ChatModel with explicit permission and nonsecret identity.

identity must distinguish endpoint/model/generation settings without containing secrets. The strategy never examines provider credentials. Successful proposals optionally cache in an instance-local bounded LRU. Configure the provider’s own output-token limit to bound response generation.

Parameters:
config()[source]#

Nonsecret complete strategy identity for pipeline/response caches.

Return type:

dict[str, Any]

property cache_entries: int#

Current bounded response-cache occupancy, without source exposure.

async refine(*, node_id, text, allowed)[source]#

Select validated offsets; all ordinary failures become local fallback.

Parameters:
Return type:

RefinementResult