Muthuraja18 commited on
Commit
9a2cbe6
·
verified ·
1 Parent(s): 985ed0a

Update agents/planner.py

Browse files
Files changed (1) hide show
  1. agents/planner.py +58 -26
agents/planner.py CHANGED
@@ -1,30 +1,62 @@
1
  class PlannerAgent:
 
 
 
2
 
3
- def plan(self, task: str):
4
- """
5
- Break complex requests into steps
6
- """
7
-
8
- task = task.lower()
9
-
10
- steps = []
11
-
12
- if "remove background" in task:
13
- steps.append("background")
14
-
15
- if "pdf" in task:
16
- steps.append("pdf")
17
 
18
- if "describe" in task:
19
- steps.append("analyze")
20
-
21
- if "edit" in task or "change" in task:
22
- steps.append("edit")
23
-
24
- if "generate" in task or "create" in task:
25
- steps.append("generate")
26
-
27
- if not steps:
28
- steps.append("generate")
29
 
30
- return steps
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  class PlannerAgent:
2
+ """
3
+ Creates an execution plan based on the routed task.
4
+ """
5
 
6
+ def __init__(self):
7
+ pass
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ def plan(self, task: str):
 
 
 
 
 
 
 
 
 
 
10
 
11
+ plans = {
12
+
13
+ # -----------------------------
14
+ # Upload / Analyze
15
+ # -----------------------------
16
+ "analyze": [
17
+ "load_image",
18
+ "analyze"
19
+ ],
20
+
21
+ # -----------------------------
22
+ # Edit Existing Image
23
+ # -----------------------------
24
+ "edit": [
25
+ "load_image",
26
+ "edit",
27
+ "save_image"
28
+ ],
29
+
30
+ # -----------------------------
31
+ # Generate New Image
32
+ # -----------------------------
33
+ "generate": [
34
+ "generate",
35
+ "save_image"
36
+ ],
37
+
38
+ # -----------------------------
39
+ # OCR
40
+ # -----------------------------
41
+ "ocr": [
42
+ "load_image",
43
+ "ocr"
44
+ ],
45
+
46
+ # -----------------------------
47
+ # PDF
48
+ # -----------------------------
49
+ "pdf": [
50
+ "load_image",
51
+ "pdf"
52
+ ],
53
+
54
+ # -----------------------------
55
+ # Chat
56
+ # -----------------------------
57
+ "chat": [
58
+ "chat"
59
+ ]
60
+ }
61
+
62
+ return plans.get(task, ["chat"])