n3d1117 / chatgpt-telegram-bot

🤖 A Telegram bot that integrates with OpenAI's official ChatGPT APIs to provide answers, written in Python
GNU General Public License v2.0
3.05k stars 1.4k forks source link

duckduckgo functions no longer working #526

Closed Schwabius closed 7 months ago

Schwabius commented 9 months ago

I've been having trouble with websearch and imagesearch functions for the last month or so, no changes that I'm aware of to code, just seemed to have happened out of nowhere. Here is the error message I receive:

2024-01-30 21:23:22,838 - root - INFO - Message is a reply to the bot, allowing... 2024-01-30 21:23:26,486 - root - INFO - Calling function web_search with arguments { "query": "latest news", "region": "us-en" } 2024-01-30 21:23:27,127 - duckduckgo_search.duckduckgo_search - WARNING - _get_url() https://links.duckduckgo.com/d.js HTTPError 2024-01-30 21:23:30,241 - duckduckgo_search.duckduckgo_search - WARNING - _get_url() https://links.duckduckgo.com/d.js HTTPError 2024-01-30 21:23:33,371 - duckduckgo_search.duckduckgo_search - WARNING - _get_url() https://links.duckduckgo.com/d.js HTTPError 2024-01-30 21:23:33,371 - root - ERROR - Traceback (most recent call last): File "\bot\telegram_bot.py", line 697, in prompt async for content, tokens in stream_response: File "\bot\openai_helper.py", line 178, in get_chat_response_stream response, plugins_used = await self.handle_function_call(chat_id, response, stream=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\bot\openai_helper.py", line 304, in handle_function_call function_response = await self.plugin_manager.call_function(function_name, self, arguments) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\bot\plugin_manager.py", line 59, in call_function return json.dumps(await plugin.execute(function_name, helper, **json.loads(arguments)), default=str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\bot\plugins\ddg_web_search.py", line 56, in execute results = list(islice(ddgs_gen, 3)) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 150, in text yield from self._text_api(keywords, region, safesearch, timelimit) File "\venv\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 201, in _text_api resp = self._get_url( ^^^^^^^^^^^^^^ File "\venv\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 89, in _get_url raise ex File "\venv\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 82, in _get_url raise httpx._exceptions.HTTPError("") httpx.HTTPError

Warning: I am an idiot. Please explain to me like I am an idiot. Much appreciated

yurnov commented 9 months ago

How you build/execute a chatgpt-telegram-bot? Could you please run pip freeze | grep duckduckgo-search?

Schwabius commented 9 months ago

How you build/execute a chatgpt-telegram-bot? Could you please run pip freeze | grep duckduckgo-search?

Nevermind, please disregard. Found the fix in another thread in discussions, just needed to update duckduckgo_search to latest. Thank you though

ghost commented 7 months ago

How you build/execute a chatgpt-telegram-bot? Could you please run pip freeze | grep duckduckgo-search?

Nevermind, please disregard. Found the fix in another thread in discussions, just needed to update duckduckgo_search to latest. Thank you though

how did you fix it? im having the same issue you had but I can't solve it

yurnov commented 7 months ago

how did you fix it? im having the same issue you had but I can't solve it

try to run a bot in Docker, you definitely will have correct version of all 3PPs