Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty Response on 2.0.0 with GPT4 #39

Closed
WolfgangWeigl opened this issue Jan 19, 2024 · 8 comments
Closed

Empty Response on 2.0.0 with GPT4 #39

WolfgangWeigl opened this issue Jan 19, 2024 · 8 comments

Comments

@WolfgangWeigl
Copy link

Hi there,

I use this Moodle plugin (2.0.0) on Moodle 4.2 with the GPT4 model in the chat settings.

If I make some requests, there are only empty responses:

BlockChatBug

Is this a bug only on my Moodle system, or is it a general bug?

Thanks!

@Limekiller
Copy link
Owner

Thanks for the report -- I haven't seen this issue before. If you look in the network tab of your browser's developer console, you should see a POST request to "/blocks/openai_chat/api/completion.php" for each chat request. Could you please let me know the value of the response for one of these requests when the message is empty?

Additionally, please provide as much information as you can about your environment. What browser + version, what Moodle version, and what specific plugin and block settings are you using?

@OkorrDev
Copy link

I have the same issue as WolfgangWeig. I am in Moodle 4.1.1. The plugin was working perfectly until the latest update.

@Limekiller
Copy link
Owner

I've done some testing and discovered that this issue can appear when passing invalid arguments to OpenAI when using the chat API. In the first example I found, this issue could be triggered by setting the "max tokens" setting to 0 (max tokens must be at least 1). Similar behavior can be triggered by using invalid values for other settings in the advanced section.

@OkorrDev , since you didn't provide the documentation I asked for in my previous comment, I can't know specifically what issue you're running into, but I pushed a new branch that will detect these types of errors and print them in the chat window when they're encountered. Please try switching to the release-2.0.1 branch and let me know if you see an error in the chat window, and if so, what it says. I'd also recommend auditing your setting values in the advanced section and making sure they are valid (assuming you're using the chat API).

@WolfgangWeigl
Copy link
Author

Thanks for the report -- I haven't seen this issue before. If you look in the network tab of your browser's developer console, you should see a POST request to "/blocks/openai_chat/api/completion.php" for each chat request. Could you please let me know the value of the response for one of these requests when the message is empty?

Additionally, please provide as much information as you can about your environment. What browser + version, what Moodle version, and what specific plugin and block settings are you using?

I wanted to reproduce the error to check the status code, but now the plugin works.

The browser I am using is Firefox 121.0.1 (64 bit), the Moodle version is 4.2.1 (Build: 20230612), the plugin is version 2.0.0 (Build: 2024010300).

The plugin settings are all set to default:

  • type: chat
  • allowinstancesettings: no
  • model: gpt-4
  • temperature: 0.5
  • maxlength: 500
  • topp: 1
  • frequency : 1
  • presence: 1

And the block settings are:

  • Show labels: True
  • Source of truth: empty

Maybe it works now because a credit card is now stored in the OpenAI account.

If this is the case, it would be helpful if you could check whether the API key is linked to a paid OpenAI account. And if not, an error message would be great.

Thanks for your quick efforts!

@OkorrDev
Copy link

Thanks @WolfgangWeigl. I had the same issue. I will do credit card registration too and see if it works.

@OkorrDev
Copy link

"If this is the case, it would be helpful if you could check whether the API key is linked to a paid OpenAI account. And if not, an error message would be great."

I agree with this.

@Limekiller
Copy link
Owner

Awesome, thanks for the details! Good to know about the credit card. It sounds like your API requests were triggering errors (due to the billing issue) which was causing the empty messages -- so the same bug that I had identified, just triggered under different circumstances. The latest 2.0.1 update will identify these types of errors and print them in chat so that admins aren't stuck with no feedback as to why it isn't working. Thanks again for the report!

@OkorrDev
Copy link

OkorrDev commented Jan 23, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants