Closed sjrsjz closed 7 months ago
another error:
Using Bing provider and gpt-4-turbo model
Traceback (most recent call last): File "/sdcard/mirai/mirai/AliceBot-main/AliceBot.py", line 48, in
however it worked yesterday,so i don't think it is my problem
code:
os.environ["HTTP_PROXY"]="http://127.0.0.1:7890" os.environ["HTTPS_PROXY"]="http://127.0.0.1:7890" os.environ["G4F_PROXY"]="http://127.0.0.1:7890"
try: g4f.ChatCompletion().create( model=g4f.models.gpt_4, provider=g4f.Provider.Bing, messages=[{"role":"user","content":"say:test"}] ) except Exception as e: traceback.print_exc() print("G4F not available") exit(1) print("G4F available")
Same here, absolutely same error message. (using version 0.2.4.0)
same here :
File "C:\Users\admin\anaconda3\lib\site-packages\g4f\providers\base_provider.py", line 200, in await_callback return await callback() File "C:\Users\admin\anaconda3\lib\site-packages\g4f\Provider\Bing.py", line 346, in stream_generate objects = msg.data.split(Defaults.delimiter) AttributeError: 'int' object has no attribute 'split'
same, i am very much looking forward to the fix, also bing worked before but became very censored, I hope the gpt4free team will find a solution to the problem and return everything to the way it was before.
I worked hard to solve the issues. I added a wait and retry to Bing. It also protects you against bans. You will never become this errors again:
yesterday i was able to get it but today no. that's very strange, is there any internet access option?
prompt = 'what is the price of bitcoin today?'
(base) D:\7B>python test.py
Using Bing provider
As of my last update, I don't have real-time data.
However, you can check the latest price of Bitcoin on financial news websites, cryptocurrency exchanges, or financial market data platforms. They provide up-to-date information on Bitcoin prices and market trends. Remember, cryptocurrency markets are highly volatile, so prices can change rapidly within short periods of time.
prompt = 'what is your last update and who are you?'
(base) D:\7B>python test.py Using Bing provider
I am Microsoft Copilot. My last update was in 2021, which means my internal knowledge is current up to that year.
I also have big problems with my prompt, yesterday it worked correctly although it started to censor strongly (before this was not the case), now without prompt at all and just on the messages the result is but on the messages with my old prompt that used to work I get "", literally nothing.
but I want to say thanks to the gpt4free team for reviving it at all, but now I will play with my prompt to make it work again.
Update: Almost any prompt or history of several messages will result in the empty string "".
I worked hard to solve the issues. I added a wait and retry to Bing. It also protects you against bans. You will never become this errors again:
- Can't create a new chat
- CaptchaChallenge
Thank you very much for your work, but do you plan to fix the issue with returning an empty string? It works very strangely but I've come to the conclusion that it happens now in almost any usage scenario.
@hlohaus new error:
When I pass in a large number of contexts (probably twenty or more) to the bing, it will respond nothing
This may have something to do with this:
"throttling":{"maxNumUserMessagesInConversation":10, "numUserMessagesInConversation":1," maxNumLongDocSummaryUserMessagesInConversation":5, "numLongDocSummaryUserMessagesInConversation":0}
bing will respond like this(Even though I only asked two questions.):
"body":[{"type":"TextBlock","text":"Hmm…let’s try a different topic. Sorry about that. What else is on your mind?","wrap":true}]}]
which may cause to the empty response.
Other than that, basically only 404 errors occur now. For simple contexts, bing is now able to correctly respond
I could add a error message for this case:
Your request body is to long
I could add a error message for this case:
Your request body is to long
I suspect that's not the main reason, because if I just gave bing the following context he would still refuse to answer
[{'role': 'user', 'content': '"At:123456789":你好'}, {'role': 'assistant', 'content': '你好!有什么我可以帮助您的吗?'}, {'role': 'user', 'content': '"At:123456789":你叫什么'}],
bing:My mistake, I can't give a response to that right now. let's try a different topic.
and bing will respond nothing.
I think it might be a problem with g4f's handling of context formatting? Because it doesn't happen when I talk directly on the webpage.
g4f use a special context. It creates a new conversation and adds previous messages to the new message. We can't reuse the conversation because the last message could be answered from a other provider.
But if we pin the conversation to the provider, we could reuse the old conversation.
g4f use a special context. It creates a new conversation and adds previous messages to the new message. We can't reuse the conversation because the last message could be answered from a other provider.
But if we pin the conversation to the provider, we could reuse the old conversation.
In create_message(), if I change
if context:
struct['arguments'][0]['previousMessages'] = [{
"author": "user",
"description": context,
"contextType": "WebPage",
"messageType": "Context",
"messageId": "discover-web--page-ping-mriduna-----"
}]
to
if context:
struct['arguments'][0]['previousMessages'] = [{
"author": "user",
"description": context,
"contextType": "ClientApp",
"messageType": "Context",
"messageId": "discover-web--page-ping-mriduna-----"
}]
it will work again. Very weird
g4f use a special context. It creates a new conversation and adds previous messages to the new message. We can't reuse the conversation because the last message could be answered from a other provider. But if we pin the conversation to the provider, we could reuse the old conversation.
In create_message(), if I change
if context: struct['arguments'][0]['previousMessages'] = [{ "author": "user", "description": context, "contextType": "WebPage", "messageType": "Context", "messageId": "discover-web--page-ping-mriduna-----" }]
to
if context: struct['arguments'][0]['previousMessages'] = [{ "author": "user", "description": context, "contextType": "ClientApp", "messageType": "Context", "messageId": "discover-web--page-ping-mriduna-----" }]
it will work again. Very weird
This method causes context to become useless
g4f use a special context. It creates a new conversation and adds previous messages to the new message. We can't reuse the conversation because the last message could be answered from a other provider.
But if we pin the conversation to the provider, we could reuse the old conversation.
May be useful if not solved so far. Works iif provider is not used in "auto". https://github.com/VadimBoev/freegpt-webui-v2/pull/29
Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.
Closing due to inactivity.
the log: Using Bing provider and gpt-4-turbo model Traceback (most recent call last): File "/sdcard/mirai/mirai/AliceBot-main/AliceBot.py", line 48, in
g4f.ChatCompletion().create( File "/usr/local/lib/python3.10/dist-packages/g4f/init.py", line 146, in create
return result if stream else ''.join([str(chunk) for chunk in result]) File "/usr/local/lib/python3.10/dist-packages/g4f/init.py", line 146, in
return result if stream else ''.join([str(chunk) for chunk in result])
File "/usr/local/lib/python3.10/dist-packages/g4f/providers/base_provider.py", line 204, in create_completion
yield loop.run_until_complete(await_callback(gen.anext))
File "/usr/local/lib/python3.10/dist-packages/nest_asyncio.py", line 98, in run_until_complete
return f.result()
File "/usr/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception.with_traceback(self._exception_tb)
File "/usr/lib/python3.10/asyncio/tasks.py", line 232, in __step
result = coro.send(None) File "/usr/local/lib/python3.10/dist-packages/g4f/providers/base_provider.py", line 200, in await_callback return await callback() File "/usr/local/lib/python3.10/dist-packages/g4f/Provider/Bing.py", line 326, in stream_generate conversation = await create_conversation(session)
File "/usr/local/lib/python3.10/dist-packages/g4f/Provider/bing/conversation.py", line 55, in create_conversation
raise ResponseStatusError(f"Response {response.status}: Can't create a new chat")
g4f.errors.ResponseStatusError: Response 404: Can't create a new chat