praisonaiagents 0.0.26__tar.gz → 0.0.27__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/PKG-INFO +1 -1
  2. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/agent/agent.py +33 -11
  3. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/PKG-INFO +1 -1
  4. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/pyproject.toml +1 -1
  5. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/__init__.py +0 -0
  6. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/agent/__init__.py +0 -0
  7. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/agents/__init__.py +0 -0
  8. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/agents/agents.py +0 -0
  9. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/__init__.py +0 -0
  10. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agent/__init__.py +0 -0
  11. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agent/agent.py +0 -0
  12. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agents/__init__.py +0 -0
  13. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agents/agents.py +0 -0
  14. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/main.py +0 -0
  15. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/task/__init__.py +0 -0
  16. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/task/task.py +0 -0
  17. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/main.py +0 -0
  18. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/process/__init__.py +0 -0
  19. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/process/process.py +0 -0
  20. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/task/__init__.py +0 -0
  21. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/task/task.py +0 -0
  22. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/__init__.py +0 -0
  23. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/arxiv_tools.py +0 -0
  24. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/calculator_tools.py +0 -0
  25. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/csv_tools.py +0 -0
  26. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/duckdb_tools.py +0 -0
  27. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/duckduckgo_tools.py +0 -0
  28. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/excel_tools.py +0 -0
  29. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/file_tools.py +0 -0
  30. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/json_tools.py +0 -0
  31. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/newspaper_tools.py +0 -0
  32. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/pandas_tools.py +0 -0
  33. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/python_tools.py +0 -0
  34. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/shell_tools.py +0 -0
  35. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/spider_tools.py +0 -0
  36. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/test.py +0 -0
  37. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/tools.py +0 -0
  38. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/wikipedia_tools.py +0 -0
  39. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/xml_tools.py +0 -0
  40. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/yaml_tools.py +0 -0
  41. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/yfinance_tools.py +0 -0
  42. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/SOURCES.txt +0 -0
  43. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/dependency_links.txt +0 -0
  44. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/requires.txt +0 -0
  45. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/top_level.txt +0 -0
  46. {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: praisonaiagents
3
- Version: 0.0.26
3
+ Version: 0.0.27
4
4
  Summary: Praison AI agents for completing complex tasks with Self Reflection Agents
5
5
  Author: Mervin Praison
6
6
  Requires-Dist: pydantic
@@ -18,6 +18,7 @@ from ..main import (
18
18
  client,
19
19
  error_logs
20
20
  )
21
+ import inspect
21
22
 
22
23
  if TYPE_CHECKING:
23
24
  from ..task.task import Task
@@ -67,9 +68,24 @@ class Agent:
67
68
  return None
68
69
 
69
70
  import inspect
71
+ # Langchain tools
72
+ if inspect.isclass(func) and hasattr(func, 'run'):
73
+ original_func = func
74
+ func = func.run
75
+ function_name = original_func.__name__
76
+
70
77
  sig = inspect.signature(func)
71
78
  logging.debug(f"Function signature: {sig}")
72
79
 
80
+ # Skip self, *args, **kwargs, so they don't get passed in arguments
81
+ parameters_list = []
82
+ for name, param in sig.parameters.items():
83
+ if name == "self":
84
+ continue
85
+ if param.kind in (inspect.Parameter.VAR_POSITIONAL, inspect.Parameter.VAR_KEYWORD):
86
+ continue
87
+ parameters_list.append((name, param))
88
+
73
89
  parameters = {
74
90
  "type": "object",
75
91
  "properties": {},
@@ -95,7 +111,7 @@ class Agent:
95
111
 
96
112
  logging.debug(f"Parameter descriptions: {param_descriptions}")
97
113
 
98
- for name, param in sig.parameters.items():
114
+ for name, param in parameters_list:
99
115
  param_type = "string" # Default type
100
116
  if param.annotation != inspect.Parameter.empty:
101
117
  if param.annotation == int:
@@ -249,25 +265,31 @@ Your Goal: {self.goal}
249
265
  # Try to find the function in the agent's tools list first
250
266
  func = None
251
267
  for tool in self.tools:
252
- if callable(tool) and getattr(tool, '__name__', '') == function_name:
268
+ if (callable(tool) and getattr(tool, '__name__', '') == function_name) or \
269
+ (inspect.isclass(tool) and tool.__name__ == function_name):
253
270
  func = tool
254
271
  break
255
272
 
256
- logging.debug(f"Looking for {function_name} in agent tools: {func is not None}")
257
-
258
- # If not found in tools, try globals and main
259
- if not func:
273
+ if func is None:
274
+ # If not found in tools, try globals and main
260
275
  func = globals().get(function_name)
261
- logging.debug(f"Looking for {function_name} in globals: {func is not None}")
262
-
263
276
  if not func:
264
277
  import __main__
265
278
  func = getattr(__main__, function_name, None)
266
- logging.debug(f"Looking for {function_name} in __main__: {func is not None}")
267
279
 
268
- if func and callable(func):
280
+ if func:
269
281
  try:
270
- return func(**arguments)
282
+ # If it's a class with run method, instantiate and call run
283
+ if inspect.isclass(func) and hasattr(func, 'run'):
284
+ instance = func()
285
+ # Extract only the parameters that run() expects
286
+ run_params = {k: v for k, v in arguments.items()
287
+ if k in inspect.signature(instance.run).parameters
288
+ and k != 'self'}
289
+ return instance.run(**run_params)
290
+ # Otherwise treat as regular function
291
+ elif callable(func):
292
+ return func(**arguments)
271
293
  except Exception as e:
272
294
  error_msg = str(e)
273
295
  logging.error(f"Error executing tool {function_name}: {error_msg}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: praisonaiagents
3
- Version: 0.0.26
3
+ Version: 0.0.27
4
4
  Summary: Praison AI agents for completing complex tasks with Self Reflection Agents
5
5
  Author: Mervin Praison
6
6
  Requires-Dist: pydantic
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "praisonaiagents"
7
- version = "0.0.26"
7
+ version = "0.0.27"
8
8
  description = "Praison AI agents for completing complex tasks with Self Reflection Agents"
9
9
  authors = [
10
10
  { name="Mervin Praison" }