praisonaiagents 0.0.34__py3-none-any.whl → 0.0.36__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/agent/agent.py +5 -1
- praisonaiagents/process/process.py +26 -3
- praisonaiagents/tools/pandas_tools.py +3 -0
- praisonaiagents/tools/yfinance_tools.py +9 -1
- {praisonaiagents-0.0.34.dist-info → praisonaiagents-0.0.36.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.34.dist-info → praisonaiagents-0.0.36.dist-info}/RECORD +8 -8
- {praisonaiagents-0.0.34.dist-info → praisonaiagents-0.0.36.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.34.dist-info → praisonaiagents-0.0.36.dist-info}/top_level.txt +0 -0
praisonaiagents/agent/agent.py
CHANGED
@@ -762,4 +762,8 @@ Output MUST be JSON with 'reflection' and 'satisfactory'.
|
|
762
762
|
|
763
763
|
def run(self):
|
764
764
|
"""Alias for start() method"""
|
765
|
-
return self.start()
|
765
|
+
return self.start()
|
766
|
+
|
767
|
+
def start(self, prompt: str, **kwargs):
|
768
|
+
"""Start the agent with a prompt. This is a convenience method that wraps chat()."""
|
769
|
+
return self.chat(prompt, **kwargs)
|
@@ -10,14 +10,16 @@ class LoopItems(BaseModel):
|
|
10
10
|
items: List[Any]
|
11
11
|
|
12
12
|
class Process:
|
13
|
-
def __init__(self, tasks: Dict[str, Task], agents: List[Agent], manager_llm: Optional[str] = None, verbose: bool = False):
|
13
|
+
def __init__(self, tasks: Dict[str, Task], agents: List[Agent], manager_llm: Optional[str] = None, verbose: bool = False, max_iter: int = 10):
|
14
14
|
self.tasks = tasks
|
15
15
|
self.agents = agents
|
16
16
|
self.manager_llm = manager_llm
|
17
17
|
self.verbose = verbose
|
18
|
+
self.max_iter = max_iter
|
18
19
|
|
19
20
|
async def aworkflow(self) -> AsyncGenerator[str, None]:
|
20
21
|
"""Async version of workflow method"""
|
22
|
+
current_iter = 0 # Track how many times we've looped
|
21
23
|
# Build workflow relationships first
|
22
24
|
for task in self.tasks.values():
|
23
25
|
if task.next_tasks:
|
@@ -41,7 +43,12 @@ class Process:
|
|
41
43
|
visited_tasks = set()
|
42
44
|
loop_data = {} # Store loop-specific data
|
43
45
|
|
44
|
-
while current_task
|
46
|
+
while current_task:
|
47
|
+
current_iter += 1
|
48
|
+
if current_iter > self.max_iter:
|
49
|
+
logging.info(f"Max iteration limit {self.max_iter} reached, ending workflow.")
|
50
|
+
break
|
51
|
+
|
45
52
|
task_id = current_task.id
|
46
53
|
logging.info(f"Executing workflow task: {current_task.name if current_task.name else task_id}")
|
47
54
|
|
@@ -111,6 +118,11 @@ Return a JSON object with an 'items' array containing the items to process.
|
|
111
118
|
yield task_id
|
112
119
|
visited_tasks.add(task_id)
|
113
120
|
|
121
|
+
# Reset completed task to "not started" so it can run again
|
122
|
+
if self.tasks[task_id].status == "completed":
|
123
|
+
logging.debug(f"Task {task_id} was completed, resetting to 'not started' for next iteration.")
|
124
|
+
self.tasks[task_id].status = "not started"
|
125
|
+
|
114
126
|
# Handle loop progression
|
115
127
|
if current_task.task_type == "loop":
|
116
128
|
loop_key = f"loop_{current_task.name}"
|
@@ -291,6 +303,7 @@ Provide a JSON with the structure:
|
|
291
303
|
|
292
304
|
def workflow(self):
|
293
305
|
"""Synchronous version of workflow method"""
|
306
|
+
current_iter = 0 # Track how many times we've looped
|
294
307
|
# Build workflow relationships first
|
295
308
|
for task in self.tasks.values():
|
296
309
|
if task.next_tasks:
|
@@ -314,7 +327,12 @@ Provide a JSON with the structure:
|
|
314
327
|
visited_tasks = set()
|
315
328
|
loop_data = {} # Store loop-specific data
|
316
329
|
|
317
|
-
while current_task
|
330
|
+
while current_task:
|
331
|
+
current_iter += 1
|
332
|
+
if current_iter > self.max_iter:
|
333
|
+
logging.info(f"Max iteration limit {self.max_iter} reached, ending workflow.")
|
334
|
+
break
|
335
|
+
|
318
336
|
task_id = current_task.id
|
319
337
|
logging.info(f"Executing workflow task: {current_task.name if current_task.name else task_id}")
|
320
338
|
|
@@ -378,6 +396,11 @@ Return a JSON object with an 'items' array containing the items to process.
|
|
378
396
|
yield task_id
|
379
397
|
visited_tasks.add(task_id)
|
380
398
|
|
399
|
+
# Reset completed task to "not started" so it can run again
|
400
|
+
if self.tasks[task_id].status == "completed":
|
401
|
+
logging.debug(f"Task {task_id} was completed, resetting to 'not started' for next iteration.")
|
402
|
+
self.tasks[task_id].status = "not started"
|
403
|
+
|
381
404
|
# Handle loop progression
|
382
405
|
if current_task.task_type == "loop":
|
383
406
|
loop_key = f"loop_{current_task.name}"
|
@@ -160,6 +160,9 @@ class PandasTools:
|
|
160
160
|
Dict: Summary statistics and information
|
161
161
|
"""
|
162
162
|
try:
|
163
|
+
if not isinstance(df, pd.DataFrame):
|
164
|
+
raise TypeError(f"Expected pandas DataFrame, got {type(df).__name__}")
|
165
|
+
|
163
166
|
numeric_summary = df.describe().to_dict()
|
164
167
|
# Convert numpy types to native Python types
|
165
168
|
for col in numeric_summary:
|
@@ -145,7 +145,15 @@ class YFinanceTools:
|
|
145
145
|
return [{"error": "yfinance package not available"}]
|
146
146
|
|
147
147
|
hist = ticker.history(period=period, interval=interval, start=start, end=end)
|
148
|
-
|
148
|
+
data = hist.reset_index().to_dict('records')
|
149
|
+
|
150
|
+
# Convert timestamps to ISO format strings
|
151
|
+
for record in data:
|
152
|
+
if 'Date' in record and hasattr(record['Date'], 'isoformat'):
|
153
|
+
record['Date'] = record['Date'].isoformat()
|
154
|
+
if 'Datetime' in record and hasattr(record['Datetime'], 'isoformat'):
|
155
|
+
record['Datetime'] = record['Datetime'].isoformat()
|
156
|
+
return data
|
149
157
|
except Exception as e:
|
150
158
|
error_msg = f"Error fetching historical data: {str(e)}"
|
151
159
|
logging.error(error_msg)
|
@@ -1,13 +1,13 @@
|
|
1
1
|
praisonaiagents/__init__.py,sha256=Pm_HNlIsenf5zIstcVNk6nteJmOEnI4nB-zB-YL0Jgo,1160
|
2
2
|
praisonaiagents/main.py,sha256=uMBdwxjnJKHLPUzr_5vXlkuhCUO6EW5O8XC0M-h47sE,13915
|
3
3
|
praisonaiagents/agent/__init__.py,sha256=sKO8wGEXvtCrvV1e834r1Okv0XAqAxqZCqz6hKLiTvA,79
|
4
|
-
praisonaiagents/agent/agent.py,sha256=
|
4
|
+
praisonaiagents/agent/agent.py,sha256=CSULJNsm53Fh3LK-ZaAPuAcL3-7ca7aqFKYsNHAiTo8,34789
|
5
5
|
praisonaiagents/agents/__init__.py,sha256=_1d6Pqyk9EoBSo7E68sKyd1jDRlN1vxvVIRpoMc0Jcw,168
|
6
6
|
praisonaiagents/agents/agents.py,sha256=Os_k25-temlpzzncyElqbQI-e29nlcxqfJYy_ZUIprY,31004
|
7
7
|
praisonaiagents/agents/autoagents.py,sha256=bjC2O5oZmoJItJXIMPTWc2lsp_AJC9tMiTQOal2hwPA,13532
|
8
8
|
praisonaiagents/memory/memory.py,sha256=ZxqSpOUxk9jeTKGW0ZiTifC0uZtym-EZILP3kuOOKkU,35626
|
9
9
|
praisonaiagents/process/__init__.py,sha256=lkYbL7Hn5a0ldvJtkdH23vfIIZLIcanK-65C0MwaorY,52
|
10
|
-
praisonaiagents/process/process.py,sha256=
|
10
|
+
praisonaiagents/process/process.py,sha256=uSudOFI1ZlGM_nbT8qHD4iIP3y5Ygu8V-izLot2te70,26316
|
11
11
|
praisonaiagents/task/__init__.py,sha256=VL5hXVmyGjINb34AalxpBMl-YW9m5EDcRkMTKkSSl7c,80
|
12
12
|
praisonaiagents/task/task.py,sha256=mwmk98nesfz102qTnHSE5VuuPIgHiPDxjeEX7b7g2BA,10023
|
13
13
|
praisonaiagents/tools/__init__.py,sha256=-0lV5n5cG54vYW6REjXIfuJnCLKnfQIDlXsySCaPB9s,7347
|
@@ -20,7 +20,7 @@ praisonaiagents/tools/excel_tools.py,sha256=e2HqcwnyBueOyss0xEKxff3zB4w4sNWCOMXv
|
|
20
20
|
praisonaiagents/tools/file_tools.py,sha256=KRskI9q8up3sHaLQSaIGtvpl1brq419Up6YvB9QzSoI,8807
|
21
21
|
praisonaiagents/tools/json_tools.py,sha256=ApUYNuQ1qnbmYNCxSlx6Tth_H1yo8mhWtZ7Rr2WS6C4,16507
|
22
22
|
praisonaiagents/tools/newspaper_tools.py,sha256=NyhojNPeyULBGcAWGOT1X70qVkh3FgZrpH-S7PEmrwI,12667
|
23
|
-
praisonaiagents/tools/pandas_tools.py,sha256=
|
23
|
+
praisonaiagents/tools/pandas_tools.py,sha256=yzCeY4jetKrFIRA15Tr5OQ5d94T8DaSpzglx2UiWfPs,11092
|
24
24
|
praisonaiagents/tools/python_tools.py,sha256=ByBpESi5Vk2ivpihav9AQeqf95K_D4qqINYN1q-q0bA,13428
|
25
25
|
praisonaiagents/tools/shell_tools.py,sha256=P3fSrfOw71CGcrPwdPOA9Fr6Bgt_CAC71bUjCyvZCN8,9301
|
26
26
|
praisonaiagents/tools/spider_tools.py,sha256=lrZnT1V1BC46We-AzBrDB1Ryifr3KKGmYNntMsScU7w,15094
|
@@ -29,8 +29,8 @@ praisonaiagents/tools/tools.py,sha256=TK5njOmDSpMlyBnbeBzNSlnzXWlnNaTpVqkFPhkMAr
|
|
29
29
|
praisonaiagents/tools/wikipedia_tools.py,sha256=pGko-f33wqXgxJTv8db7TbizY5XnzBQRkNdq_GsplvI,9465
|
30
30
|
praisonaiagents/tools/xml_tools.py,sha256=iYTMBEk5l3L3ryQ1fkUnNVYK-Nnua2Kx2S0dxNMMs1A,17122
|
31
31
|
praisonaiagents/tools/yaml_tools.py,sha256=uogAZrhXV9O7xvspAtcTfpKSQYL2nlOTvCQXN94-G9A,14215
|
32
|
-
praisonaiagents/tools/yfinance_tools.py,sha256=
|
33
|
-
praisonaiagents-0.0.
|
34
|
-
praisonaiagents-0.0.
|
35
|
-
praisonaiagents-0.0.
|
36
|
-
praisonaiagents-0.0.
|
32
|
+
praisonaiagents/tools/yfinance_tools.py,sha256=s2PBj_1v7oQnOobo2fDbQBACEHl61ftG4beG6Z979ZE,8529
|
33
|
+
praisonaiagents-0.0.36.dist-info/METADATA,sha256=x6Ivo2TMN_tYww70m6DEMXtGwO3cmgc86B_SQMT0uO0,306
|
34
|
+
praisonaiagents-0.0.36.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
35
|
+
praisonaiagents-0.0.36.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
36
|
+
praisonaiagents-0.0.36.dist-info/RECORD,,
|
File without changes
|
File without changes
|