π§ OverviewΒΆ
rag.core is the shared Papers RAG library. Apps and ingest CLIs import it;
libs/ does not import apps/ or projects/.
Pipeline: pypdf pages β overlap chunks β local bge-small embeddings β Chroma
β OpenAI. A prose filter and catalog routing (corpus / author questions skip
vector search) sit on that path.
See RAG stack for cue lists, prompts, and the env table.
π¦ ModulesΒΆ
Module |
Responsibility |
|---|---|
|
|
|
|
|
Non-recursive |
|
|
|
Author cues, acknowledgement / SPIE filters, page labels, |
|
|
|
Dispatch + LlamaIndex chunk β embed β Chroma |
|
Open persistent LlamaIndex collection; |
|
|
|
|
|
|
Public API: RagConfig, RagStrategy, ingest_papers, ask,
build_query_engine, Citation, QueryResult, IndexMissingError.
ποΈ StrategiesΒΆ
Do not share one Chroma folder across backends.
Strategy |
Splitter |
Query path |
Default persist |
|---|---|---|---|
|
|
Query engine + |
|
|
|
Retriever β labeled context β |
|
Shared: pypdf loader, is_prose_text, chunk_size=1024 / overlap=128,
BAAI/bge-small-en-v1.5, collection name papers, overfetch top_k Γ 3.
CHROMA_DIR overrides persist for one strategy. --strategy all cannot take
--chroma-dir.
π§ ask() routingΒΆ
Author cues (
who wrote,main author,authors of, β¦ β not bare"author") βcatalog.json+AUTHOR_SYNTHESIS_PROMPT.Corpus cues (
all papers,common theme, β¦) β catalog +CORPUS_SYNTHESIS_PROMPT.Otherwise β vector retrieve, drop non-prose, generate with
QA_GROUNDING_RULES.
Ingest writes catalog.json beside each strategyβs Chroma dir (filename +
220-char opening snippet). Missing JSON falls back to papers_dir filenames.
βοΈ EnvironmentΒΆ
Variable |
Default |
|---|---|
|
required for chat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
load_repo_dotenv() loads cwd .env then repo-root .env. Process env wins
(override=False).
π DefaultsΒΆ
Local embeddings β no embedding API bill.
Chroma on disk β no Docker for the local loop.
OpenAI only for generation.
Isolated strategy dirs so LlamaIndex and LangChain collections stay separate.