PyAIStack is a lightweight, modular microframework for building AI applications.
Recommended learning path
Implemented feature modules
RAG runtime
RAG— indexes documents, retrieves relevant chunks, builds bounded context, and generates grounded answers.RAGConfig— controlstop_k, score threshold, context size, and optional source display.RAG.search()— returns retrieved chunks, metadata, and similarity scores without an LLM call.RAG.ask()— retrieves context and generates an answer with the configured chat provider.
Loaders
TextLoader— loads one UTF-8.txtfile and keeps its source metadata.DirectoryLoader— recursively loads UTF-8.txtfiles from a directory;file_type="text"is required.LoadedDocument— holds text and metadata before chunking and indexing.FolderMetadataFactory— derives deterministic metadata from directory names and file names.CSVMetadataFactory— reads validated metadata from a portable CSV manifest keyed by source path.LLMMetadataFactory— uses an injected chat provider to generate validated metadata from a bounded file sample.
Chunking
TextChunker— splits loaded text into overlapping, separator-aware character chunks and preserves metadata.
Vector stores
InMemoryVectorStore— thread-safe, process-local exact cosine retrieval for development.SQLiteVectorStore— persistent local exact cosine retrieval for small-to-medium indexes.- Metadata filtering —
search()andask()filter scalar values or values contained in metadata lists before vector scoring. - SQLite storage capacity — practical index-size guidance and scaling limits.
Providers
OllamaEmbeddingProvider— local Ollama embeddings;embeddinggemmais the default model.OllamaChatProvider— local Ollama chat;gemma3:4bis the default model.EmbeddingProviderandChatProvider— provider contracts for future integrations without changing normalRAGusage.
Error handling
format_error— formats package errors with the relevant application traceback frame.- Package-specific errors — make loader, chunking, provider, vector-store, and empty-index failures explicit.
Reference
Current scope
PyAIStack currently supports UTF-8 text files, local Ollama models, an in-memory vector store, and a persistent SQLite exact-search store. PDF, DOCX, Markdown, web loaders, distributed vector databases, tools, and agents are under development.