author_rename
from langchain import OpenAI, LLMMathChain import chainlit as cl @cl.author_rename def rename(orig_author: str): rename_dict = {"LLMMathChain": "Albert Einstein", "Chatbot": "Assistant"} return rename_dict.get(orig_author, orig_author) @cl.on_message async def main(message: cl.Message): llm = OpenAI(temperature=0) llm_math = LLMMathChain.from_llm(llm=llm) res = await llm_math.acall(message.content, callbacks=[cl.AsyncLangchainCallbackHandler()]) await cl.Message(content="Hello").send()
from langchain import OpenAI, LLMMathChain import chainlit as cl @cl.on_message async def main(message: cl.Message): llm = OpenAI(temperature=0) llm_math = LLMMathChain.from_llm(llm=llm) res = await llm_math.acall(message.content, callbacks=[cl.AsyncLangchainCallbackHandler()]) # Specify the author at message creation response_message = cl.Message(content="Hello", author="NewChatBotName") await response_message.send()
Was this page helpful?