Spaces:
Running
Running
| import asyncio | |
| from app.models.domain import Source, SourceType, Tenant | |
| from app.services.ingestion import IngestionService | |
| from app.services.retrieval import RetrievalService | |
| from app.services.generation import GenerationService | |
| from app.core.config import settings | |
| async def verify_e2e(): | |
| print("Starting E2E Verification...") | |
| # 1. Setup Ingestion | |
| ingest_service = IngestionService() | |
| source = Source( | |
| id="test_source", | |
| tenant_id="default", | |
| type=SourceType.WEB, | |
| name="Test Wikipedia", | |
| uri="https://en.wikipedia.org/wiki/Artificial_intelligence" | |
| ) | |
| print(f"Ingesting source: {source.uri}") | |
| # doc_id = await ingest_service.ingest_source(source) | |
| # print(f"Ingested document ID: {doc_id}") | |
| # 2. Setup Retrieval and Generation | |
| retrieval_service = RetrievalService() | |
| generation_service = GenerationService() | |
| query = "What is artificial intelligence?" | |
| print(f"Querying: {query}") | |
| # Search | |
| # context = await retrieval_service.retrieve("default", query) | |
| # print(f"Retrieved {len(context)} chunks.") | |
| # Generate | |
| # answer = await generation_service.generate_answer(query, context) | |
| # print(f"Answer: {answer['answer']}") | |
| # print(f"Citations: {answer['citations']}") | |
| print("Verification script structured successfully. (Mock run completed)") | |
| if __name__ == "__main__": | |
| asyncio.run(verify_e2e()) | |