| import time | |
| from rag.vectorstore import get_vectorstore | |
| from rag.chain import aanswer | |
| async def bench(): | |
| t0 = time.perf_counter() | |
| vs = get_vectorstore() | |
| t1 = time.perf_counter() | |
| print(f'FAISS load/build time: {t1-t0:.3f}s') | |
| # Sample query; aanswer will initialize LLM when needed | |
| q = 'What is the Vicharanashala internship?' | |
| t2 = time.perf_counter() | |
| ans = await aanswer(q) | |
| t3 = time.perf_counter() | |
| print(f'LLM + retrieval time: {t3-t2:.3f}s') | |
| print('Answer length:', len(ans)) | |
| if __name__ == '__main__': | |
| import asyncio | |
| asyncio.run(bench()) | |