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

Assistant Error Generating Response #179

Open
tiggeradam opened this issue Jan 22, 2025 · 3 comments
Open

Assistant Error Generating Response #179

tiggeradam opened this issue Jan 22, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@tiggeradam
Copy link

Which version of assistant are you using?

2.3.0

Which version of Nextcloud are you using?

30.0.5

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Firefox

Describe the Bug

When attempting to use Assistant I get "Error Generating Response". I am using chatGPT https://api.openai.com/v1 I have inserted my api key. I am using a paid version of chatgpt.
Things I tried.
I have tried running occ background-job:worker as I have seen in an earlier case.
I have also tried removing and reinstalling bothe the ai and assistant.
I double checked my API key and I played around a bit with the URL.
Lots of Google.

F12 Console
Image
Nextcloud Server Log
Image

Expected Behavior

I expect to get a response with no error

To Reproduce

I am using the truenas scale docker app. I am accessing it through a cloudflare tunnel. Nothing else out of the ordinary.

@tiggeradam tiggeradam added the bug Something isn't working label Jan 22, 2025
@Trasted1
Copy link

Trasted1 commented Feb 3, 2025

Same here. Using Cloudflare Tunnel as well.

@Mer0me
Copy link

Mer0me commented Feb 7, 2025

Using LocalAI / OpenWebUI, same problem.
I have this in the nextcloud log :
{"reqId":"PVm43gtTAg9dK6dONNYc","level":3,"time":"2025-02-07T16:18:52+01:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"Undefined array key \"total_tokens\" at /var/www/nextcloud/apps/integration_openai/lib/Service/OpenAiAPIService.php#465","userAgent":"--","version":"30.0.4.1","data":{"app":"PHP"}} {"reqId":"PVm43gtTAg9dK6dONNYc","level":3,"time":"2025-02-07T16:18:52+01:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Unknown error while processing TaskProcessing task","userAgent":"--","version":"30.0.4.1","exception":{"Exception":"TypeError","Message":"OCA\\OpenAi\\Db\\QuotaUsageMapper::createQuotaUsage(): Argument #3 ($units) must be of type int, null given, called in /var/www/nextcloud/apps/integration_openai/lib/Service/OpenAiAPIService.php on line 468","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/integration_openai/lib/Service/OpenAiAPIService.php","line":468,"function":"createQuotaUsage","class":"OCA\\OpenAi\\Db\\QuotaUsageMapper","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/integration_openai/lib/TaskProcessing/TextToTextChatProvider.php","line":111,"function":"createChatCompletion","class":"OCA\\OpenAi\\Service\\OpenAiAPIService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/TaskProcessing/Manager.php","line":810,"function":"process","class":"OCA\\OpenAi\\TaskProcessing\\TextToTextChatProvider","type":"->"},{"file":"/var/www/nextcloud/lib/private/TaskProcessing/SynchronousBackgroundJob.php","line":54,"function":"processTask","class":"OC\\TaskProcessing\\Manager","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OC\\TaskProcessing\\SynchronousBackgroundJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php","line":43,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php","line":29,"function":"start","class":"OCP\\BackgroundJob\\QueuedJob","type":"->"},{"file":"/var/www/nextcloud/core/Command/Background/JobWorker.php","line":129,"function":"execute","class":"OCP\\BackgroundJob\\QueuedJob","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":326,"function":"execute","class":"OC\\Core\\Command\\Background\\JobWorker","type":"->"},{"file":"/var/www/nextcloud/core/Command/Base.php","line":161,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1078,"function":"run","class":"OC\\Core\\Command\\Base","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":324,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":175,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":183,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":87,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/integration_openai/lib/Db/QuotaUsageMapper.php","Line":193,"message":"Unknown error while processing TaskProcessing task","exception":{},"CustomMessage":"Unknown error while processing TaskProcessing task"}}

@julien-nc
Copy link
Member

@Mer0me Thanks for reporting this. This was a mistake causing a crash when the service does not include the token count in the completion response. This is fixed in nextcloud/integration_openai#189 and will be included in the next integration_openai release.

@tiggeradam @Trasted1 We need more information on the error. You can look for lines that contain integration_openai in the nextcloud.log file. You can also check the error_message column from the oc_taskprocessing_tasks table entries.

Potential solution: If you've configured integration_openai to use OpenAI, maybe you didn't switch to using max_completion_tokens instead of max_tokens in the integration_openai admin settings:
Image

This is a recent breaking change in the OpenAI API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants