ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

[Bug]: When using the API to call RAgFlow, the error frequently occurs: ERROR: division by zero.

Open ChenchunjieKK opened this issue 11 months ago • 6 comments

Is there an existing issue for the same bug?

  • [x] I have checked the existing issues.

RAGFlow workspace code commit ID

0fd13b34d9ee11ef93aa0242ac140006

RAGFlow image version

V15.1

Other environment information


Actual behavior

When directly asking on the platform, there is an answer, but when using an external API, there is no answer.

Expected behavior

No response

Steps to reproduce

When directly asking on the platform, there is an answer, but when using an external API, there is no answer.

Additional information

No response

ChenchunjieKK avatar Jan 24 '25 02:01 ChenchunjieKK

Which API? And do you have backend error log?

KevinHuSh avatar Jan 24 '25 04:01 KevinHuSh

Below is the Docker error log.

2025-01-24 13:45:37,306 INFO 17 POST http://es01:9200/ragflow_6f16c442d88111ef901d0242ac140006/_search [status:200 duration:0.016s] 2025-01-24 13:45:37,380 INFO 17 POST http://es01:9200/ragflow_6f16c442d88111ef901d0242ac140006/_search [status:200 duration:0.013s] 2025-01-24 13:45:37,430 INFO 17 POST http://es01:9200/ragflow_6f16c442d88111ef901d0242ac140006/_search [status:200 duration:0.012s] 2025-01-24 13:45:37,899 ERROR 17 LLMBundle.similarity can't update token usage for 6f16c442d88111ef901d0242ac140006/RERANK used_tokens: 5132 2025-01-24 13:45:38,068 INFO 1771 task_consumer_0 reported heartbeat: {"name": "task_consumer_0", "now": "2025-01-24T13:45:38.068+08:00", "boot_at": "2025-01-23T11:11:23.679+08:00", "pending": 0, "lag": 0, "done": 2, "failed": 2, "current": null} 2025-01-24 13:46:07,307 ERROR 17 2025-01-24 13:46:08,099 INFO 1771 task_consumer_0 reported heartbeat: {"name": "task_consumer_0", "now": "2025-01-24T13:46:08.098+08:00", "boot_at": "2025-01-23T11:11:23.679+08:00", "pending": 0, "lag": 0, "done": 2, "failed": 2, "current": null} 2025-01-24 13:46:08,730 INFO 17 172.20.0.6 - - [24/Jan/2025 13:46:08] "POST /api/v1/chats/0fd13b34d9ee11ef93aa0242ac140006/completions HTTP/1.1" 200 -

Below is the information returned by calling the API using Postman.

{ "code": 0, "data": { "answer": "ERROR: \nERROR: division by zero", "audio_binary": null, "id": "795df3de-c99b-49d7-854a-186bfe77d0b8", "prompt": "你是一个智能助手,请总结知识库的内容来回答问题,请列举知识库中的数据详细回答。当所有知识库内容都与问题无关时,你的回答必须包括“知识库中未找到您要的答案!”这句话。回答需要考虑聊天历史。\n 以下是知识库:\n
.......................
"dataset_id": "f48879fed97111ef85d70242ac140006", "document_id": "1d0c5c6ad97211ef811f0242ac140006", "document_name": "原子故障参数.xlsx", "id": "df3d6c993de66acc", "image_id": "", "positions": [] } ], "doc_aggs": [ { "count": 2, "doc_id": "1d0c5c6ad97211ef811f0242ac140006", "doc_name": "原子故障参数.xlsx" } ], "total": 3 }, "session_id": "0ed33f8ad9f211ef873f0242ac140006"

ChenchunjieKK avatar Jan 24 '25 05:01 ChenchunjieKK

Some issues can output results when calling the API, while others return ERROR: \nERROR: division by zero.

ChenchunjieKK avatar Jan 24 '25 05:01 ChenchunjieKK

Through the debugging just now, I seem to have identified the cause. It appears that the returned text is too long. When displayed on the page, it shows something like: "Scenario 1: Redis connection timeout... The response has been truncated due to its length. Would you like to continue?" However, when calling through Postman, excessively long information returns ERROR: \nERROR: division by zero.

ChenchunjieKK avatar Jan 24 '25 07:01 ChenchunjieKK

I have the same problem. Image Can you tell me how to solve this?

tonyzhu2021 avatar Feb 25 '25 03:02 tonyzhu2021

我也遇到了同样的问题。 你能告诉我如何解决这个问题吗? Image If your API for the large model uses local OLLma, this problem arises because the knowledge base query contains too much content, leading to an overload of input data. This causes the video memory to overflow, resulting in the large model returning an empty result. Consequently, the value displayed by ragflow is also empty.

ChenchunjieKK avatar Feb 25 '25 05:02 ChenchunjieKK