Distill documents into structured Markdown and build a local index to enable fast knowledge retrieval. No external vector database required.
Use Cases
- The user says "Help me build these documents into a knowledge base for easy querying later"
- The user has a large number of PDF/Markdown documents that need to be searched quickly
- Need to answer questions based on private documents (RAG scenario)
- Works with knowledge base-type Skills to provide semantic search capabilities
Execution Method
Installation
pip install raglite
Index Documents
from raglite import RAGLiteConfig, insert_document
config = RAGLiteConfig(
db_url="sqlite:///~/Documents/xiaodazi/raglite.db",
)
insert_document(
doc_path="report.pdf",
config=config,
)
Retrieval
from raglite import retrieve_chunks, rerank_chunks
chunks = retrieve_chunks(
query="公司的营收增长情况",
num_chunks=10,
config=config,
)
reranked = rerank_chunks(query="公司的营收增长情况", chunk_ids=[c.id for c in chunks], config=config)
RAG Q&A
from raglite import rag
response = rag(
prompt="根据文档,公司去年的营收是多少?",
config=config,
)
print(response)
Supported Document Formats
- PDF (parsed via MinerU or PyPDF)
- Markdown
- Plain text
Output Specifications
- After indexing is complete, display the number of documents and the index size
- Retrieval results include source document and page number citations
- Clearly indicate the source of information when answering
- The database is stored locally and is not uploaded