Skip to main content
Version: latest

agrag.ingestion.merge.resolve_description

resolve_description(candidates:list[object], *, settings:Any | None = None, client:Any | None = None, tracer:Tracer | None = None, type_descriptions:Sequence[SchemaTypeDescription] | None = None, llm_enabled:bool = True) -> tuple[object, bool, StageFailure | None]

Resolve a description field, trying LLM summarization.

A single distinct candidate needs no LLM call. Multiple candidates try LLM summarization. On failure, fall back to concatenation. Inside no_llm_descriptions(), multiple candidates join without a call.

Parameters:

  • candidates (list[object]) – Candidate values in encounter order.
  • settings (Any | None) – LLM settings for summarization. When omitted, load them from the environment. With no configured endpoint, join the descriptions and report a stage failure.
  • client (Any | None) – An already-built BAML client for tests.
  • tracer (Tracer | None) – Opens the agrag.merge.resolve_description span and the LLM call spans below it.
  • type_descriptions (Sequence[SchemaTypeDescription] | None) – Declared entity types for this batch, with their descriptions. Passed to the model as data.
  • llm_enabled (bool) – Whether a model may summarize. False joins the distinct values without loading LLM settings or calling a model.

Returns:

  • tuple[object, bool, StageFailure | None] – The resolved value, whether it conflicted, and an optional failure.