rr19tech commited on
Commit
eabbc65
·
verified ·
1 Parent(s): 825fdb9
Files changed (1) hide show
  1. Lang_Graph.html +19 -0
Lang_Graph.html CHANGED
@@ -164,6 +164,25 @@
164
  workflow.add_edge(START, "Node_B")
165
  </pre>
166
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  <h3>Detailed article coming soon ..</h3>
168
 
169
  <!--
 
164
  workflow.add_edge(START, "Node_B")
165
  </pre>
166
  </p>
167
+ <p>
168
+ Now, apart from nodes being python functions, we can add variety of things like LCEL (Lang Chain Expression Language), sub graphs etc.
169
+ Consider the following:
170
+ <pre>
171
+ ..
172
+ model = ChatOpenAI(model="..")
173
+ prompt = ChatPromptTemplate.from_template("Summarize this text in one sentence: {input_text}")
174
+ lcel_chain = prompt | model | (lambda msg: {"summary": msg.content})
175
+ we can pass this as a node to a lang graph.
176
+ workflow.add_node("summarizer_node", lcel_chain)
177
+ </pre>
178
+ Or sometimes, we may need a placeholder node, something like below
179
+ <pre>
180
+ def DUMMY(state: State):
181
+ pass
182
+ workflow.add_node(DUMMY)
183
+ </pre>
184
+ You may also try to pass another workflow graph as subgraph.
185
+ </p>
186
  <h3>Detailed article coming soon ..</h3>
187
 
188
  <!--