Add finalize_storages to sample code

This commit is contained in:
yangdx
2025-04-21 00:25:13 +08:00
parent e0f0d23e5a
commit 0c6e80cce9

View File

@@ -92,6 +92,8 @@ async def initialize_rag():
async def main(): async def main():
rag = None
try:
# Initialize RAG instance # Initialize RAG instance
rag = await initialize_rag() rag = await initialize_rag()
@@ -137,9 +139,15 @@ async def main():
"What are the top themes in this story?", param=QueryParam(mode="hybrid") "What are the top themes in this story?", param=QueryParam(mode="hybrid")
) )
) )
except Exception as e:
print(f"An error occurred: {e}")
finally:
if rag:
await rag.finalize_storages()
if __name__ == "__main__": if __name__ == "__main__":
# Configure logging before running the main function # Configure logging before running the main function
configure_logging() configure_logging()
asyncio.run(main()) asyncio.run(main())
print("\nDone!")