-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_graph_locally.py
44 lines (35 loc) · 1.16 KB
/
run_graph_locally.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""This script is for analyzing a single repository without using Airflow.
Change the clone_url to the repository you want to analyze."""
import os
from app.agents.main_graph import main_graph
from app.utils.get_repo_info import get_repo_info
from app.step_list import STEP_LIST
CLONE_URL = "https://github.com/minki-j/AI_README_Generator.git"
current_dir = os.getcwd()
repo_info = get_repo_info(clone_url=CLONE_URL, cache_dir=f"{current_dir}/cache")
config = {"configurable": {"thread_id": "3"}, "recursion_limit": 100}
result = main_graph.invoke(
{
**repo_info,
"step_question": STEP_LIST[0],
"current_step": 1,
"total_number_of_steps": len(STEP_LIST),
"previous_step": 0,
},
config,
)
for i in range(len(STEP_LIST) - 1):
print(f"--------{i+1}---------")
user_feedback = input("Enter a feedback:")
main_graph.update_state(
config,
{
"user_feedback": user_feedback,
"current_step": i + 2,
"step_question": STEP_LIST[i + 1],
},
as_node="human_in_the_loop",
)
result = main_graph.invoke(None, config)
print("-----------------")
print(result)