ChatGPT
ChatGPT copied to clipboard
TypeError: object generator can't be used in 'await' expression
when run this:
async def printMessage(): async for i in await chatbot.get_chat_response("hello", output="stream"): print(i['message'])
asyncio.run(printMessage())
error report: async for i in await chatbot.get_chat_response("hello", output="stream"): TypeError: object generator can't be used in 'await' expression
As it says, you can't use await for streams. If you want to stream data, using a normal loop through the normal Chatbot with output="stream" would send the data asynchronously
@arwooy make sure you import the async version of the chatbot:
from revChatGPT.revChatGPT import AsyncChatbot
works for me with Python 3.10+