Skip to content

Latest commit

 

History

History
132 lines (99 loc) · 5.41 KB

architecture.md

File metadata and controls

132 lines (99 loc) · 5.41 KB

Architecture

Context

This project evaluates Pixeltable 0.7.1 as the primary data and knowledge infrastructure for a local AI knowledge system. The installed package is authoritative when behavior differs from documentation or the Pixeltable Codex skill.

The current docs describe Pixeltable embedding indexes as declarative indexes that are maintained on table inserts, updates, and deletes, and queried through similarity() with order_by() and limit(). The SDK docs describe document_splitter() as an iterator over pxt.Document values that emits chunk text and optional metadata such as PDF page numbers.

Data Model

Documents

Pixeltable table: kb.documents

Field Type Purpose
doc_id pxt.String, primary key Stable SHA-256 identifier derived from the source path.
doc pxt.Document Original local document reference.
filename pxt.String Source filename.
source_path pxt.String Original local path at ingestion time.
mime_type pxt.String Detected MIME type.
ingested_at pxt.Timestamp Ingestion timestamp.
checksum pxt.String SHA-256 content checksum for duplicate detection and update detection.
metadata pxt.Json User or system metadata.

Chunks

Pixeltable view: kb.chunks

The chunks view is created from kb.documents with document_splitter(documents.doc, separators='page,char_limit', limit=700, overlap=120, metadata='title,page').

Field Source Purpose
doc_id inherited Parent document identifier.
filename inherited Parent filename.
source_path inherited Parent path.
checksum inherited Parent checksum.
text document_splitter Chunk text.
title document_splitter metadata Extracted document title where available.
page document_splitter metadata PDF page number where available.

The chunk text column receives a Pixeltable embedding index named local_semantic_idx.

Retrieval Queries

Pixeltable table: kb.queries

Field Type Purpose
query_id pxt.String, primary key Stable UUID for one query.
query pxt.String User query.
created_at pxt.Timestamp Query timestamp.
top_k pxt.Int Requested retrieval depth.

Retrieval Results

Pixeltable table: kb.retrievals

Field Type Purpose
retrieval_id pxt.String, primary key Stable result row identifier.
query_id pxt.String Parent query.
rank pxt.Int Retrieval rank.
score pxt.Float Pixeltable similarity score.
doc_id pxt.String Source document.
filename pxt.String Source filename.
page pxt.Int Source page if available.
chunk_text pxt.String Retrieved chunk text snapshot.

Generated Answers

Pixeltable table: kb.answers

Field Type Purpose
answer_id pxt.String, primary key Stable answer identifier.
query_id pxt.String Parent query.
query pxt.String User query snapshot.
model pxt.String Generation model or fallback identifier.
answer pxt.String Generated or synthesized answer.
sources pxt.Json Source provenance array.
created_at pxt.Timestamp Answer timestamp.

Data Flow

document file
-> ingestion command
-> checksum + metadata
-> kb.documents row
-> Pixeltable document_splitter view
-> kb.chunks rows
-> Pixeltable embedding index over chunk text
-> Pixeltable similarity retrieval
-> context assembly
-> local deterministic answer synthesis or optional provider call
-> kb.queries, kb.retrievals, kb.answers provenance records

Pixeltable Responsibilities

Verified from installed package and current docs:

  • Persistent tables and views.
  • pxt.Document storage for local text and PDF files.
  • document_splitter() chunk generation.
  • Table/view dependency tracking.
  • Embedding index definition with Table.add_embedding_index().
  • Similarity search with column.similarity(string=...).
  • Incremental index maintenance after inserts and updates.
  • UDF integration for a module-defined local embedding function.
  • CLI inspection through pxt ls, pxt describe, pxt rows, pxt idxs, and related commands.

External Responsibilities

  • CLI argument parsing is ordinary Python.
  • The local deterministic embedding UDF is project code because no model-provider credentials are available in this shell.
  • PDF generation for sample data uses reportlab.
  • Provider-backed generation is optional and blocked unless credentials are supplied.
  • Duplicate detection uses a SHA-256 checksum before insertion.

Known Constraints

  • The Pixeltable Codex marketplace downloaded successfully, but codex plugin add pixeltable@pixeltable-skill did not resolve the plugin. The skill files were still available locally and were inspected directly.
  • A UDF defined inside a python -c script failed in installed Pixeltable 0.7.1; the embedding UDF must live in an importable module for this project.
  • No provider API key environment variables were visible in the process during environment inspection, so provider-backed model calls are not part of the required passing tests.

Related