Some checks failed
CI / lint (push) Successful in 33s
CI / notebooks-smoke (push) Successful in 1m45s
Deploy / notebooks (push) Successful in 6m3s
Deploy / zotero (push) Has been skipped
Deploy / docs (push) Has been skipped
Deploy / api (push) Has been skipped
Deploy / llm (push) Has been skipped
Deploy / mc (push) Has been skipped
Infra CI / notebooks (push) Successful in 1m2s
Infra CI / zotero (push) Successful in 14s
Infra CI / docs (push) Successful in 27s
Infra CI / api (push) Successful in 1m7s
Infra CI / llm (push) Successful in 48s
Infra CI / mc (push) Successful in 13s
Deploy / report (push) Successful in 15s
CI / test (push) Failing after 21m36s
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""llm: local RAG over rulemaking comments + the Zotero/bib corpus.
|
|
|
|
Embeds regulations.gov public comments (``doctype:comment`` in the bib
|
|
store) and the reference corpus into pgvector, and (P34/P35) exposes
|
|
retrieval, grounded generation, and closed-vocab tagging — all inference
|
|
on local Ollama hosts, never cloud APIs.
|
|
|
|
Architecture::
|
|
|
|
.state/comments/*.md + bib corpus (llm.source)
|
|
-> markdown-aware chunks (llm.chunk)
|
|
-> Ollama /api/embed, multi-host (llm.pool)
|
|
-> pgvector collections (llm.index)
|
|
|
|
Spec: docs/superpowers/specs/2026-07-16-llm-module-design.md
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from llm.config import LlmConfig as LlmConfig
|
|
from llm.config import load as load
|
|
from llm.config import pg_url as pg_url
|
|
|
|
# The pool pulls in langchain; ``llm.config``, ``llm.links`` and
|
|
# ``llm.lineage`` do not need it and are imported by the notebooks
|
|
# container, which installs the workspace without the ``llm`` extra
|
|
# (#720). Resolve the pool exports lazily so ``import llm.config`` never
|
|
# imports langchain.
|
|
__all__ = ["HostPool", "LlmConfig", "PoolEmbeddings", "load", "pg_url"]
|
|
|
|
|
|
def __getattr__(name: str) -> Any:
|
|
if name in {"HostPool", "PoolEmbeddings"}:
|
|
from llm import pool
|
|
|
|
return getattr(pool, name)
|
|
raise AttributeError(f"module 'llm' has no attribute {name!r}")
|