'commit'
This commit is contained in:
@@ -45,7 +45,7 @@ async def main():
|
||||
|
||||
# 创建 RAGAnything 配置
|
||||
config = RAGAnythingConfig(
|
||||
working_dir="./rag_storage",
|
||||
working_dir="./Topic/Geogebra",
|
||||
parser="mineru", # 选择解析器:mineru 或 docling
|
||||
parse_method="auto", # 解析方法:auto, ocr 或 txt
|
||||
enable_image_processing=True,
|
||||
@@ -137,7 +137,7 @@ async def main():
|
||||
# 处理文档
|
||||
await rag.process_document_complete(
|
||||
file_path="./Doc/GeoGebra5经典版指令汇编201903061.pdf",
|
||||
output_dir="./output",
|
||||
output_dir="./Topic/Geogebra",
|
||||
parse_method="auto"
|
||||
)
|
||||
|
||||
|
@@ -3,32 +3,13 @@ import inspect
|
||||
from Util.LightRagUtil import configure_logging, initialize_rag, print_stream
|
||||
from lightrag import QueryParam
|
||||
|
||||
# 化学
|
||||
data = [
|
||||
# {"NAME": "Chemistry", "Q": "硝酸光照分解的化学反应方程式是什么", "ChineseName": "化学"},
|
||||
{"NAME": "Chemistry", "Q": "氢气与氧气燃烧的现象", "ChineseName": "化学"},
|
||||
{"NAME": "Math", "Q": "氧化铁与硝酸的化学反应方程式是什么", "ChineseName": "数学"},
|
||||
{"NAME": "Chinese", "Q": "氧化铁与硝酸的化学反应方程式是什么", "ChineseName": "语文"},
|
||||
{"NAME": "JiHe", "Q": "三角形两边之和大于第三边的证明", "ChineseName": "几何"}
|
||||
]
|
||||
|
||||
# 准备查询的科目
|
||||
KEMU = "JiHe" # Chemistry JiHe
|
||||
|
||||
# 查找索引号
|
||||
idx = [i for i, d in enumerate(data) if d["NAME"] == KEMU][0]
|
||||
|
||||
|
||||
async def main():
|
||||
try:
|
||||
user_prompt = "\n 1、资料中提供化学反应方程式的,一定要严格按提供的Latex公式输出,绝对不允许对Latex公式进行修改 !"
|
||||
user_prompt = user_prompt + "\n 2、如果资料中提供了图片的,一定要严格按照原文提供图片输出,不允许省略或不输出!"
|
||||
user_prompt = user_prompt + "\n 3、资料中提到的知识内容,需要判断是否与本次问题相关,不相关的绝对不要输出!"
|
||||
rag = await initialize_rag('Topic/' + data[idx]["NAME"])
|
||||
user_prompt = "简洁回复。"
|
||||
rag = await initialize_rag('Topic/Geogebra')
|
||||
resp = await rag.aquery(
|
||||
data[idx]["Q"],
|
||||
"文档的主要内容是什么",
|
||||
param=QueryParam(mode="hybrid", stream=True, user_prompt=user_prompt),
|
||||
# hybrid naive
|
||||
)
|
||||
if inspect.isasyncgen(resp):
|
||||
await print_stream(resp)
|
||||
|
Reference in New Issue
Block a user