#cant run an async loop in an async loop
1 messages · Page 1 of 1 (latest)
next steps:: how can I await for the response object to finish creating before returning it?
prepend await before expression
yeah
also show your code
isn't it already awaiting?
response = await asyncio.create_task(ai_chat.chat(prompt))
await ctx.respond(response)
both are await
this was a rethorical question
I recommend you give this a read
i know how it works I just can't figure this shit out
also awaiting a task immediately after creating it is utterly pointless
because at that point you could just await the original coro
all async functions and awaitables need to be awaited to actually get the result
create_async is an async function
go figure
that's not what I said
🗿
I'm not sure why you're trying to create a task in the first place
stop bruteforcing async python
but it is my firm impression that you have absolutely 0 clue how async works
therefore I recommend you give the guide I sent a read
and try to understand it
it is vital if you're trying to actually write async code
it's a complicated topic with a lot of nuance, so I really do recommend you do some research first
there's also an excellent guide on fastapi's site
if you prefer a more example-oriented guide
response = await ai_chat.chat(prompt) i get this
yeah i read the guide
still dont get it
you didn't read a 1 hour long guide in 10 minutes
not if you actually tried to understand any of it
stop lying to us & to yourself
no i read the tldr

yeah honestly I can't help people who are not willing to help themselves
I'm not going to spoonfeed you the correct code, because you'll learn nothing from that
but you don't want to learn, so...
yeah I'm out
why so harsh bruh
im gonna go watch a tutorial or something
ive been up all night until 7 am
Maybe get some sleep first
then you should probably sleep
Sleep a proper amount
4 hours isn't nearly enough for someone to function properly
Especially a tutorial. Most of it will just go over your head and u wont learn from it
Get decent sleep
i have very bad insomnia and i get sleep paralysis a few times a night
i need meds but ran out 2 days ago
well in that case I implore you to address your health issues first
you shouldn't die trying to bruteforce python
i got core health issues from age 14
it's counterproductive
borderline
i can barely have any motivation to do anything
so instead i try to do something instead of trying to kill myself for the 10th time
all I told you is to do some research
that's all I want you to do
I want you to be healthy, I want you to make this bot, I'm not against you
as surprising as that may sound
g4f.ChatCompletion.create is blocking, use create_async in async environments