python-tgpt icon indicating copy to clipboard operation
python-tgpt copied to clipboard

BlackboxAI not giving response despite a 200 response from server?

Open sane800r41 opened this issue 1 year ago • 2 comments

Hi, so I was trying to make a simple ai chatbot script for testing, and it seems that despite the 200 response, it still throws an exception? Phind works. Here's my code:


def main():
    bot = blackbox.BLACKBOXAI()
    
    while True:
        user_input = input("You: ")
        if user_input.lower() == 'exit':
            print("Ending the conversation. Goodbye!")
            break
        
        response = bot.chat(user_input)
        print(f"Bot: {response}")

if __name__ == "__main__":
    main()```

...and here's the output:
```You: Hi!
Traceback (most recent call last):
  File "c:\Users\Saneboorai\Desktop\SaneJS\bbapiSANE.py", line 16, in <module>
    main()
  File "c:\Users\Saneboorai\Desktop\SaneJS\bbapiSANE.py", line 12, in main
    response = bot.chat(user_input)
               ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Saneboorai\AppData\Roaming\Python\Python312\site-packages\pytgpt\blackboxai\main.py", line 216, in chat
    return for_stream() if stream else for_non_stream()
                                       ^^^^^^^^^^^^^^^^
  File "C:\Users\Saneboorai\AppData\Roaming\Python\Python312\site-packages\pytgpt\blackboxai\main.py", line 208, in for_non_stream
    self.ask(
  File "C:\Users\Saneboorai\AppData\Roaming\Python\Python312\site-packages\pytgpt\blackboxai\main.py", line 181, in ask
    return for_stream() if stream else for_non_stream()
                                       ^^^^^^^^^^^^^^^^
  File "C:\Users\Saneboorai\AppData\Roaming\Python\Python312\site-packages\pytgpt\blackboxai\main.py", line 177, in for_non_stream
    for _ in for_stream():
             ^^^^^^^^^^^^
  File "C:\Users\Saneboorai\AppData\Roaming\Python\Python312\site-packages\pytgpt\blackboxai\main.py", line 149, in for_stream
    raise exceptions.FailedToGenerateResponseError(
pytgpt.exceptions.FailedToGenerateResponseError: Failed to generate response - (200, OK)

also, does blackbox or any other models have web access? when i asked phind about something from today it said that it doesn't know.

sane800r41 avatar Nov 30 '24 19:11 sane800r41

Looks like there are some changes on the provider's side. Intervention is underway.

Simatwa avatar Dec 05 '24 07:12 Simatwa

Okay, looking forward to it getting fixed!

sane800r41 avatar Dec 05 '24 08:12 sane800r41

The provider was deprecated a while ago.

Simatwa avatar Oct 27 '25 09:10 Simatwa