Skip to content

serial version of Send() ? #1741

Answered by robbiemu
robbiemu asked this question in Q&A
Discussion options

You must be logged in to vote

I see that my approach at first was lacking .. What I can do is instead of passing worker in as a node from the current graph, I can make the worker a separate graph, like:

class PreSchema(TypedDict):
    inp: str

class PostSchema(TypedDict):
    work: List[str]
    tasks: List[str]
    outp: str

class MesoSchema(TypedDict):
    via: List[ChatMessage]
    context: List[str]
    work: str

def input(state: PreSchema):
    return {"tasks": state["inp"].split(", ")}

def output(state: PostSchema):
    return {"outp": "-> ".join(state["work"])}

def worker(state: MesoSchema):
    curr = int(state["via"][-1].content)
    prev = int(state["context"][-1] if state["context"] else 0)
    return {"…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by robbiemu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant