Open h9052300 opened 3 months ago
I think it could be a proper error display, but I don't think it can be bypassed. You can reset the chat, and sometimes it helps, but it also stops working after a time. I think it's a limit on the DDG side.
Proxies and maybe changing the user agent randomly in duck_chat could help. Somehow DDG identifies the device sending too many requests and throttles it. For me it happens only when I abuse it too much.
Fake user agent is there, I just noticed it. So, only proxies.
@h9052300 Try to open https://duck.ai in browser - if there is error too, so you need some proxy
I think it's related that when you use it too much, they just force you to reset the chat. It would not really help to use a proxy or something else, in my opinion.
I think it's related that when you use it too much, they just force you to reset the chat. It would not really help to use a proxy or something else, in my opinion.
I'm using it programmatically, changing the model on each completion and I'm still getting throttled. I assume this is what you mean by reset
Yes, when I use it for long conversation after something like 10 messages, it forces making another conversation. But it's done too much, it just blocks you for some time.
I don't know if it was also like that on the browser, but I could no more use the application for a bit of time.
I guess that's because DDC issue, You can make each question are one session.
I guess that's because DDC issue, You can make each question are one session.
async def DDG(self,model: str, prompt: str) -> str:
ddg_chat = DuckChat(model)
resp = await ddg_chat.ask_question(prompt)
await ddg_chat._session.close()
print(resp)
return resp
This is how I'm using it and still get limited. This function's argument 'model' comes from another function that randomizes the models, so it also resets history from DDG. So, there is some other pattern that DDG uses to identify same user.
@mrgick it's possible that history sent from previous model to trigger some red flag when switching models? I don't know, but I assume they have some bot detection in place
Hello, sorry for long answer
import asyncio
from duck_chat import DuckChat
async def DDG(model, prompt)
async with DuckChat(model=model) as chat:
resp = await ddg_chat.ask_question(prompt)
print(resp)
return resp
async def test():
await DDG("gpt-4o-mini","2+2?")
await DDG("gpt-4o-mini","Tell answer")
asyncio.run(test())
About bot detection, I think duck.ai start to detect aiohttp connection (maybe bad cookies/tcp timings) or maybe they see that we don't send country.json and status requests.
I think library need to migrate from aiohttp to curl_cffi with more simulating request (maybe this will help)
Also needed more research and for now I don't have much time to migrate library =(
I think I only got 1 time an issue. Even now, I didn't get the ERR_CONVERSATION_LIMIT yet, but it's true I only use it for a few questions, and then I close the session.
That's why I guess it's not really the library, but just the limitation that DDG choose to apply.
I have abused a little bit Duckduckgo's servers lately. I am getting a different error, not the CONVERSATION LIMIT, but ERR_UPSTREAM. I am quite confident it's an IP issue, because as soon as I switch network, it's working again. It could be also fingerprints, but I think bot fingerprinting would persist after IP changing. I will be trying with proxies ASAP and will report here.
await ddg_chat._session.close()
Thank you. Its work!
Hello. I am getting a 429 error again. However, "await ddg_chat._session.close()" is not working now.
I used the method text.replace('\n', '') before sending requests; there were probably too many line breaks in my text. Now there are no errors. I didn't think to check this earlier because I was receiving a 429 error and thought the problem was that the service had restricted access from my device.
Thank you for your work!
I'll always be in trouble. {“action”: “error”, “status”:429, “type”: “ERR_CONVERSATION_LIMIT”}