Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
6.25k stars 799 forks source link

After running the chainlit run app.py getting the error "Could not reach the server" #51

Closed Cenrax closed 1 year ago

Cenrax commented 1 year ago

Platform : Windows 11

  1. Installed the chainlit from
    • Download the wheel
    • Run pip uninstall chainlit
    • Run pip install PATH_TO_WHEEL
  2. After that getting the error:
    2023-06-11 19:29:28 - Module should at least expose one of @langchain_factory, @on_message or @on_chat_start function
willydouhard commented 1 year ago

yes, a chainlit app should at lease expose one of those. for instance:

import chainlit as cl

@cl.on_message
async def main(message: str):
   await cl.Message(content=message).send()

Is a minimal example

Cenrax commented 1 year ago

Hey @willydouhard. Yup that works but I have a followup question regarding the following example in https://docs.chainlit.io/examples/qa

This is not working and it is showing the same error,

Module should at least expose one of @langchain_factory, @on_message or @on_chat_start function

Even though the code has @langchain_factory function

willydouhard commented 1 year ago

Ah I see you are using the wheel from the PR. Then langchain_factory now takes a parameter use_async. So it should be:

@cl.langchain_factory(use_async=False)
def main():
    pass