HKUDS / LightRAG

"LightRAG: Simple and Fast Retrieval-Augmented Generation"
https://arxiv.org/abs/2410.05779
MIT License
9.48k stars 1.17k forks source link

tenacity.RetryError #82

Closed amenhere closed 1 month ago

amenhere commented 1 month ago

我在尝试运行lightrag_openai_compatible_demo文件时,遇到错误如下:

INFO:httpx:HTTP Request: POST http://192.168.31.100:3001/v1/chat/completions "HTTP/1.1 200 OK" llm_model_func: I'm just a computer program, so I don't have feelings, but I'm here and ready to help you! How can I assist you today? INFO:openai._base_client:Retrying request to /embeddings in 0.427770 seconds INFO:openai._base_client:Retrying request to /embeddings in 0.965590 seconds INFO:openai._base_client:Retrying request to /embeddings in 0.425737 seconds INFO:openai._base_client:Retrying request to /embeddings in 0.888685 seconds INFO:openai._base_client:Retrying request to /embeddings in 0.387961 seconds INFO:openai._base_client:Retrying request to /embeddings in 0.947458 seconds Traceback (most recent call last): File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpx/_transports/default.py", line 72, in map_httpcore_exceptions yield File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpx/_transports/default.py", line 377, in handle_async_request resp = await self._pool.handle_async_request(req) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request raise exc from None File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request response = await connection.handle_async_request( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request raise exc File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request stream = await self._connect(request) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpcore/_async/connection.py", line 122, in _connect stream = await self._network_backend.connect_tcp(**kwargs) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpcore/_backends/auto.py", line 30, in connect_tcp return await self._backend.connect_tcp( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpcore/_backends/anyio.py", line 115, in connect_tcp with map_exceptions(exc_map): File "/root/anaconda3/envs/lightrag/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/root/anaconda3/envs/lightrag/lib/python3.10/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 "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/openai/_base_client.py", line 1571, in _request response = await self._client.send( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpx/_client.py", line 1674, in send response = await self._send_handling_auth( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpx/_client.py", line 1702, in _send_handling_auth response = await self._send_handling_redirects( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpx/_client.py", line 1739, in _send_handling_redirects response = await self._send_single_request(request) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpx/_client.py", line 1776, in _send_single_request response = await transport.handle_async_request(request) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpx/_transports/default.py", line 376, in handle_async_request with map_httpcore_exceptions(): File "/root/anaconda3/envs/lightrag/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/httpx/_transports/default.py", line 89, 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 "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/tenacity/asyncio/init.py", line 114, in call result = await fn(*args, **kwargs) File "/root/LightRAG/lightrag/llm.py", line 330, in openai_embedding response = await openai_async_client.embeddings.create( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/openai/resources/embeddings.py", line 236, in create return await self._post( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/openai/_base_client.py", line 1838, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/openai/_base_client.py", line 1532, in request return await self._request( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/openai/_base_client.py", line 1580, in _request return await self._retry_request( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/openai/_base_client.py", line 1580, in _request return await self._retry_request( File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/openai/_base_client.py", line 1590, 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 "/root/LightRAG/examples/lightrag_openai_compatible_demo.py", line 48, in asyncio.run(test_funcs()) File "/root/anaconda3/envs/lightrag/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/root/anaconda3/envs/lightrag/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete return future.result() File "/root/LightRAG/examples/lightrag_openai_compatible_demo.py", line 44, in test_funcs result = await embedding_func(["How are you?"]) File "/root/LightRAG/examples/lightrag_openai_compatible_demo.py", line 31, in embedding_func return await openai_embedding( File "/root/LightRAG/lightrag/utils.py", line 43, in call return await self.func(*args, kwargs) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/tenacity/asyncio/init.py", line 189, in async_wrapped return await copy(fn, *args, *kwargs) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/tenacity/asyncio/init.py", line 111, in call do = await self.iter(retry_state=retry_state) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/tenacity/asyncio/init.py", line 153, in iter result = await action(retry_state) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/tenacity/_utils.py", line 99, in inner return call(args, kwargs) File "/root/anaconda3/envs/lightrag/lib/python3.10/site-packages/tenacity/init.py", line 419, in exc_check raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x7fc96d697280 state=finished raised APITimeoutError>]

有大佬帮忙看看吗

MalikMAlna commented 1 month ago

Running into the same error. Tried slowing down the @retry rate, but haven't had any luck with that. Even a one second wait between requests would probably be enough to resolve this issue.

WinstonCHEN1 commented 1 month ago

一开始也遇到了这个问题,换了一个api_key可以使用,检查一下账户,或许会有帮助。