praisonaiagents 0.0.17__tar.gz → 0.0.18__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/PKG-INFO +1 -1
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/__init__.py +4 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/main.py +51 -6
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents.egg-info/PKG-INFO +1 -1
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/pyproject.toml +1 -1
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/agent/__init__.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/agent/agent.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/agents/__init__.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/agents/agents.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/__init__.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/agent/__init__.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/agent/agent.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/agents/__init__.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/agents/agents.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/main.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/task/__init__.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/task/task.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/process/__init__.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/process/process.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/task/__init__.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/task/task.py +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents.egg-info/SOURCES.txt +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents.egg-info/dependency_links.txt +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents.egg-info/requires.txt +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents.egg-info/top_level.txt +0 -0
- {praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/setup.cfg +0 -0
@@ -16,6 +16,8 @@ from .main import (
|
|
16
16
|
display_generating,
|
17
17
|
clean_triple_backticks,
|
18
18
|
error_logs,
|
19
|
+
register_display_callback,
|
20
|
+
display_callbacks,
|
19
21
|
)
|
20
22
|
|
21
23
|
__all__ = [
|
@@ -32,4 +34,6 @@ __all__ = [
|
|
32
34
|
'display_generating',
|
33
35
|
'clean_triple_backticks',
|
34
36
|
'error_logs',
|
37
|
+
'register_display_callback',
|
38
|
+
'display_callbacks',
|
35
39
|
]
|
@@ -25,6 +25,13 @@ logging.basicConfig(
|
|
25
25
|
# Global list to store error logs
|
26
26
|
error_logs = []
|
27
27
|
|
28
|
+
# Global callback registry
|
29
|
+
display_callbacks = {}
|
30
|
+
|
31
|
+
def register_display_callback(display_type: str, callback_fn):
|
32
|
+
"""Register a callback function for a specific display type."""
|
33
|
+
display_callbacks[display_type] = callback_fn
|
34
|
+
|
28
35
|
def _clean_display_content(content: str, max_length: int = 20000) -> str:
|
29
36
|
"""Helper function to clean and truncate content for display."""
|
30
37
|
if not content or not str(content).strip():
|
@@ -49,18 +56,28 @@ def display_interaction(message, response, markdown=True, generation_time=None,
|
|
49
56
|
"""Display the interaction between user and assistant."""
|
50
57
|
if console is None:
|
51
58
|
console = Console()
|
52
|
-
|
53
|
-
console.print(Text(f"Response generated in {generation_time:.1f}s", style="dim"))
|
54
|
-
|
59
|
+
|
55
60
|
# Handle multimodal content (list)
|
56
61
|
if isinstance(message, list):
|
57
|
-
# Extract just the text content from the multimodal message
|
58
62
|
text_content = next((item["text"] for item in message if item["type"] == "text"), "")
|
59
63
|
message = text_content
|
60
64
|
|
61
65
|
message = _clean_display_content(str(message))
|
62
66
|
response = _clean_display_content(str(response))
|
63
67
|
|
68
|
+
# Execute callback if registered
|
69
|
+
if 'interaction' in display_callbacks:
|
70
|
+
display_callbacks['interaction'](
|
71
|
+
message=message,
|
72
|
+
response=response,
|
73
|
+
markdown=markdown,
|
74
|
+
generation_time=generation_time
|
75
|
+
)
|
76
|
+
|
77
|
+
# Existing display logic...
|
78
|
+
if generation_time:
|
79
|
+
console.print(Text(f"Response generated in {generation_time:.1f}s", style="dim"))
|
80
|
+
|
64
81
|
if markdown:
|
65
82
|
console.print(Panel.fit(Markdown(message), title="Message", border_style="cyan"))
|
66
83
|
console.print(Panel.fit(Markdown(response), title="Response", border_style="cyan"))
|
@@ -74,6 +91,11 @@ def display_self_reflection(message: str, console=None):
|
|
74
91
|
if console is None:
|
75
92
|
console = Console()
|
76
93
|
message = _clean_display_content(str(message))
|
94
|
+
|
95
|
+
# Execute callback if registered
|
96
|
+
if 'self_reflection' in display_callbacks:
|
97
|
+
display_callbacks['self_reflection'](message=message)
|
98
|
+
|
77
99
|
console.print(Panel.fit(Text(message, style="bold yellow"), title="Self Reflection", border_style="magenta"))
|
78
100
|
|
79
101
|
def display_instruction(message: str, console=None):
|
@@ -82,6 +104,11 @@ def display_instruction(message: str, console=None):
|
|
82
104
|
if console is None:
|
83
105
|
console = Console()
|
84
106
|
message = _clean_display_content(str(message))
|
107
|
+
|
108
|
+
# Execute callback if registered
|
109
|
+
if 'instruction' in display_callbacks:
|
110
|
+
display_callbacks['instruction'](message=message)
|
111
|
+
|
85
112
|
console.print(Panel.fit(Text(message, style="bold blue"), title="Instruction", border_style="cyan"))
|
86
113
|
|
87
114
|
def display_tool_call(message: str, console=None):
|
@@ -90,6 +117,11 @@ def display_tool_call(message: str, console=None):
|
|
90
117
|
if console is None:
|
91
118
|
console = Console()
|
92
119
|
message = _clean_display_content(str(message))
|
120
|
+
|
121
|
+
# Execute callback if registered
|
122
|
+
if 'tool_call' in display_callbacks:
|
123
|
+
display_callbacks['tool_call'](message=message)
|
124
|
+
|
93
125
|
console.print(Panel.fit(Text(message, style="bold cyan"), title="Tool Call", border_style="green"))
|
94
126
|
|
95
127
|
def display_error(message: str, console=None):
|
@@ -98,19 +130,32 @@ def display_error(message: str, console=None):
|
|
98
130
|
if console is None:
|
99
131
|
console = Console()
|
100
132
|
message = _clean_display_content(str(message))
|
133
|
+
|
134
|
+
# Execute callback if registered
|
135
|
+
if 'error' in display_callbacks:
|
136
|
+
display_callbacks['error'](message=message)
|
137
|
+
|
101
138
|
console.print(Panel.fit(Text(message, style="bold red"), title="Error", border_style="red"))
|
102
|
-
# Store errors
|
103
139
|
error_logs.append(message)
|
104
140
|
|
105
141
|
def display_generating(content: str = "", start_time: Optional[float] = None):
|
106
142
|
if not content or not str(content).strip():
|
107
|
-
return Panel("", title="", border_style="green")
|
143
|
+
return Panel("", title="", border_style="green")
|
144
|
+
|
108
145
|
elapsed_str = ""
|
109
146
|
if start_time is not None:
|
110
147
|
elapsed = time.time() - start_time
|
111
148
|
elapsed_str = f" {elapsed:.1f}s"
|
112
149
|
|
113
150
|
content = _clean_display_content(str(content))
|
151
|
+
|
152
|
+
# Execute callback if registered
|
153
|
+
if 'generating' in display_callbacks:
|
154
|
+
display_callbacks['generating'](
|
155
|
+
content=content,
|
156
|
+
elapsed_time=elapsed_str.strip() if elapsed_str else None
|
157
|
+
)
|
158
|
+
|
114
159
|
return Panel(Markdown(content), title=f"Generating...{elapsed_str}", border_style="green")
|
115
160
|
|
116
161
|
def clean_triple_backticks(text: str) -> str:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents/build/lib/praisonaiagents/main.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{praisonaiagents-0.0.17 → praisonaiagents-0.0.18}/praisonaiagents.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|