Next.js Discord

Discord Forum

using Asynchronous Server Gateway Interface (ASGI)[ERROR] KeyError: 'choices'

Answered
Knopper gall posted this in #help-forum
Open in Discord
Avatar
Knopper gallOP
I am creating a FastAPI/NextJS app using the Vercel template. I have coded the backend and the frontend. When I run the app I can see the UI. I enter the details and click the Generate button. But I don't see any results. When I checked the logs I see the following error: using Asynchronous Server Gateway Interface (ASGI)
[ERROR] KeyError: 'choices'

Here's the traceback: https://pastebin.com/XG8D02Nf

Here's a function I am using in FastAPI: https://pastebin.com/cAhDjnQ2

Here's how I coded my frontend to connect to the backend: https://pastebin.com/Y3sgexzg

Not sure where I am going wrong.

What am I trying to achieve here is to take an input from user, pass it to the function above, process the input using llmOS API, send the output to the user. That's it. Let me know if you need any further details.
Answered by Jesse677
This is what my friend said.
his error not ASGI, but [ERROR] KeyError: 'choices'
and in his python code he have video_title = result['choices'][0]['message']['content']
so the problem that this result variable don't have choices in it, and he need to check what he have here
View full answer

1 Reply

Avatar
Jesse677
This is what my friend said.
his error not ASGI, but [ERROR] KeyError: 'choices'
and in his python code he have video_title = result['choices'][0]['message']['content']
so the problem that this result variable don't have choices in it, and he need to check what he have here
Answer