Chainlit / chainlit

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

Tool steps are no longer nested in the new UI #1077

Open minhduc0711 opened 3 months ago

minhduc0711 commented 3 months ago

Describe the bug Version 1.1.300 introduced a new UI design to display intermediate steps, but the nested steps are no longer displayed in a nested manner.

To Reproduce Run this example

import chainlit as cl

@cl.step(type="tool")
async def parent_step():
    await child_step()
    return "Parent step output"

@cl.step(type="tool")
async def child_step():
    return "Child step output"

@cl.on_chat_start
async def main():
    await parent_step()

Expected behavior The child step should be indented to indicate that it is nested inside the parent step.

Screenshots image

Desktop (please complete the following information):

hayescode commented 3 months ago

yes this is by design. Why? I don't know. My users overwhelmingly miss the old tool UI. They do like the starters though (albeit they miss the markdown homescreen details).

GeorgSatyros commented 3 months ago

Not sure what the benefit was in completely removing existing, core functionality but it did a number to our application.. We may need to roll back and fork, even though we really like most other changes introduced.

pchalasani commented 3 months ago

Not sure what the benefit was in completely removing existing, core functionality but it did a number to our application..

Indeed, the new release completely breaks the demo examples on Langroid, a Multi-Agent LLM framework.

Even version 1.1.202 has un-intuitive design choices that seem to be based on a limiting mental model of what "steps" and "sub-steps" might constitute. Steps could be so-called "chain-of-thought", but that's just one possibility. Steps could also be an Agent delegating to a sub-agent, which Langroid supports.

E.g. when step B has parent_id pointing to step A, I expect the output of B to not only nest one level under A, but also the output of B should be displayed in chronologically correct order. E.g. in case B delegates to C, the C outputs should come after B's output. E.g. if I run the code below with 1.1.202

import chainlit as cl

@cl.on_chat_start
async def on_chat_start():
    a_step = cl.Step(name="A", type="text")
    a_step.output = "asking B"
    await a_step.send()

    b_step = cl.Step(
        name="B",
        parent_id=a_step.id,
        type="text",
    )
    b_step.output = "asking C"
    await b_step.send()

    c_step = cl.Step(
        name="C",
        parent_id=b_step.id,
        type="text",
    )
    c_step.output = "C answered!"
    await c_step.send()

I get this non-sensical ordering of outputs and steps (the nesting is correct though):

image

For example "asking B" should be displayed right under A, before the B step, etc.

If I switch to the latest release, things are broken in a new way, i.e. non-tool steps are no longer displayed at all. But even if I change those step types to "tool" just to get them displayed, it seems like the chronological order is respected (good), but nesting no longer respects parent_id pointers:

image

IMO two things need to be made configurable, and not baken-in to fit someone's specific mental model of what steps and sub-steps might mean:

Currently the design choices seem to be based on a failry limited view of steps and sub-steps, and completely ignore a multi-agent viewpoint. I've heard arguments such as:

jdb78 commented 1 month ago

@willydouhard , are you looking into changing this back / making it configurable or is this not on the roadmap?

hayescode commented 1 month ago

Adding our new lord and savior @dokterbob

marketneutral commented 3 weeks ago

Also very frustrated by this. I see old examples of chainlit with screenshots in the Cookbook or in Medium and they look so beautiful. The current UI is a huge step backwards. Chainlit is an incredible project that we all love. Please consider changing the UI back.