|
|
|
@ -6,34 +6,38 @@ from Util.RagUtil import create_llm_model_func, create_vision_model_func, create
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
|
# 要处理的文件路径
|
|
|
|
|
file_path = "./Txt/驿来特平台安全.docx"
|
|
|
|
|
|
|
|
|
|
# 索引生成目录
|
|
|
|
|
WORKING_DIR = "./rag_storage"
|
|
|
|
|
|
|
|
|
|
# 指定最终的索引生成目录,启动索引生成
|
|
|
|
|
config = RAGAnythingConfig(
|
|
|
|
|
working_dir="./rag_storage",
|
|
|
|
|
working_dir=WORKING_DIR,
|
|
|
|
|
mineru_parse_method="auto",
|
|
|
|
|
enable_image_processing=True,
|
|
|
|
|
enable_table_processing=True,
|
|
|
|
|
enable_equation_processing=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# 自定义的大模型函数
|
|
|
|
|
llm_model_func = create_llm_model_func()
|
|
|
|
|
# 自定义的可视模型函数
|
|
|
|
|
vision_model_func = create_vision_model_func(llm_model_func)
|
|
|
|
|
# 自定义的嵌入函数
|
|
|
|
|
embedding_func = create_embedding_func()
|
|
|
|
|
|
|
|
|
|
rag = RAGAnything(
|
|
|
|
|
config=config,
|
|
|
|
|
llm_model_func=llm_model_func,
|
|
|
|
|
vision_model_func=vision_model_func,
|
|
|
|
|
embedding_func=embedding_func,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
file_path = "./Txt/驿来特平台安全.docx"
|
|
|
|
|
await rag.process_document_complete(
|
|
|
|
|
file_path=file_path,
|
|
|
|
|
output_dir="./output",
|
|
|
|
|
parse_method="auto"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
print("Processing complete.")
|
|
|
|
|
print("文档解析索引完成!")
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
asyncio.run(main())
|
|
|
|
|