ToB企服应用市场:ToB评测及商务社交产业平台

标题: LightRAG测试BUG [打印本页]

作者: 圆咕噜咕噜    时间: 2024-12-13 17:06
标题: LightRAG测试BUG
错误一:

LightRAG无法答复错误:
  1. INFO:lightrag:kw_prompt result:
  2. {{
  3.   "high_level_keywords": ["xxx", "xxx"],
  4.   "low_level_keywords": ["xxx", "xxx", "xxx"]
  5. }}
  6. JSON parsing error: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) {{
  7.   "high_level_keywords": ["xxx", "xxx"],
  8.   "low_level_keywords": ["xxx", "xxx", "xxx"]
  9. }}
  10. Sorry, I'm not able to provide an answer to that question.
复制代码
是因为LLM相应的格式错误:
  1. {{
  2.   "high_level_keywords": ["xxx", "xxx"],
  3.   "low_level_keywords": ["xxx", "xxx", ]
  4. }}
复制代码
正确格式:
  1. {
  2.   "high_level_keywords": ["xxx", "xxx"],
  3.   "low_level_keywords": ["xxx", "xxx"]
  4. }
复制代码
解决方法:修改\lightrag\operate.py 477行代码。
  1. result = await use_model_func(kw_prompt, keyword_extraction=True)
  2. logger.info("kw_prompt result:")
  3. print("original result:", result)
  4. result = result.replace('{{', '{').replace('}}', '}')
  5. print("rewrite result", result)
复制代码
错误二:

新环境测试LightRAG时忽然出现错误:KeyError: 'Could not automatically map gpt-4o-mini to a tokeniser. Please use `tiktok.get_encoding` to explicitly get the tokeniser you expect.'
解决方法:搜索发现可能跟tiktoken版本问题有关,发现新环境中的tiktoken库版本是0.3.0,而旧环境是0.7.0,重新安装后即可正常运行。
pip install tiktoken==0.7.0
天生的知识图谱中带有很多英文节点:
将\lightrag\prompt.py中PROMPTS[“DEFAULT_LANGUAGE”] 的值修改成 “Chinese”。
错误三:

利用API插入文本出错
官方测试curl下令(错误):curl -X POST "http://127.0.0.1:8020/insert_file" -H "Content-Type: application/json" -d '{"file_path": "path/to/your/file.txt"}'
返回错误:{"detail":[{"type":"missing","loc":["body","file"],"msg":"Field required","input":null}]}
正确curl下令:curl -X POST "http://127.0.0.1:8020/insert_file" -H "Content-Type: multipart/form-data" -F "file=@path/to/your/file.txt"
返回成功:{"status":"success","data":null,"message":"File content from test.txt inserted successfully"}

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4