Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

与gpt对话示例,很久才返回结果,后台报错信息如下 #379

Open
54sww opened this issue Mar 7, 2024 · 1 comment
Open

Comments

@54sww
Copy link

54sww commented Mar 7, 2024

image
** 网络梯子部署OK的,容器内访问Openapi网址也没有问题的。详情日志见附件
[2024-03-07 22:29:53.307336] [INFO process-9-140465245408128 bisheng.utils.threadpool:99] - trace=None async_wait_count=1
[2024-03-07 22:29:54.773729] [INFO process-9-140465245408128 bisheng.utils.threadpool:99] - trace=None async_wait_count=1
[2024-03-07 22:29:55.310765] [INFO process-9-140465245408128 bisheng.utils.threadpool:99] - trace=None async_wait_count=1
[2024-03-07 22:29:56.777467] [INFO process-9-140465245408128 bisheng.utils.threadpool:99] - trace=None async_wait_count=1
[2024-03-07 22:29:57.104199] [ERROR process-9-140461729638080 bisheng.processing.base:32] - trace=None Error communicating with OpenAITraceback (most recent call last):

                           File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection                                                                                                                                                                    
                             return await self._loop.create_connection(*args, **kwargs)                                                                                                                                                                                                                 
                                          |    |     |                  |       -> {'ssl': <ssl.SSLContext object at 0x7fbfd0c5df40>, 'family': <AddressFamily.AF_INET: 2>, 'proto': 6, 'flags': <AddressInfo.AI...                                                                                     
                                          |    |     |                  -> (functools.partial(<class 'aiohttp.client_proto.ResponseHandler'>, loop=<uvloop.Loop running=True closed=False debug=False>),...                                                                                             
                                          |    |     -> <method 'create_connection' of 'uvloop.loop.Loop' objects>                                                                                                                                                                                      
                                          |    -> <uvloop.Loop running=True closed=False debug=False>                                                                                                                                                                                                   
                                          -> <aiohttp.connector.TCPConnector object at 0x7fbfd153c190>                                                                                                                                                                                                  
                           File "uvloop/loop.pyx", line 2039, in create_connection                                                                                                                                                                                                                      
                             raise exceptions[0]                                                                                                                                                                                                                                                        
                           File "uvloop/loop.pyx", line 2016, in uvloop.loop.Loop.create_connection                                                                                                                                                                                                     
                             await waiter                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                        
                         TimeoutError: [Errno 110] Connection timed out                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                        
                         The above exception was the direct cause of the following exception:                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                        
                         Traceback (most recent call last):                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                        
                           File "/usr/local/lib/python3.10/site-packages/openai/api_requestor.py", line 668, in arequest_raw                                                                                                                                                                            
                             result = await session.request(**request_kwargs)                                                                                                                                                                                                                           
                                            |       |         -> {'method': 'post', 'url': 'https://api.openai.com/v1/chat/completions', 'headers': {'X-OpenAI-Client-User-Agent': '{"bindings...                                                                                                       
                                            |       -> <function ClientSession.request at 0x7fbfea4c3490>                                                                                                                                                                                               
                                            -> <aiohttp.client.ClientSession object at 0x7fbfd153d9c0>                                                                                                                                                                                                  
                           File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 578, in _request                                                                                                                                                                                      
                             conn = await self._connector.connect(                                                                                                                                                                                                                                      
                                          |    -> None                                                                                                                                                                                                                                                  
                                          -> <aiohttp.client.ClientSession object at 0x7fbfd153d9c0>                                                                                                                                                                                                    
                           File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 544, in connect                                                                                                                                                                                    
                             proto = await self._create_connection(req, traces, timeout)                                                                                                                                                                                                                
                                           |    |                  |    |       -> ClientTimeout(total=600, connect=None, sock_read=None, sock_connect=None, ceil_threshold=5)                                                                                                                          

error.txt

                                   -> <module 'openai.error' from '/usr/local/lib/python3.10/site-packages/openai/error.py'>                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                        
                         openai.error.APIConnectionError: Error communicating with OpenAI                                                                                                                                                                                                               

[2024-03-07 22:29:57.218992] [DEBUG process-9-140461729638080 bisheng.api.v1.callback:287] - trace=None on_chain_start inputs={'input': '你是谁', 'history': ''}

Entering new ConversationChain chain...
[2024-03-07 22:29:57.221351] [INFO process-9-140461729638080 bisheng.api.v1.callback:309] - trace=None Prompt after formatting:
The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.

                         Current conversation:                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                        
                         Human: 你是谁                                                                                                                                                                                                                                                                  
                         AI:                                                                                                                                                                                                                                                                         

Prompt after formatting:
The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.

Current conversation:

Human: 你是谁
AI:
[2024-03-07 22:29:57.227126] [DEBUG process-9-140461729638080 bisheng.api.v1.callback:306] - trace=None on_chat result=[[HumanMessage(content='The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI
does not know the answer to a question, it truthfully says it does not know.\n\nCurrent conversation:\n\nHuman: 你是谁\nAI:')]]
[2024-03-07 22:29:57.233682] [DEBUG process-9-140461729638080 openai.util:60] - trace=None message='Request to OpenAI API' method=post path=https://api.openai.com/v1/chat/completions
[2024-03-07 22:29:57.235616] [DEBUG process-9-140461729638080 openai.util:60] - trace=None api_version=None data='{"messages": [{"role": "user", "content": "The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context.
If the AI does not know the answer to a question, it truthfully says it does not know.\n\nCurrent conversation:\n\nHuman: \u4f60\u662f\u8c01\nAI:"}], "model": "gpt-3.5-turbo-16k-0613", "stream": true, "n": 1, "temperature": 0.7}' message='Post details'
[2024-03-07 22:29:57.240239] [DEBUG process-9-140461729638080 urllib3.util.retry:282] - trace=None Converted retries value: 2 -> Retry(total=2, connect=None, read=None, redirect=None, status=None)
[2024-03-07 22:29:57.244441] [DEBUG process-9-140461729638080 urllib3.connectionpool:1055] - trace=None Starting new HTTPS connection (1): api.openai.com:443
[2024-03-07 22:29:57.314024] [INFO process-9-140465245408128 bisheng.utils.threadpool:99] - trace=None async_wait_count=1
[2024-03-07 22:29:58.424105] [DEBUG process-9-140461729638080 urllib3.connectionpool:549] - trace=None https://api.openai.com:443 "POST /v1/chat/completions HTTP/1.1" 200 None
[2024-03-07 22:29:58.427627] [DEBUG process-9-140461729638080 openai.util:60] - trace=None message='OpenAI API response' path=https://api.openai.com/v1/chat/completions processing_ms=239 request_id=req_f938ec6f8f35653fd74051e0f34e53bc response_code=200
[2024-03-07 22:29:58.781327] [INFO process-9-140465245408128 bisheng.utils.threadpool:99] - trace=None async_wait_count=1
[2024-03-07 22:29:59.317093] [INFO process-9-140465245408128 bisheng.utils.threadpool:99] - trace=None async_wait_count=1
[2024-03-07 22:29:59.377328] [DEBUG process-9-140461729638080 bisheng.api.v1.callback:291] - trace=None on_chain_end outputs={'response': '我是一个AI助手,被称为GPT-3。我是由OpenAI开发的人工智能模型。我可以回答各种问题,提供信息和建议。请问有什么我可以帮助你的吗?'}

Finished chain.
[2024-03-07 22:30:00.384149] [DEBUG process-9-140461729638080 bisheng.chat.utils:46] - trace=None Generated result and intermediate_steps
[2024-03-07 22:30:00.389552] [INFO process-9-140461729638080 bisheng.chat.handlers:38] - trace=None dispatch_task done timecost=137.8565034866333
[2024-03-07 22:30:00.784964] [DEBUG process-9-140465245408128 bisheng.chat.manager:245] - trace=None task_complete key=be7522ca-3066-4d42-8f89-bc91547a5d4a_None_None

@yaojin3616
Copy link
Collaborator

报错是和openai 建立连接出错,最后重试又成功了。 这个现象是必现吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants