lpgcast.ground¶
The model copies a quote; LPGCast finds it in the episode and records the character offsets. Offsets are never taken from the model. A quote that cannot be found is a hallucination flag, handled by validation.
Classes¶
Grounding
¶
Bases: BaseModel
One assertion and the span of text it was read from.
Carried in the cast result only; nothing here is written to the graph.
Source code in lpgcast/ground.py
Attributes¶
char_end
instance-attribute
¶
char_start
instance-attribute
¶
edge = Field(default=None, description='Edge, for an edge or its property.')
class-attribute
instance-attribute
¶
extractor = Field(description='``lpgcast/<version>``.')
class-attribute
instance-attribute
¶
identity = Field(default=None, description='Identity of the vertex, as written or looked up by.')
class-attribute
instance-attribute
¶
in_context = Field(default=None, description="Source id of the context item the span points into; None for the episode's own text. Only identity values ground in context.")
class-attribute
instance-attribute
¶
kind
instance-attribute
¶
model = Field(default=None, description='Model that produced the reply.')
class-attribute
instance-attribute
¶
property = Field(default=None, description='Property name, for a property.')
class-attribute
instance-attribute
¶
quote = Field(description='The text at the span, as it stands in the source.')
class-attribute
instance-attribute
¶
reference_time = None
class-attribute
instance-attribute
¶
schema_ref = Field(description='``<schema name>@<version>``.')
class-attribute
instance-attribute
¶
source_id = Field(description='Episode the assertion was read from.')
class-attribute
instance-attribute
¶
source_identity = None
class-attribute
instance-attribute
¶
target_identity = None
class-attribute
instance-attribute
¶
vertex = Field(default=None, description='Vertex type, for a vertex or its property.')
class-attribute
instance-attribute
¶
Span
¶
Bases: BaseModel
Character offsets, end exclusive, into the episode's text or, when
context is set, into the text of that context item.
Source code in lpgcast/ground.py
Functions:¶
locate(quote, text, *, near=None)
¶
Find quote in text: exactly, then ignoring case, accents, whitespace runs and typographic quotes and dashes, then also without surrounding punctuation. Of several occurrences, the one nearest near wins, else the first.