Open paullen opened 1 month ago
Update: After I explicitly pass the path_map
argument to the the add_conditional_edges
function, I get the correct visual.
This reduces my usability of the Studio since I have to edit all of my old code to add path maps and update each path_map everytime I add new nodes to my graph
@paullen unfortunately I don't think there's a great way to fix this... how would you determine this programatically without the manual path map?
@hwchase17 You're right. My pain point was more with the user flow rather than the actual syntax. The studio showed me an incorrect graph without warnings, when I could've taken steps to resolve it, had I known. Here's a couple of things that can help users:
I would personally go for the second option. What do you think?
yes thats a good callout! i think that makes sense. thanks for the suggestion
Hello @paullen!
Alternatively, you can change the return type of the conditional edge functions to denote which target edges can be returned by the function.
from typing import Literal
def choose_code_checker_next(state: State) -> Literal["END", "CODE_CHECKER"]:
last_message = state["messages"][-1]
last_message_json = json.loads(last_message.content)
if last_message_json[CORRECT] == "true":
return "END"
return "CODE_CHECKER"
@dqbd Thanks! However I'm using literals for my node names and can't seem to find a way to convert them to str. Going with the path maps strategy.
@dqbd Thanks! However I'm using literals for my node names and can't seem to find a way to convert them to str. Going with the path maps strategy.
could you elaborate on this, not sure i understand, but would love to figure out how to support
Here is my graph code:
This is the graph I'm being shown in the Studio:
Issues