xtekky / gpt4free

The official gpt4free repository | various collection of powerful language models
https://g4f.ai
GNU General Public License v3.0
62.34k stars 13.4k forks source link

A bug with gaps in the responses from the Blackbox provider #2384

Closed Taskov1ch closed 1 week ago

Taskov1ch commented 1 week ago

Bug description When using the Blackbox provider, the final answer loses most of the spaces, which is why the words literally "stick" to each other. This does not always happen, but often.

from g4f.client import Client
from g4f.Provider import Blackbox

client = Client(provider=Blackbox)

response = client.chat.completions.create(
    messages=[{"role": "user", "content": "Who are you?"}],
    model="gpt-4o"
)

print(response.choices[0].message.content)

Output: I am an AI language model createdby OpenAI, designed to assist with a wide range of questions and tasks by providing information, generating text,and engaging in conversation. How can I help you today? Output 2 (bug): Iam an AIlanguage modelcreated byOpenAI, designedto assistwith awide rangeof questionsand tasksby providinginformation andgenerating textbased onthe input Ireceive. How can Ihelp you today?

Environment Python 3.10 g4f 0.3.5.0

hlohaus commented 1 week ago

I successfully resolved the problem of missing spaces in the Blackbox provider.