cjber commited on
Commit
9a4ccc3
·
1 Parent(s): 8d63d9f

add documentation

Browse files
Files changed (2) hide show
  1. planning_ai/graph.py +14 -3
  2. planning_ai/main.py +2 -2
planning_ai/graph.py CHANGED
@@ -13,11 +13,22 @@ from planning_ai.states import OverallState
13
 
14
 
15
  def create_graph():
 
 
 
 
 
 
 
 
 
 
 
16
  graph = StateGraph(OverallState)
17
  graph.add_node("generate_summary", generate_summary)
18
  graph.add_node("check_hallucination", check_hallucination)
19
  graph.add_node("fix_hallucination", fix_hallucination)
20
- graph.add_node("generate_final_summary", generate_final_summary)
21
 
22
  graph.add_conditional_edges(
23
  START,
@@ -40,7 +51,7 @@ def create_graph():
40
  ["check_hallucination"],
41
  )
42
 
43
- graph.add_edge("check_hallucination", "generate_final_summary")
44
- graph.add_edge("generate_final_summary", END)
45
 
46
  return graph.compile()
 
13
 
14
 
15
  def create_graph():
16
+ """Creates and compiles a state graph for document processing.
17
+
18
+ This function sets up a state graph using the `StateGraph` class, defining nodes
19
+ and edges for processing documents. It includes nodes for generating summaries,
20
+ checking and fixing hallucinations, and generating a final summary. Conditional
21
+ edges are added to manage the flow of data between nodes based on the processing
22
+ state.
23
+
24
+ Returns:
25
+ StateGraph: The compiled state graph ready for execution.
26
+ """
27
  graph = StateGraph(OverallState)
28
  graph.add_node("generate_summary", generate_summary)
29
  graph.add_node("check_hallucination", check_hallucination)
30
  graph.add_node("fix_hallucination", fix_hallucination)
31
+ # graph.add_node("generate_final_summary", generate_final_summary)
32
 
33
  graph.add_conditional_edges(
34
  START,
 
51
  ["check_hallucination"],
52
  )
53
 
54
+ # graph.add_edge("check_hallucination", "generate_final_summary")
55
+ # graph.add_edge("generate_final_summary", END)
56
 
57
  return graph.compile()
planning_ai/main.py CHANGED
@@ -174,7 +174,7 @@ def build_quarto_doc(doc_title, out):
174
 
175
  def main():
176
  loader = DirectoryLoader(
177
- path=str(Paths.STAGING),
178
  show_progress=True,
179
  use_multithreading=True,
180
  loader_cls=TextLoader,
@@ -208,7 +208,7 @@ if __name__ == "__main__":
208
 
209
  tic = time.time()
210
  out = main()
211
- build_quarto_doc(doc_title, out)
212
  toc = time.time()
213
 
214
  print(f"Time taken: {(toc - tic) / 60:.2f} minutes.")
 
174
 
175
  def main():
176
  loader = DirectoryLoader(
177
+ path=str(Paths.STAGING / "pdfs"),
178
  show_progress=True,
179
  use_multithreading=True,
180
  loader_cls=TextLoader,
 
208
 
209
  tic = time.time()
210
  out = main()
211
+ # build_quarto_doc(doc_title, out)
212
  toc = time.time()
213
 
214
  print(f"Time taken: {(toc - tic) / 60:.2f} minutes.")