Umer797 commited on
Commit
f8734b3
·
verified ·
1 Parent(s): f06b73f

Update graph_builder.py

Browse files
Files changed (1) hide show
  1. graph_builder.py +9 -6
graph_builder.py CHANGED
@@ -1,19 +1,22 @@
1
- from langgraph.graph import Graph
2
  from llm_node import llm_node
3
  from formatter_node import formatter_node
4
 
 
 
 
5
  def build_graph():
6
- graph = Graph()
7
 
8
  def llm_step(state):
9
  question = state["question"]
10
- result = llm_node().run(question)
11
- state["llm_output"] = result
12
  return state
13
 
14
  def formatter_step(state):
15
- cleaned = formatter_node(state["llm_output"])
16
- state["final_answer"] = cleaned
17
  return state
18
 
19
  graph.add_node("llm", llm_step)
 
1
+ from langgraph.graph import StateGraph
2
  from llm_node import llm_node
3
  from formatter_node import formatter_node
4
 
5
+ class AgentState(dict):
6
+ pass
7
+
8
  def build_graph():
9
+ graph = StateGraph(AgentState)
10
 
11
  def llm_step(state):
12
  question = state["question"]
13
+ llm_output = llm_node(question)
14
+ state["llm_output"] = llm_output
15
  return state
16
 
17
  def formatter_step(state):
18
+ final_answer = formatter_node(state["llm_output"])
19
+ state["final_answer"] = final_answer
20
  return state
21
 
22
  graph.add_node("llm", llm_step)