Closed frankwanicka closed 1 year ago
Can you try to update to 0.5.0?
I am sorry for not being more specific. It changed in 0.4.1. I have tested with 0.4.2, 0.4.3 and 0.5.0 and the same behavior exists in all of those. This will demonstrate it:
import chainlit as cl
import sys
@cl.on_chat_start
async def start_chat():
print(__name__)
print(__name__ in sys.modules)
@cl.on_message
async def main(message: str):
# Send a response back to the user
await cl.Message(
content=f"Received: {message}",
).send()
The name of the module will be printed and then True or False. You should get True in 0.4.0 and prior versions and False in 0.4.1 and later versions.
This might be the change that changed that behavior. Looking into it
Thanks very much for the quick response and all the work you are doing.
I am hoping this is another dumb mistake on my part. I am new to Python so bear with me. I am using the OpenAI functions and am calling the function dynamically based on the name. The code is:
This seems to be the recommended way to do this based on what I have read. It works fine in 0.4.0. In 0.4.1, I get a KeyError, because the root file is no longer in sys.modules, so sys.modules[name] fails. Was that intentional? I have looked through the commits from 0.4.0 to 0.4.1 and nothing jumps out. Thanks in advance.