gpt4 book ai didi

terminal - Rasa 超时问题

转载 作者:行者123 更新时间:2023-12-05 01:39:29 24 4
gpt4 key购买 nike

当运行 Rasa(在 1.3.3、1.3.7、1.3.8 版本上试用)时,我几乎每次调用时都会遇到此超时异常消息。我正在运行一个简单的程序来识别用户何时提供他们的年龄,并通过操作响应将年龄存储在数据库中:

Bot loaded. Type a message and press enter (use '/stop' to exit):
Your input -> I am 24 years old
2019-10-10 13:29:33 ERROR asyncio - Task exception was never retrieved
future: <Task finished coro=<configure_app.<locals>.run_cmdline_io() done, defined at /Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/rasa/core/run.py:123> exception=TimeoutError()>
Traceback (most recent call last):
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/rasa/core/run.py", line 127, in run_cmdline_io
server_url=constants.DEFAULT_SERVER_FORMAT.format("http", port)
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/rasa/core/channels/console.py", line 138, in record_messages
async for response in bot_responses:
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/async_generator/_impl.py", line 366, in step
return await ANextIter(self._it, start_fn, *args)
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/async_generator/_impl.py", line 205, in throw
return self._invoke(self._it.throw, type, value, traceback)
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/async_generator/_impl.py", line 209, in _invoke
result = fn(*args)
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/rasa/core/channels/console.py", line 103, in send_message_receive_stream
async for line in resp.content:
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/aiohttp/streams.py", line 40, in __anext__
rv = await self.read_func()
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/aiohttp/streams.py", line 329, in readline
await self._wait('readline')
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/aiohttp/streams.py", line 297, in _wait
await waiter
File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/aiohttp/helpers.py", line 585, in __exit__
raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError
Transport closed @ ('127.0.0.1', 63319) and exception experienced during error handling

最初我认为这个超时是由我的 Rasa 程序的另一部分使用大型查找表引起的,但是对于年龄识别,我使用了一个简单的正则表达式:

## regex:age
- ^(0?[1-9]|[1-9][0-9]|[1][1-9][1-9])$

即使这样也会导致超时。

请帮我解决这个问题。我什至不需要避免超时,我只想知道在哪里可以捕获/忽略此异常。

谢谢!

最佳答案

我从一个 API 获取数据时出现超时错误,因为它无法在默认时间限制内获取数据:

  1. 进入目录:venv/Lib/site-packages/rasa/core/channels/console.py
  2. DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS 的默认值更改为超过 10,在我的例子中,我将其更改为 30 它起作用了。

    另一个原因可能是在短时间内一次又一次地获取数据,这可能会导致超时。
    观察:
  • DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS 设置为 10 时,出现超时错误
  • DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS 设置为 30 并继续一次又一次地运行 rasa shell 时,我收到超时错误
  • DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS 设置为 30 并且不经常运行 rasa shell 时,它可以完美运行。

关于terminal - Rasa 超时问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58322102/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com