- Fix 71 invalid-syntax files (class-body newline-broken assignments) - Add from/None chain to 307 B904 raise-without-from sites - Add B008 ignore to ruff.toml (already in pyproject.toml) - Noqa F401 on __init__.py re-exports (137 sites) - Noqa E402 on deferred imports (63 sites) - Bulk-add stdlib/FastAPI/project imports for F821 (127 sites) - Replace ×→x, –→-, …→... in docstrings (4093 chars) - Manual refactor of 5 SIM103/SIM116 patterns Tests: 791 passed (66 deselected due to pre-existing Redis issues in test_rag.py) Co-authored-by: opencode <opencode@rugmunch.io>
61 lines
1.4 KiB
Python
61 lines
1.4 KiB
Python
"""RAG domain - v3 M3 engine surface.
|
|
|
|
Public API (per v3 unfuck guide §M3):
|
|
- RAGService, init_rag
|
|
- SearchRequest, SearchResponse, SearchHit
|
|
- IngestRequest, IngestResult
|
|
- FeedbackRecord
|
|
- EmbeddingProvider, COLLECTIONS
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from app.core import health as health_mod
|
|
from app.core.health import DomainHealth
|
|
|
|
|
|
async def _health_check() -> DomainHealth:
|
|
"""RAG health: v3 engine present + Redis reachable."""
|
|
try:
|
|
from app.rag.engine import get_stats
|
|
stats = get_stats()
|
|
return DomainHealth(
|
|
name="rag",
|
|
healthy=True,
|
|
details={
|
|
"engine": "v3-m3",
|
|
"backend": stats.get("backend", "unknown"),
|
|
"total_docs": stats.get("total_docs", 0),
|
|
},
|
|
)
|
|
except Exception as e:
|
|
return DomainHealth(name="rag", healthy=False, error=str(e))
|
|
|
|
|
|
health_mod.register_health_check("rag", _health_check)
|
|
|
|
|
|
# Public API
|
|
from app.rag.models import ( # noqa: E402
|
|
COLLECTIONS,
|
|
EmbeddingProvider,
|
|
FeedbackRecord,
|
|
IngestRequest,
|
|
IngestResult,
|
|
SearchHit,
|
|
SearchRequest,
|
|
SearchResponse,
|
|
)
|
|
from app.rag.service import RAGService, init_rag # noqa: E402
|
|
|
|
__all__ = [
|
|
"COLLECTIONS",
|
|
"EmbeddingProvider",
|
|
"FeedbackRecord",
|
|
"IngestRequest",
|
|
"IngestResult",
|
|
"RAGService",
|
|
"SearchHit",
|
|
"SearchRequest",
|
|
"SearchResponse",
|
|
"init_rag",
|
|
]
|