Spaces:
Runtime error
Runtime error
| import chainlit as cl | |
| from chainlit.input_widget import TextInput | |
| from rag import RAGModel | |
| import os | |
| import nest_asyncio | |
| nest_asyncio.apply() | |
| # Initialize RAG model | |
| rag_model = RAGModel(openai_api_key=os.getenv("OPENAI_API_KEY")) | |
| async def main(message): | |
| result = rag_model.query(message.content) | |
| print(result) | |
| await cl.Message(result).send() | |
| # @cl.application | |
| # def app(): | |
| # cl.TextInput(label="Enter your query", on_submit=handle_message) | |
| async def start(): | |
| #def on_chat_start(): | |
| msg=cl.Message(content="Firing up the research info bot...") | |
| await msg.send() | |
| msg.content= "Hi, welcome to research info bot. What is your query?" | |
| await msg.update() | |
| # if __name__ == "__main__": | |
| # cl.run() | |