Chainlit / chainlit

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

Add human-in-the-loop capabilities #1129

Open tituslhy opened 1 month ago

tituslhy commented 1 month ago

Is your feature request related to a problem? Please describe. There are more agentic applications that have human-in-the-loop as a feature (implemented in langgraph, llamaindex, and autogen). There is currently no feature in chainlit that supports this natively.

Describe the solution you'd like It would be great if chainlit has abstractions that support users in developing human-in-the-loop agentic apps!

Additional context Here are some examples of human-in-the-loop applications from the official docs of the respective libraries. langgraph: https://langchain-ai.github.io/langgraph/how-tos/human_in_the_loop/wait-user-input/ llamaindex: https://colab.research.google.com/github/run-llama/llama_index/blob/main/docs/docs/examples/agent/agent_runner/agent_runner_rag_controllable.ipynb autogen: https://microsoft.github.io/autogen/docs/tutorial/human-in-the-loop/

jefflavallee commented 1 month ago

Are you able to use AskUserAction or AskUserMessage within your tool to request human input?

tituslhy commented 1 month ago

Yes so I currently do it this way:

@tool("Ask human follow up questions")
def ask_human(question: str) -> str:
    """Ask human for feedback or follow up questions"""
    human_response = run_sync(
        cl.AskUserMessage(content=f'{question}').send()
    )
    if human_response:
        return human_response['output']

But the agentic libraries I'm talking about already have these things in-built within their abstractions, hence the suggestion!