i-dot-ai / redbox

Bringing Generative AI to the way the Civil Service works
https://i-dot-ai.github.io/redbox/
MIT License
93 stars 31 forks source link

Feature/graph refactor #918

Closed jamesrichards4 closed 2 months ago

jamesrichards4 commented 2 months ago

The graph structure is currently messy and confusing. By imposing rules and constraints we can tidy it up and make it easier to develop in future.

I'm a visual learner

redbox2

Changes proposed in this pull request

Guidance to review

Things to check

jamesrichards4 commented 2 months ago

Raising this to get thoughts on how well this ties in with what Will originally planned. This already seems way neater and more extensible. The visualisation is massively improved:

from IPython.display import Image, display
from langchain_core.runnables.graph import CurveStyle, MermaidDrawMethod, NodeStyles

display(
    Image(
        app = Redbox(env=Settings(_env_file="../.env")).graph.get_graph().draw_mermaid_png(
            draw_method=MermaidDrawMethod.API,
        )
    )
)

image

jamesrichards4 commented 2 months ago

@wpfl-dbt be great to get your thoughts on this, the redbox tests are failing for coverage but once I merge main I can remove some worker only code which should sort that so this is good to go (might need additional tests anyway but we can chat about that)