Skip to content
Discussion options

You must be logged in to vote

Hi Anmol, I don't think you can unfortunately, and it would mix up the concept of nodes and edges.

Would it be possible instead to

  • either update the state either the preceeding node (if you don't need the outcome of the random choice)
  • or in the destination node (in case the random choice impacts how you update the state)?

You won't have to write a new node as the existing nodes can update more than 1 piece of state (can add more than 1 key value pair in the return dict of the node).

def node_a(state):
    response = llm.invoke(state['messages']) 
    return {"messages": [response], "variable":"UPDATED"} #update state['variable'] in existing node

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@anmol-aidora
Comment options

Answer selected by anmol-aidora
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants