Spaces:
Runtime error
Runtime error
| # File Objective : CLI for the RAG pipeline β ask a question, receive a cited answer. | |
| # Scope : Dev script β verify end-to-end grounded generation. | |
| # What it does : Calls domain/rag.py answer() and prints the answer + numbered sources. | |
| # What it does not: Call the agent or expose an HTTP endpoint. | |
| from __future__ import annotations | |
| import sys | |
| from vantage_core.adapters.embedder_st import STEmbedder | |
| from vantage_core.adapters.llm_openai import OpenAILLM | |
| from vantage_core.adapters.reranker_cross_encoder import CrossEncoderReranker | |
| from vantage_core.adapters.vector_qdrant import QdrantVectorRepo | |
| from vantage_core.domain.rag import answer | |
| def main() -> None: | |
| question = " ".join(sys.argv[1:]).strip() or input("Question: ").strip() | |
| if not question: | |
| print("No question provided.") | |
| sys.exit(1) | |
| print(f"\nββ Question: {question!r} ββββββββββββββββββββββββββββββββββββββββ") | |
| result = answer( | |
| question = question, | |
| embedder = STEmbedder(), | |
| repo = QdrantVectorRepo(), | |
| reranker = CrossEncoderReranker(), | |
| llm = OpenAILLM(), | |
| ) | |
| print(f"\nββ Answer {'(no coverage)' if not result.has_coverage else ''} βββββββββββββββββββββββββββββββββββββββββββββββ") | |
| print(result.answer) | |
| if result.sources: | |
| print(f"\nββ Sources ββββββββββββββββββββββββββββββββββββββββββββββββββββββ") | |
| for i, sc in enumerate(result.sources, start=1): | |
| c = sc.chunk | |
| print(f" [{i}] {c.category} | {c.title}") | |
| print(f" {c.chunk_text[:120]}") | |
| print() | |
| if __name__ == "__main__": | |
| main() | |