importopenaiimportchainlitasclopenai.api_key="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"model_name="text-davinci-003"settings={"temperature":0.7,"max_tokens":500,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"stop":["```"],}prompt="""Answer the following question:{question}"""@cl.on_messageasyncdefmain(message:str):fromatted_prompt=prompt.format(question=message)msg=cl.Message(content="",prompt=fromatted_prompt,llm_settings=cl.LLMSettings(model_name=model_name,**settings),)asyncforstream_respinawaitopenai.Completion.acreate(model=model_name,prompt=fromatted_prompt,stream=True,**settings):token=stream_resp.get("choices")[0].get("text")awaitmsg.stream_token(token)awaitmsg.send()