Spaces:
Sleeping
Sleeping
File size: 671 Bytes
bcfaa84 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
from langgraph.graph import Graph
from llm_node import llm_node
from formatter_node import formatter_node
def build_graph():
graph = Graph()
def llm_step(state):
question = state["question"]
result = llm_node().run(question)
state["llm_output"] = result
return state
def formatter_step(state):
cleaned = formatter_node(state["llm_output"])
state["final_answer"] = cleaned
return state
graph.add_node("llm", llm_step)
graph.add_node("formatter", formatter_step)
graph.set_entry_point("llm")
graph.add_edge("llm", "formatter")
graph.set_finish_point("formatter")
return graph
|