Version: latest
agrag.ingestion.extract.convert_reply
convert_reply(reply:ExtractionReply, chunk:Chunk, schema:GraphSchema) -> ExtractionResult
Turn one typed reply into an extraction result for a single chunk.
Known entities keep the spans locate_mentions finds in chunk.text.
A proposed type is saved as a candidate only when its label is valid and
its text is in the chunk. Candidates store names as the chunk spells them,
and a name without letters or digits is dropped. A declared relation whose
endpoint pair the
schema rejects becomes an off_pattern candidate. A relation touching a
proposed entity becomes a proposed_type candidate and converts after
that type is approved. Every item not kept produces one counted drop. LLM
candidates carry no confidence.
Parameters:
- reply (
ExtractionReply) – The model reply, already parsed into the shared reply model. - chunk (
Chunk) – The chunk the model read. Its id must be set. - schema (
GraphSchema) – The types extraction validates against.
Returns:
ExtractionResult– The entities, relations, candidates and drop counts for this chunk.
Raises:
ValueError–chunk.idisNone.