praisonaiagents 0.0.29__py3-none-any.whl → 0.0.31__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -381,7 +381,7 @@ Your Goal: {self.goal}
381
381
  display_generating("", start_time),
382
382
  console=self.console,
383
383
  refresh_per_second=4,
384
- transient=False, # Changed to False to preserve output
384
+ transient=True, # Changed to False to preserve output
385
385
  vertical_overflow="ellipsis",
386
386
  auto_refresh=True
387
387
  ) as live:
@@ -466,7 +466,15 @@ Your Goal: {self.goal}
466
466
  display_text = next((item["text"] for item in prompt if item["type"] == "text"), "")
467
467
 
468
468
  if display_text and str(display_text).strip():
469
- display_instruction(f"Agent {self.name} is processing prompt: {display_text}", console=self.console)
469
+ # Pass agent information to display_instruction
470
+ agent_tools = [t.__name__ if hasattr(t, '__name__') else str(t) for t in self.tools]
471
+ display_instruction(
472
+ f"Agent {self.name} is processing prompt: {display_text}",
473
+ console=self.console,
474
+ agent_name=self.name,
475
+ agent_role=self.role,
476
+ agent_tools=agent_tools
477
+ )
470
478
 
471
479
  response = self._chat_completion(messages, temperature=temperature, tools=tools if tools else None)
472
480
  if not response:
@@ -525,7 +533,7 @@ Your Goal: {self.goal}
525
533
  self.chat_history.append({"role": "user", "content": original_prompt})
526
534
  self.chat_history.append({"role": "assistant", "content": response_text})
527
535
  if self.verbose:
528
- logging.info(f"Agent {self.name} final response: {response_text}")
536
+ logging.debug(f"Agent {self.name} final response: {response_text}")
529
537
  display_interaction(original_prompt, response_text, markdown=self.markdown, generation_time=time.time() - start_time, console=self.console)
530
538
  return response_text
531
539
 
@@ -630,6 +638,22 @@ Output MUST be JSON with 'reflection' and 'satisfactory'.
630
638
  item["text"] += "\nReturn ONLY a valid JSON object. No other text or explanation."
631
639
  break
632
640
 
641
+ # Display instruction with agent info if verbose
642
+ if self.verbose:
643
+ display_text = prompt
644
+ if isinstance(prompt, list):
645
+ display_text = next((item["text"] for item in prompt if item["type"] == "text"), "")
646
+
647
+ if display_text and str(display_text).strip():
648
+ agent_tools = [t.__name__ if hasattr(t, '__name__') else str(t) for t in self.tools]
649
+ await adisplay_instruction(
650
+ f"Agent {self.name} is processing prompt: {display_text}",
651
+ console=self.console,
652
+ agent_name=self.name,
653
+ agent_role=self.role,
654
+ agent_tools=agent_tools
655
+ )
656
+
633
657
  # Format tools if provided
634
658
  formatted_tools = []
635
659
  if tools:
praisonaiagents/main.py CHANGED
@@ -116,10 +116,10 @@ def display_interaction(message, response, markdown=True, generation_time=None,
116
116
  console.print(Text(f"Response generated in {generation_time:.1f}s", style="dim"))
117
117
 
118
118
  if markdown:
119
- console.print(Panel.fit(Markdown(message), title="Message", border_style="cyan"))
119
+ console.print(Panel.fit(Markdown(message), title="Task", border_style="cyan"))
120
120
  console.print(Panel.fit(Markdown(response), title="Response", border_style="cyan"))
121
121
  else:
122
- console.print(Panel.fit(Text(message, style="bold green"), title="Message", border_style="cyan"))
122
+ console.print(Panel.fit(Text(message, style="bold green"), title="Task", border_style="cyan"))
123
123
  console.print(Panel.fit(Text(response, style="bold blue"), title="Response", border_style="cyan"))
124
124
 
125
125
  def display_self_reflection(message: str, console=None):
@@ -135,7 +135,7 @@ def display_self_reflection(message: str, console=None):
135
135
 
136
136
  console.print(Panel.fit(Text(message, style="bold yellow"), title="Self Reflection", border_style="magenta"))
137
137
 
138
- def display_instruction(message: str, console=None):
138
+ def display_instruction(message: str, console=None, agent_name: str = None, agent_role: str = None, agent_tools: List[str] = None):
139
139
  if not message or not message.strip():
140
140
  return
141
141
  if console is None:
@@ -146,7 +146,19 @@ def display_instruction(message: str, console=None):
146
146
  if 'instruction' in sync_display_callbacks:
147
147
  sync_display_callbacks['instruction'](message=message)
148
148
 
149
- console.print(Panel.fit(Text(message, style="bold blue"), title="Instruction", border_style="cyan"))
149
+ # Display agent info if available
150
+ if agent_name:
151
+ agent_info = f"[bold #FF9B9B]👤 Agent:[/] [#FFE5E5]{agent_name}[/]"
152
+ if agent_role:
153
+ agent_info += f"\n[bold #B4B4B3]Role:[/] [#FFE5E5]{agent_role}[/]"
154
+ if agent_tools:
155
+ tools_str = ", ".join(f"[italic #B4D4FF]{tool}[/]" for tool in agent_tools)
156
+ agent_info += f"\n[bold #86A789]Tools:[/] {tools_str}"
157
+ console.print(Panel(agent_info, border_style="#D2E3C8", title="[bold]Agent Info[/]", title_align="left", padding=(1, 2)))
158
+
159
+ # Only print if log level is DEBUG
160
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
161
+ console.print(Panel.fit(Text(message, style="bold blue"), title="Instruction", border_style="cyan"))
150
162
 
151
163
  def display_tool_call(message: str, console=None):
152
164
  if not message or not message.strip():
@@ -222,10 +234,10 @@ async def adisplay_interaction(message, response, markdown=True, generation_time
222
234
  console.print(Text(f"Response generated in {generation_time:.1f}s", style="dim"))
223
235
 
224
236
  if markdown:
225
- console.print(Panel.fit(Markdown(message), title="Message", border_style="cyan"))
237
+ console.print(Panel.fit(Markdown(message), title="Task", border_style="cyan"))
226
238
  console.print(Panel.fit(Markdown(response), title="Response", border_style="cyan"))
227
239
  else:
228
- console.print(Panel.fit(Text(message, style="bold green"), title="Message", border_style="cyan"))
240
+ console.print(Panel.fit(Text(message, style="bold green"), title="Task", border_style="cyan"))
229
241
  console.print(Panel.fit(Text(response, style="bold blue"), title="Response", border_style="cyan"))
230
242
 
231
243
  async def adisplay_self_reflection(message: str, console=None):
@@ -241,7 +253,7 @@ async def adisplay_self_reflection(message: str, console=None):
241
253
 
242
254
  console.print(Panel.fit(Text(message, style="bold yellow"), title="Self Reflection", border_style="magenta"))
243
255
 
244
- async def adisplay_instruction(message: str, console=None):
256
+ async def adisplay_instruction(message: str, console=None, agent_name: str = None, agent_role: str = None, agent_tools: List[str] = None):
245
257
  """Async version of display_instruction."""
246
258
  if not message or not message.strip():
247
259
  return
@@ -252,7 +264,19 @@ async def adisplay_instruction(message: str, console=None):
252
264
  if 'instruction' in async_display_callbacks:
253
265
  await async_display_callbacks['instruction'](message=message)
254
266
 
255
- console.print(Panel.fit(Text(message, style="bold blue"), title="Instruction", border_style="cyan"))
267
+ # Display agent info if available
268
+ if agent_name:
269
+ agent_info = f"[bold #FF9B9B]👤 Agent:[/] [#FFE5E5]{agent_name}[/]"
270
+ if agent_role:
271
+ agent_info += f"\n[bold #B4B4B3]Role:[/] [#FFE5E5]{agent_role}[/]"
272
+ if agent_tools:
273
+ tools_str = ", ".join(f"[italic #B4D4FF]{tool}[/]" for tool in agent_tools)
274
+ agent_info += f"\n[bold #86A789]Tools:[/] {tools_str}"
275
+ console.print(Panel(agent_info, border_style="#D2E3C8", title="[bold]Agent Info[/]", title_align="left", padding=(1, 2)))
276
+
277
+ # Only print if log level is DEBUG
278
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
279
+ console.print(Panel.fit(Text(message, style="bold blue"), title="Instruction", border_style="cyan"))
256
280
 
257
281
  async def adisplay_tool_call(message: str, console=None):
258
282
  """Async version of display_tool_call."""
@@ -79,12 +79,15 @@ class Memory:
79
79
  self.use_mem0 = (self.provider.lower() == "mem0") and MEM0_AVAILABLE
80
80
  self.use_rag = (self.provider.lower() == "rag") and CHROMADB_AVAILABLE and self.cfg.get("use_embedding", False)
81
81
 
82
+ # Create .praison directory if it doesn't exist
83
+ os.makedirs(".praison", exist_ok=True)
84
+
82
85
  # Short-term DB
83
- self.short_db = self.cfg.get("short_db", "short_term.db")
86
+ self.short_db = self.cfg.get("short_db", ".praison/short_term.db")
84
87
  self._init_stm()
85
88
 
86
89
  # Long-term DB
87
- self.long_db = self.cfg.get("long_db", "long_term.db")
90
+ self.long_db = self.cfg.get("long_db", ".praison/long_term.db")
88
91
  self._init_ltm()
89
92
 
90
93
  # Conditionally init Mem0 or local RAG
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: praisonaiagents
3
- Version: 0.0.29
3
+ Version: 0.0.31
4
4
  Summary: Praison AI agents for completing complex tasks with Self Reflection Agents
5
5
  Author: Mervin Praison
6
6
  Requires-Dist: pydantic
@@ -1,11 +1,11 @@
1
1
  praisonaiagents/__init__.py,sha256=Pm_HNlIsenf5zIstcVNk6nteJmOEnI4nB-zB-YL0Jgo,1160
2
- praisonaiagents/main.py,sha256=7Phfe0gdxHzbhPb3WRzBTfq9CaLq0K31M5DM_4oCiCQ,12451
2
+ praisonaiagents/main.py,sha256=uMBdwxjnJKHLPUzr_5vXlkuhCUO6EW5O8XC0M-h47sE,13915
3
3
  praisonaiagents/agent/__init__.py,sha256=sKO8wGEXvtCrvV1e834r1Okv0XAqAxqZCqz6hKLiTvA,79
4
- praisonaiagents/agent/agent.py,sha256=r4Bfe_R5CZlPEKt6DQqgFa9EGuaaMTr9suiiy_qbsnc,33361
4
+ praisonaiagents/agent/agent.py,sha256=DDyA8JlHkKoKliWlBC3iNccR2q5rdYljbwogAi1vaUY,34581
5
5
  praisonaiagents/agents/__init__.py,sha256=_1d6Pqyk9EoBSo7E68sKyd1jDRlN1vxvVIRpoMc0Jcw,168
6
6
  praisonaiagents/agents/agents.py,sha256=N55Ae3JkjNgGQ6pXBaBpI73sA80Y-pPUZLOd1NgtiWU,29523
7
7
  praisonaiagents/agents/autoagents.py,sha256=bjC2O5oZmoJItJXIMPTWc2lsp_AJC9tMiTQOal2hwPA,13532
8
- praisonaiagents/memory/memory.py,sha256=pKQT2tKQpSeStZvW8BT83ree-hqJBvm-tGUwCwOsjDI,35504
8
+ praisonaiagents/memory/memory.py,sha256=ZxqSpOUxk9jeTKGW0ZiTifC0uZtym-EZILP3kuOOKkU,35626
9
9
  praisonaiagents/process/__init__.py,sha256=lkYbL7Hn5a0ldvJtkdH23vfIIZLIcanK-65C0MwaorY,52
10
10
  praisonaiagents/process/process.py,sha256=4qXdrCDQPH5MtvHvdJVURXKNgSl6ae3OYTiqAF_A2ZU,24295
11
11
  praisonaiagents/task/__init__.py,sha256=VL5hXVmyGjINb34AalxpBMl-YW9m5EDcRkMTKkSSl7c,80
@@ -30,7 +30,7 @@ praisonaiagents/tools/wikipedia_tools.py,sha256=pGko-f33wqXgxJTv8db7TbizY5XnzBQR
30
30
  praisonaiagents/tools/xml_tools.py,sha256=iYTMBEk5l3L3ryQ1fkUnNVYK-Nnua2Kx2S0dxNMMs1A,17122
31
31
  praisonaiagents/tools/yaml_tools.py,sha256=uogAZrhXV9O7xvspAtcTfpKSQYL2nlOTvCQXN94-G9A,14215
32
32
  praisonaiagents/tools/yfinance_tools.py,sha256=nmzjS7G_5GqMQD4r867mt17dHg5xvtsYDDfOPh68SgE,8105
33
- praisonaiagents-0.0.29.dist-info/METADATA,sha256=HUWedStiXMzTbrkdz61JBYXN5x8K7xRRA1q6C2LLhlU,306
34
- praisonaiagents-0.0.29.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
- praisonaiagents-0.0.29.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
36
- praisonaiagents-0.0.29.dist-info/RECORD,,
33
+ praisonaiagents-0.0.31.dist-info/METADATA,sha256=NRAZ9s36jGyIjg0HXKjwVh3_GYmCAERoDtuYH5H2SK0,306
34
+ praisonaiagents-0.0.31.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
+ praisonaiagents-0.0.31.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
36
+ praisonaiagents-0.0.31.dist-info/RECORD,,