praisonaiagents 0.0.30__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.
- praisonaiagents/agent/agent.py +27 -3
- praisonaiagents/main.py +32 -8
- {praisonaiagents-0.0.30.dist-info → praisonaiagents-0.0.31.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.30.dist-info → praisonaiagents-0.0.31.dist-info}/RECORD +6 -6
- {praisonaiagents-0.0.30.dist-info → praisonaiagents-0.0.31.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.30.dist-info → praisonaiagents-0.0.31.dist-info}/top_level.txt +0 -0
praisonaiagents/agent/agent.py
CHANGED
@@ -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=
|
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
|
-
|
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.
|
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="
|
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="
|
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
|
-
|
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="
|
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="
|
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
|
-
|
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."""
|
@@ -1,7 +1,7 @@
|
|
1
1
|
praisonaiagents/__init__.py,sha256=Pm_HNlIsenf5zIstcVNk6nteJmOEnI4nB-zB-YL0Jgo,1160
|
2
|
-
praisonaiagents/main.py,sha256=
|
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=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
|
@@ -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.
|
34
|
-
praisonaiagents-0.0.
|
35
|
-
praisonaiagents-0.0.
|
36
|
-
praisonaiagents-0.0.
|
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,,
|
File without changes
|
File without changes
|