LightRAG icon indicating copy to clipboard operation
LightRAG copied to clipboard

[Bug]:API Timeout error during retreival

Open mercurial-moon opened this issue 6 months ago • 11 comments

Do you need to file an issue?

  • [x] I have searched the existing issues and this bug is not already filed.
  • [ ] I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

When I try to run retrieval from WebUI, I see that it sends a query to the LLM to extract keywords from the query but nothing is sent after that.

Steps to reproduce

No response

Expected Behavior

Was expecting a response in the WebUI

LightRAG Config Used

Paste your config here

Logs and screenshots


INFO: Process 988 building query context...
INFO: Query nodes: Intelligence, Social structures, Echolocation, Habitat, Marine mammals, top_k: 10, cosine: 0.2
INFO: limit_async: 16 new workers initialized
ERROR: limit_async: Error in decorated function: RetryError[<Future at 0x233c3b93bd0 state=finished raised APITimeoutError>]
2025-05-27 19:52:16 - ASCIIColors - ERROR - Exception Traceback (RetryError)
Traceback (most recent call last):
  File "..\lightrag\Lib\site-packages\httpx\_transports\default.py", line 101, in map_httpcore_exceptions
    yield
  File "..\lightrag\Lib\site-packages\httpx\_transports\default.py", line 394, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpcore\_async\connection_pool.py", line 256, in handle_async_request
    raise exc from None
  File "..\lightrag\Lib\site-packages\httpcore\_async\connection_pool.py", line 236, in handle_async_request
    response = await connection.handle_async_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpcore\_async\connection.py", line 101, in handle_async_request
    raise exc
  File "..\lightrag\Lib\site-packages\httpcore\_async\connection.py", line 78, in handle_async_request
    stream = await self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpcore\_async\connection.py", line 124, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpcore\_backends\auto.py", line 31, in connect_tcp
    return await self._backend.connect_tcp(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpcore\_backends\anyio.py", line 113, in connect_tcp
    with map_exceptions(exc_map):
  File "..\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "..\lightrag\Lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "..\lightrag\Lib\site-packages\openai\_base_client.py", line 1484, in request
    response = await self._client.send(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpx\_client.py", line 1629, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpx\_client.py", line 1657, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpx\_client.py", line 1694, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpx\_client.py", line 1730, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\httpx\_transports\default.py", line 393, in handle_async_request
    with map_httpcore_exceptions():
  File "..\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "..\lightrag\Lib\site-packages\httpx\_transports\default.py", line 118, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "..\lightrag\Lib\site-packages\tenacity\asyncio\__init__.py", line 114, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\llm\openai.py", line 451, in openai_embed
    response = await openai_async_client.embeddings.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\openai\resources\embeddings.py", line 245, in create
    return await self._post(
           ^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\openai\_base_client.py", line 1742, in post
    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\openai\_base_client.py", line 1502, in request
    raise APITimeoutError(request=request) from err
openai.APITimeoutError: Request timed out.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "..\lightrag\Lib\site-packages\lightrag\api\routers\query_routes.py", line 145, in query_text
    response = await rag.aquery(request.query, param=param)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\lightrag.py", line 1443, in aquery
    response = await kg_query(
               ^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\operate.py", line 917, in kg_query
    context = await _build_query_context(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\operate.py", line 1243, in _build_query_context
    ll_data = await _get_node_data(
              ^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\operate.py", line 1351, in _get_node_data
    results = await entities_vdb.query(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\kg\nano_vector_db_impl.py", line 128, in query
    embedding = await self.embedding_func(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\utils.py", line 586, in wait_func
    return await future
           ^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\utils.py", line 370, in worker
    result = await func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\utils.py", line 242, in __call__
    return await self.func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\lightrag\utils.py", line 242, in __call__
    return await self.func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\tenacity\asyncio\__init__.py", line 189, in async_wrapped
    return await copy(fn, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\tenacity\asyncio\__init__.py", line 111, in __call__
    do = await self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\tenacity\asyncio\__init__.py", line 153, in iter
    result = await action(retry_state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\tenacity\_utils.py", line 99, in inner
    return call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "..\lightrag\Lib\site-packages\tenacity\__init__.py", line 421, in exc_check
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x233c3b93bd0 state=finished raised APITimeoutError>]

INFO: 127.0.0.1:50153 - "POST /query HTTP/1.1" 500

Additional Information

  • LightRAG Version: 1.3.7
  • Operating System: Win 11
  • Python Version: 3.11
  • Related Issues:

mercurial-moon avatar May 27 '25 18:05 mercurial-moon

I have the same problem:

INFO:openai._base_client:Retrying request to /embeddings in 0.857938 seconds ERROR: limit_async: Error in decorated function: RetryError[<Future at 0x7f2ff3a2d2d0 state=finished raised APITimeoutError>] An error occurred: RetryError[<Future at 0x7f2ff3a2d2d0 state=finished raised APITimeoutError>]

Done! INFO: Creating a new event loop in main thread.

Have you made any progress on this issue recently???

fingeng avatar May 28 '25 05:05 fingeng

@fingeng not yet, have posted on the discord channel too but no replies yet.

mercurial-moon avatar May 28 '25 06:05 mercurial-moon

i have the same problem like this......

DMBMZ1 avatar May 28 '25 15:05 DMBMZ1

我终于跑通了 需要更改url 这个项目默认是openai官方的 我用的是第三方 需要自己更改

fingeng avatar May 28 '25 16:05 fingeng

怎么理解?就是openai 兼容的API是不能用的吗?

DMBMZ1 avatar May 28 '25 16:05 DMBMZ1

如何理解您说的这个更改url这个做法呢

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2025年05月29日 00:06 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [HKUDS/LightRAG] [Bug]:API Timeout error during retreival (Issue #1636) | fingeng left a comment (HKUDS/LightRAG#1636)

我终于跑通了 需要更改url 这个项目默认是openai官方的 我用的是第三方 需要自己更改

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

DMBMZ1 avatar May 28 '25 16:05 DMBMZ1

怎么理解?就是openai 兼容的API是不能用的吗?

如何理解您说的这个更改url这个做法呢

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2025年05月29日 00:06 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [HKUDS/LightRAG] [Bug]:API Timeout error during retreival (Issue #1636) | fingeng left a comment (HKUDS/LightRAG#1636)

我终于跑通了 需要更改url 这个项目默认是openai官方的 我用的是第三方 需要自己更改

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

怎么理解?就是openai 兼容的API是不能用的吗?

这个项目默认的url是官方的http://api.openai.com 我是用的第三方代理,自定义的API服务器url,我在项目中搜索所有出现http://api.openai.com的地方改成我自己的url后就跑通了

fingeng avatar May 28 '25 16:05 fingeng

好的好的,我明天试试看,那就是说得看源代码里面的和openai相关的都改了

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2025年05月29日 00:38 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [HKUDS/LightRAG] [Bug]:API Timeout error during retreival (Issue #1636) | fingeng left a comment (HKUDS/LightRAG#1636)

怎么理解?就是openai 兼容的API是不能用的吗?

如何理解您说的这个更改url这个做法呢 …

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2025年05月29日 00:06 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [HKUDS/LightRAG] [Bug]:API Timeout error during retreival (Issue #1636) | fingeng left a comment (HKUDS/LightRAG#1636)

我终于跑通了 需要更改url 这个项目默认是openai官方的 我用的是第三方 需要自己更改

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

怎么理解?就是openai 兼容的API是不能用的吗?

这个项目默认的url是官方的http://api.openai.com 我是用的第三方代理,自定义的API服务器url,我在项目中搜索所有出现http://api.openai.com的地方改成我自己的url后就跑通了

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

DMBMZ1 avatar May 28 '25 16:05 DMBMZ1

@fingeng 为什么它不使用 .env 文件中的 LLM_BINDING_HOST 值?

mercurial-moon avatar May 28 '25 16:05 mercurial-moon

@fingeng not yet, have posted on the discord channel too but no replies yet.

Can you send the discord link? I want to be in it.

frederikhendrix avatar May 28 '25 20:05 frederikhendrix

@fingeng not yet, have posted on the discord channel too but no replies yet.

Can you send the discord link? I want to be in it.

https://discord.gg/yF2MmDJyGJ

mercurial-moon avatar May 29 '25 01:05 mercurial-moon

怎么理解?就是openai 兼容的API是不能用的吗?

如何理解您说的这个更改url这个做法呢 ---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2025年05月29日 00:06 | | 收件人 | _@**._> | | 抄送至 | _@.>@._> | | 主题 | Re: [HKUDS/LightRAG] [Bug]:API Timeout error during retreival (Issue #1636) | fingeng left a comment (HKUDS/LightRAG#1636) 我终于跑通了 需要更改url 这个项目默认是openai官方的 我用的是第三方 需要自己更改 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: _@_.*>

怎么理解?就是openai 兼容的API是不能用的吗?

这个项目默认的url是官方的http://api.openai.com 我是用的第三方代理,自定义的API服务器url,我在项目中搜索所有出现http://api.openai.com的地方改成我自己的url后就跑通了

我用的ollama部署的模型,按照这个思路我这里改了之后执行提示404了。。。

MNicholasPro avatar Jul 12 '25 05:07 MNicholasPro