praisonaiagents 0.0.88__py3-none-any.whl → 0.0.89__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- praisonaiagents/process/process.py +42 -38
- praisonaiagents/task/task.py +3 -1
- {praisonaiagents-0.0.88.dist-info → praisonaiagents-0.0.89.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.88.dist-info → praisonaiagents-0.0.89.dist-info}/RECORD +6 -6
- {praisonaiagents-0.0.88.dist-info → praisonaiagents-0.0.89.dist-info}/WHEEL +1 -1
- {praisonaiagents-0.0.88.dist-info → praisonaiagents-0.0.89.dist-info}/top_level.txt +0 -0
@@ -30,6 +30,44 @@ class Process:
|
|
30
30
|
self.task_retry_counter: Dict[str, int] = {} # Initialize retry counter
|
31
31
|
self.workflow_finished = False # ADDED: Workflow finished flag
|
32
32
|
|
33
|
+
def _build_task_context(self, current_task: Task) -> str:
|
34
|
+
"""Build context for a task based on its retain_full_context setting"""
|
35
|
+
if not (current_task.previous_tasks or current_task.context):
|
36
|
+
return ""
|
37
|
+
|
38
|
+
context = "\nInput data from previous tasks:"
|
39
|
+
|
40
|
+
if current_task.retain_full_context:
|
41
|
+
# Original behavior: include all previous tasks
|
42
|
+
for prev_name in current_task.previous_tasks:
|
43
|
+
prev_task = next((t for t in self.tasks.values() if t.name == prev_name), None)
|
44
|
+
if prev_task and prev_task.result:
|
45
|
+
context += f"\n{prev_name}: {prev_task.result.raw}"
|
46
|
+
|
47
|
+
# Add data from context tasks
|
48
|
+
if current_task.context:
|
49
|
+
for ctx_task in current_task.context:
|
50
|
+
if ctx_task.result and ctx_task.name != current_task.name:
|
51
|
+
context += f"\n{ctx_task.name}: {ctx_task.result.raw}"
|
52
|
+
else:
|
53
|
+
# New behavior: only include the most recent previous task
|
54
|
+
if current_task.previous_tasks:
|
55
|
+
# Get the most recent previous task (last in the list)
|
56
|
+
prev_name = current_task.previous_tasks[-1]
|
57
|
+
prev_task = next((t for t in self.tasks.values() if t.name == prev_name), None)
|
58
|
+
if prev_task and prev_task.result:
|
59
|
+
context += f"\n{prev_name}: {prev_task.result.raw}"
|
60
|
+
|
61
|
+
# For context tasks, still include the most recent one
|
62
|
+
if current_task.context:
|
63
|
+
# Get the most recent context task with a result
|
64
|
+
for ctx_task in reversed(current_task.context):
|
65
|
+
if ctx_task.result and ctx_task.name != current_task.name:
|
66
|
+
context += f"\n{ctx_task.name}: {ctx_task.result.raw}"
|
67
|
+
break # Only include the most recent one
|
68
|
+
|
69
|
+
return context
|
70
|
+
|
33
71
|
def _find_next_not_started_task(self) -> Optional[Task]:
|
34
72
|
"""Fallback mechanism to find the next 'not started' task."""
|
35
73
|
fallback_attempts = 0
|
@@ -147,25 +185,8 @@ Description length: {len(current_task.description)}
|
|
147
185
|
""")
|
148
186
|
|
149
187
|
# Add context from previous tasks to description
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
# Add data from previous tasks in workflow
|
154
|
-
for prev_name in current_task.previous_tasks:
|
155
|
-
prev_task = next((t for t in self.tasks.values() if t.name == prev_name), None)
|
156
|
-
if prev_task and prev_task.result:
|
157
|
-
# Handle loop data
|
158
|
-
if current_task.task_type == "loop":
|
159
|
-
context += f"\n{prev_name}: {prev_task.result.raw}"
|
160
|
-
else:
|
161
|
-
context += f"\n{prev_name}: {prev_task.result.raw}"
|
162
|
-
|
163
|
-
# Add data from context tasks
|
164
|
-
if current_task.context:
|
165
|
-
for ctx_task in current_task.context:
|
166
|
-
if ctx_task.result and ctx_task.name != current_task.name:
|
167
|
-
context += f"\n{ctx_task.name}: {ctx_task.result.raw}"
|
168
|
-
|
188
|
+
context = self._build_task_context(current_task)
|
189
|
+
if context:
|
169
190
|
# Update task description with context
|
170
191
|
current_task.description = current_task.description + context
|
171
192
|
|
@@ -778,25 +799,8 @@ Description length: {len(current_task.description)}
|
|
778
799
|
""")
|
779
800
|
|
780
801
|
# Add context from previous tasks to description
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
# Add data from previous tasks in workflow
|
785
|
-
for prev_name in current_task.previous_tasks:
|
786
|
-
prev_task = next((t for t in self.tasks.values() if t.name == prev_name), None)
|
787
|
-
if prev_task and prev_task.result:
|
788
|
-
# Handle loop data
|
789
|
-
if current_task.task_type == "loop":
|
790
|
-
context += f"\n{prev_name}: {prev_task.result.raw}"
|
791
|
-
else:
|
792
|
-
context += f"\n{prev_name}: {prev_task.result.raw}"
|
793
|
-
|
794
|
-
# Add data from context tasks
|
795
|
-
if current_task.context:
|
796
|
-
for ctx_task in current_task.context:
|
797
|
-
if ctx_task.result and ctx_task.name != current_task.name:
|
798
|
-
context += f"\n{ctx_task.name}: {ctx_task.result.raw}"
|
799
|
-
|
802
|
+
context = self._build_task_context(current_task)
|
803
|
+
if context:
|
800
804
|
# Update task description with context
|
801
805
|
current_task.description = current_task.description + context
|
802
806
|
|
praisonaiagents/task/task.py
CHANGED
@@ -39,7 +39,8 @@ class Task:
|
|
39
39
|
memory=None,
|
40
40
|
quality_check=True,
|
41
41
|
input_file: Optional[str] = None,
|
42
|
-
rerun: bool = False # Renamed from can_rerun and logic inverted, default True for backward compatibility
|
42
|
+
rerun: bool = False, # Renamed from can_rerun and logic inverted, default True for backward compatibility
|
43
|
+
retain_full_context: bool = False # By default, only use previous task output, not all previous tasks
|
43
44
|
):
|
44
45
|
# Add check if memory config is provided
|
45
46
|
if memory is not None or (config and config.get('memory_config')):
|
@@ -78,6 +79,7 @@ class Task:
|
|
78
79
|
self.memory = memory
|
79
80
|
self.quality_check = quality_check
|
80
81
|
self.rerun = rerun # Assigning the rerun parameter
|
82
|
+
self.retain_full_context = retain_full_context
|
81
83
|
|
82
84
|
# Set logger level based on config verbose level
|
83
85
|
verbose = self.config.get("verbose", 0)
|
@@ -16,9 +16,9 @@ praisonaiagents/mcp/mcp.py,sha256=-U6md6zHoJZCWF8XFq921Yy5CcSNaGqvjg3aRT737LM,16
|
|
16
16
|
praisonaiagents/mcp/mcp_sse.py,sha256=DLh3F_aoVRM1X-7hgIOWOw4FQ1nGmn9YNbQTesykzn4,6792
|
17
17
|
praisonaiagents/memory/memory.py,sha256=I8dOTkrl1i-GgQbDcrFOsSruzJ7MiI6Ys37DK27wrUs,35537
|
18
18
|
praisonaiagents/process/__init__.py,sha256=lkYbL7Hn5a0ldvJtkdH23vfIIZLIcanK-65C0MwaorY,52
|
19
|
-
praisonaiagents/process/process.py,sha256=
|
19
|
+
praisonaiagents/process/process.py,sha256=xFfzXzk7g9ZR2917LVGGpOk0oH9DyK8lsNd9OjOwwQc,60107
|
20
20
|
praisonaiagents/task/__init__.py,sha256=VL5hXVmyGjINb34AalxpBMl-YW9m5EDcRkMTKkSSl7c,80
|
21
|
-
praisonaiagents/task/task.py,sha256=
|
21
|
+
praisonaiagents/task/task.py,sha256=Hp9iqPXKYSNTN-BD3l3SuFNWq6eCyRVCuNFcQGOOmQQ,14425
|
22
22
|
praisonaiagents/tools/__init__.py,sha256=CWOYV9SudYY82r45LnNgaVRV3cmsAFdasNRkPrLsgmI,9198
|
23
23
|
praisonaiagents/tools/arxiv_tools.py,sha256=1stb31zTjLTon4jCnpZG5de9rKc9QWgC0leLegvPXWo,10528
|
24
24
|
praisonaiagents/tools/calculator_tools.py,sha256=S1xPT74Geurvjm52QMMIG29zDXVEWJmM6nmyY7yF298,9571
|
@@ -40,7 +40,7 @@ praisonaiagents/tools/xml_tools.py,sha256=iYTMBEk5l3L3ryQ1fkUnNVYK-Nnua2Kx2S0dxN
|
|
40
40
|
praisonaiagents/tools/yaml_tools.py,sha256=uogAZrhXV9O7xvspAtcTfpKSQYL2nlOTvCQXN94-G9A,14215
|
41
41
|
praisonaiagents/tools/yfinance_tools.py,sha256=s2PBj_1v7oQnOobo2fDbQBACEHl61ftG4beG6Z979ZE,8529
|
42
42
|
praisonaiagents/tools/train/data/generatecot.py,sha256=H6bNh-E2hqL5MW6kX3hqZ05g9ETKN2-kudSjiuU_SD8,19403
|
43
|
-
praisonaiagents-0.0.
|
44
|
-
praisonaiagents-0.0.
|
45
|
-
praisonaiagents-0.0.
|
46
|
-
praisonaiagents-0.0.
|
43
|
+
praisonaiagents-0.0.89.dist-info/METADATA,sha256=D-a3bWvBIuJ85Ox-RQidxDQo8vt4BCUV_taebGYmnAo,1244
|
44
|
+
praisonaiagents-0.0.89.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
45
|
+
praisonaiagents-0.0.89.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
46
|
+
praisonaiagents-0.0.89.dist-info/RECORD,,
|
File without changes
|