Add finalize_storages to sample code
This commit is contained in:
@@ -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!")
|
||||||
|
Reference in New Issue
Block a user