praisonaiagents 0.0.8__tar.gz → 0.0.10__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/PKG-INFO +1 -1
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/agent/agent.py +43 -12
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/agents/agents.py +2 -2
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents.egg-info/PKG-INFO +1 -1
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/pyproject.toml +1 -1
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/__init__.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/agent/__init__.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/agents/__init__.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/build/lib/praisonaiagents/__init__.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/build/lib/praisonaiagents/agent/__init__.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/build/lib/praisonaiagents/agent/agent.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/build/lib/praisonaiagents/agents/__init__.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/build/lib/praisonaiagents/agents/agents.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/build/lib/praisonaiagents/main.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/build/lib/praisonaiagents/task/__init__.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/build/lib/praisonaiagents/task/task.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/main.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/task/__init__.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents/task/task.py +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents.egg-info/SOURCES.txt +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents.egg-info/dependency_links.txt +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents.egg-info/requires.txt +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents.egg-info/top_level.txt +0 -0
- {praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/setup.cfg +0 -0
@@ -21,27 +21,49 @@ class Agent:
|
|
21
21
|
"""
|
22
22
|
Generate a tool definition from a function name by inspecting the function.
|
23
23
|
"""
|
24
|
+
logging.debug(f"Attempting to generate tool definition for: {function_name}")
|
25
|
+
|
24
26
|
# First try to get the tool definition if it exists
|
25
27
|
tool_def_name = f"{function_name}_definition"
|
26
28
|
tool_def = globals().get(tool_def_name)
|
29
|
+
logging.debug(f"Looking for {tool_def_name} in globals: {tool_def is not None}")
|
30
|
+
|
27
31
|
if not tool_def:
|
28
32
|
import __main__
|
29
33
|
tool_def = getattr(__main__, tool_def_name, None)
|
34
|
+
logging.debug(f"Looking for {tool_def_name} in __main__: {tool_def is not None}")
|
30
35
|
|
31
36
|
if tool_def:
|
37
|
+
logging.debug(f"Found tool definition: {tool_def}")
|
32
38
|
return tool_def
|
33
39
|
|
34
|
-
#
|
35
|
-
func =
|
40
|
+
# Try to find the function in the agent's tools list first
|
41
|
+
func = None
|
42
|
+
for tool in self.tools:
|
43
|
+
if callable(tool) and getattr(tool, '__name__', '') == function_name:
|
44
|
+
func = tool
|
45
|
+
break
|
46
|
+
|
47
|
+
logging.debug(f"Looking for {function_name} in agent tools: {func is not None}")
|
48
|
+
|
49
|
+
# If not found in tools, try globals and main
|
36
50
|
if not func:
|
37
|
-
|
38
|
-
func
|
51
|
+
func = globals().get(function_name)
|
52
|
+
logging.debug(f"Looking for {function_name} in globals: {func is not None}")
|
53
|
+
|
54
|
+
if not func:
|
55
|
+
import __main__
|
56
|
+
func = getattr(__main__, function_name, None)
|
57
|
+
logging.debug(f"Looking for {function_name} in __main__: {func is not None}")
|
39
58
|
|
40
59
|
if not func or not callable(func):
|
60
|
+
logging.debug(f"Function {function_name} not found or not callable")
|
41
61
|
return None
|
42
62
|
|
43
63
|
import inspect
|
44
64
|
sig = inspect.signature(func)
|
65
|
+
logging.debug(f"Function signature: {sig}")
|
66
|
+
|
45
67
|
parameters = {
|
46
68
|
"type": "object",
|
47
69
|
"properties": {},
|
@@ -50,10 +72,13 @@ class Agent:
|
|
50
72
|
|
51
73
|
# Parse docstring for parameter descriptions
|
52
74
|
docstring = inspect.getdoc(func)
|
75
|
+
logging.debug(f"Function docstring: {docstring}")
|
76
|
+
|
53
77
|
param_descriptions = {}
|
54
78
|
if docstring:
|
55
79
|
import re
|
56
80
|
param_section = re.split(r'\s*Args:\s*', docstring)
|
81
|
+
logging.debug(f"Param section split: {param_section}")
|
57
82
|
if len(param_section) > 1:
|
58
83
|
param_lines = param_section[1].split('\n')
|
59
84
|
for line in param_lines:
|
@@ -61,6 +86,8 @@ class Agent:
|
|
61
86
|
if line and ':' in line:
|
62
87
|
param_name, param_desc = line.split(':', 1)
|
63
88
|
param_descriptions[param_name.strip()] = param_desc.strip()
|
89
|
+
|
90
|
+
logging.debug(f"Parameter descriptions: {param_descriptions}")
|
64
91
|
|
65
92
|
for name, param in sig.parameters.items():
|
66
93
|
param_type = "string" # Default type
|
@@ -83,11 +110,13 @@ class Agent:
|
|
83
110
|
parameters["properties"][name] = param_info
|
84
111
|
if param.default == inspect.Parameter.empty:
|
85
112
|
parameters["required"].append(name)
|
113
|
+
|
114
|
+
logging.debug(f"Generated parameters: {parameters}")
|
86
115
|
|
87
116
|
# Extract description from docstring
|
88
117
|
description = docstring.split('\n')[0] if docstring else f"Function {function_name}"
|
89
|
-
|
90
|
-
|
118
|
+
|
119
|
+
tool_def = {
|
91
120
|
"type": "function",
|
92
121
|
"function": {
|
93
122
|
"name": function_name,
|
@@ -95,6 +124,8 @@ class Agent:
|
|
95
124
|
"parameters": parameters
|
96
125
|
}
|
97
126
|
}
|
127
|
+
logging.debug(f"Generated tool definition: {tool_def}")
|
128
|
+
return tool_def
|
98
129
|
|
99
130
|
def __init__(
|
100
131
|
self,
|
@@ -290,8 +321,8 @@ class Agent:
|
|
290
321
|
def chat(self, prompt, temperature=0.2, tools=None, output_json=None):
|
291
322
|
if self.use_system_prompt:
|
292
323
|
system_prompt = f"""{self.backstory}\n
|
293
|
-
|
294
|
-
|
324
|
+
Your Role: {self.role}\n
|
325
|
+
Your Goal: {self.goal}
|
295
326
|
"""
|
296
327
|
else:
|
297
328
|
system_prompt = None
|
@@ -364,10 +395,10 @@ class Agent:
|
|
364
395
|
return response_text
|
365
396
|
|
366
397
|
reflection_prompt = f"""
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
398
|
+
Reflect on your previous response: '{response_text}'.
|
399
|
+
Identify any flaws, improvements, or actions.
|
400
|
+
Provide a "satisfactory" status ('yes' or 'no').
|
401
|
+
Output MUST be JSON with 'reflection' and 'satisfactory'.
|
371
402
|
"""
|
372
403
|
logging.debug(f"{self.name} reflection attempt {reflection_count+1}, sending prompt: {reflection_prompt}")
|
373
404
|
messages.append({"role": "user", "content": reflection_prompt})
|
@@ -64,8 +64,8 @@ class PraisonAIAgents:
|
|
64
64
|
executor_agent = task.agent
|
65
65
|
|
66
66
|
task_prompt = f"""
|
67
|
-
|
68
|
-
|
67
|
+
You need to do the following task: {task.description}.
|
68
|
+
Expected Output: {task.expected_output}.
|
69
69
|
"""
|
70
70
|
if task.context:
|
71
71
|
context_results = ""
|
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.8 → praisonaiagents-0.0.10}/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
|
{praisonaiagents-0.0.8 → praisonaiagents-0.0.10}/praisonaiagents.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|