Debugging Discourse's AI Features: When OpenAI Responds but Forum Doesn't

Thank you for developing AI functions for discourse! I think this will be an important feature in the future.

I tryed using the AI plugin in our self-hosted forum (tff-forum.de). After adding the Open AI API key in the admin panel and activating the model “gpt-3.5-turbo-16k” for the different functions I can see the additional AI buttons at different places of the forum.

When I click on one of the buttons I get either nothing back or the error message shown on the following screenshot.

I can see the API requests in the Open AI usage dashboard but it seems that Discourse is not receiving the answer.

I also tryed the other models (gpt-35, gpt-4 etc.). The result is always the same that the functions don’t deliver any response.

The Discourse error log shows no problems regarding the AI functions.

Can you please provide some additional information on how to debug or analyze the issue?

Try the instruction below on your server please.

1 Like

Thank you for the script to check the Open AI API functionality.

We started the script on our server and got the following answer from gpt:

...
 {
 "index": 0,
 "message": {
 "role": "assistant",
 "content": "In the heart of the coded rhyme,\nBehold, there’s a concept sublime.\nIt's recursion, an art, an ancient tradition,\nOf a function calling itself, that's the mission.\n\nA function so proud, will not heed the call,\nOf any other, it stands tall.\nIt opts to invoke itself anew,\nThus, weaving patterns that intrigue view.\n\nWhen it starts, you might suppose,\nWhere it ends, no one knows?\nBut fear, not the infinite loop,\nFor base case is our saving hoop.\n\nUpon reaching the base so divinely small,\nThe function at last does forestall.\nSo, it stops and does not bind,\nReturning what it's meant to find.\n\nWho would make such hearty appeal?\nAn elegant way to seal the deal.\nSolving mazes, or reversing strings,\nSee recursion spreading its wings.\n\nEach instance has its memory stack,\nTo trace its way, front to back.\nAnd as these instances grow,\nA tower of memory, they bestow.\n\nWhen done right, the harmony is pure,\nRecursion’s charm, quite the lure.\nIt’s elegance, it’s profound autonomy,\nA jewel in the crown of algorithms' ceremony.\n\nIt's a dance, it's a play, eternal reprise,\nIn the theater of codes, where recursion lies.\nBehold the beauty, behold the excursion,\nIn the vast realm of code, that's the recursion."
 },
 "logprobs": null,
 "finish_reason": "stop"
 }
 ],
 "usage": {
 "prompt_tokens": 39,
 "completion_tokens": 282,
 "total_tokens": 321
 },
 "system_fingerprint": null
}

This call seems to work. But when I activate the Discourse AI functions (e.g. " composer ai helper") using the same Open AI API key I get either no answer or the error message shown in the first post of this thread.

Are there other possibilities to debug the Open AI API calls?

Have you updated to latest? We moved the LLM configuration to its own area.

1 Like

Thank you for your support. We started a rebuild today and now the functions based on the Open AI API seem to work.

Now I recognized a new problem. After the rebuild I’m no longer able to change the open AI model in the admin settings. The list seems to be empty but Discourse still uses my last setting “gpt-4o”.

Is this an already known problem? Do you think that another rebuild might fix it?

Sorry, I found the reason for my problem. As you mentioned, the LLMs now have a separate area in the admin settings.

After defining the Open AI LLMs I can now select the models for the different AI functions.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.