Records¶
This is an automatically generated API reference of VERA record and result types.
models
¶
Classes:
-
ChunkRecord–Immutable searchable chunk supplied by the caller.
-
AttachmentRecord–Opaque binary attachment stored in a
.veraarchive. -
AttachmentRef–Reference from a chunk to a stored attachment.
-
Citation–Typed citation fields extracted from chunk metadata.
-
QueryResult–Ranked search hit from :meth:
~vera_doc.document.VeraDocument.search.
ChunkRecord
dataclass
¶
ChunkRecord(
id: str,
text: str,
metadata: JsonObject = dict(),
vector: Sequence[float] | None = None,
attachments: tuple[AttachmentRef, ...] = (),
)
Immutable searchable chunk supplied by the caller.
Attributes:
-
id(str) –Stable identifier within the archive.
-
text(str) –Non-empty searchable content.
-
metadata(JsonObject) –JSON-compatible citation and filter fields.
-
vector(Sequence[float] | None) –Optional pre-computed embedding. When omitted, the configured embedding function embeds
texton write. -
attachments(tuple[AttachmentRef, ...]) –Links to stored binary attachments.
Raises:
-
ValueError–When
idortextis empty orvectoris invalid. -
TypeError–When
metadatacontains non-JSON values.
Methods:
AttachmentRecord
dataclass
¶
AttachmentRecord(
id: str,
data: bytes,
media_type: str,
filename: str | None = None,
checksum: str | None = None,
metadata: JsonObject = dict(),
)
Opaque binary attachment stored in a .vera archive.
Attributes:
-
id(str) –Stable attachment identifier.
-
data(bytes) –Raw attachment bytes.
-
media_type(str) –MIME type (for example
"application/pdf"). -
filename(str | None) –Optional original filename.
-
checksum(str | None) –Optional SHA-256 hex digest. Computed automatically when omitted; validated when supplied.
-
metadata(JsonObject) –JSON-compatible attachment metadata.
Raises:
-
ValueError–When
checksumdoes not matchdata.
Methods:
AttachmentRef
dataclass
¶
Reference from a chunk to a stored attachment.
Attributes:
-
attachment_id(str) –ID of the stored attachment.
-
role(str | None) –Optional semantic role (for example
"source"or"figure").
Methods:
Citation
dataclass
¶
Citation(
page_start: int | None = None,
page_end: int | None = None,
heading_path: str | None = None,
source_filename: str | None = None,
document_id: str | None = None,
)
Typed citation fields extracted from chunk metadata.
Methods:
-
from_metadata–Build a citation from a chunk metadata mapping.
Attributes:
-
page_start(int | None) – -
page_end(int | None) – -
heading_path(str | None) – -
source_filename(str | None) – -
document_id(str | None) –
QueryResult
dataclass
¶
QueryResult(
record: ChunkRecord,
score: float,
semantic_score: float | None = None,
keyword_score: float | None = None,
before: tuple[ChunkRecord, ...] = (),
after: tuple[ChunkRecord, ...] = (),
)
Ranked search hit from :meth:~vera_doc.document.VeraDocument.search.
Attributes:
-
record(ChunkRecord) –Matching chunk record.
-
score(float) –Combined relevance score for the selected mode.
-
semantic_score(float | None) –Raw semantic score, when applicable.
-
keyword_score(float | None) –Raw keyword score, when applicable.
Methods:
-
as_dict–Return a JSON-serializable representation of this result.
See CorpusSearchResult for multi-document search results.