rr19tech commited on
Commit
f8c2ae8
·
verified ·
1 Parent(s): 7a0ddfd

Updated some more content

Browse files
Files changed (1) hide show
  1. Lang_Graph.html +26 -1
Lang_Graph.html CHANGED
@@ -138,7 +138,32 @@
138
 
139
  </p>
140
 
141
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  <h3>Detailed article coming soon ..</h3>
143
 
144
  <!--
 
138
 
139
  </p>
140
 
141
+ <p>
142
+ Going little further into the topic. Use an annotated list to preserve the history
143
+ <pre>
144
+ class State(TypedDict):
145
+ value: str
146
+ history: Annotated[list[str], operator.add]
147
+
148
+ def First_Node(state: State):
149
+ print("I am from first Node")
150
+ return {"value": "First Node done", "history": ["First Node Activated"]}
151
+
152
+ def Second_Node(state: State):
153
+ print("I am from Second Node")
154
+ return {"value": "Second Node done", "history": ["Second Node Activated"]}
155
+
156
+ ...
157
+ final_response = graph.invoke({"value": [], "history": ["User initiated session"]})
158
+ </pre>
159
+ You would see an output like this. <br>
160
+ the final value is : {'value': 'Second Node done', 'history': ['User initiated session', 'First Node Activated', 'Second Node Activated']}
161
+ Try running the nodes in parallel by trying something like this.<br>
162
+ <pre>
163
+ workflow.add_edge(START, "Node_A")
164
+ workflow.add_edge(START, "Node_B")
165
+ </pre>
166
+ </p>
167
  <h3>Detailed article coming soon ..</h3>
168
 
169
  <!--