Join Medium for free to get updates from this writer.
Press enter or click to view image in full size
from typing_extensions import TypedDict from typing import Literal from langgraph.graph import START, END, StateGraph import random from IPython.display import display, Image
class State(TypedDict): graph_info: str
def start_play(state: State): return { "graph_info": state["graph_info"] + " I am planning to play Game :" }
def cricket(state: State): return { "graph_info": state["graph_info"] + " cricket and Cricket is my fav game" }
def badminton(state: State): return { "graph_info": state["graph_info"] + " badminton and badminton is my fav game" }
response=graph_builder.invoke({"graph_info":"hey my name is Reema"}) print(response)
from tkinter import Image
from IPython.display import display,Image from typing_extensions import TypedDict import random from typing import Literal from langgraph.graph import START,END,StateGraph
class State(TypedDict): info:str
def random_play(state:State)->Literal["veg","nonveg"]: info=state["info"] if random.random()>0.5: return "veg" else: return "nonveg"
def start_play(state:State): return {"info":state["info"] + "i want to eat"}
graph_builder.invoke({"info":"Hi I am Reema and "})
from tkinter import Image
from IPython.display import display,Image from typing_extensions import TypedDict import random from typing import Literal from langgraph.graph import START,END,StateGraph
class State(TypedDict): info:str
def random_play(state:State)->Literal["veg","nonveg"]: info=state["info"] if random.random()>0.5: return "veg" else: return "nonveg"
def start_play(state:State): return {"info":state["info"] + "i want to eat"}