错误一:
LightRAG无法答复错误:
- INFO:lightrag:kw_prompt result:
- {{
- "high_level_keywords": ["xxx", "xxx"],
- "low_level_keywords": ["xxx", "xxx", "xxx"]
- }}
- JSON parsing error: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) {{
- "high_level_keywords": ["xxx", "xxx"],
- "low_level_keywords": ["xxx", "xxx", "xxx"]
- }}
- Sorry, I'm not able to provide an answer to that question.
复制代码 是因为LLM相应的格式错误:
- {{
- "high_level_keywords": ["xxx", "xxx"],
- "low_level_keywords": ["xxx", "xxx", ]
- }}
复制代码 正确格式:
- {
- "high_level_keywords": ["xxx", "xxx"],
- "low_level_keywords": ["xxx", "xxx"]
- }
复制代码 解决方法:修改\lightrag\operate.py 477行代码。
- result = await use_model_func(kw_prompt, keyword_extraction=True)
- logger.info("kw_prompt result:")
- print("original result:", result)
- result = result.replace('{{', '{').replace('}}', '}')
- 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企服之家,中国第一个企服评测及商务社交产业平台。 |