praisonaiagents 0.0.25__py3-none-any.whl → 0.0.26__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,59 @@ TOOL_MAPPINGS = {
8
8
  'internet_search': ('.duckduckgo_tools', None),
9
9
  'duckduckgo': ('.duckduckgo_tools', None),
10
10
 
11
+ # arXiv Tools
12
+ 'search_arxiv': ('.arxiv_tools', None),
13
+ 'get_arxiv_paper': ('.arxiv_tools', None),
14
+ 'get_papers_by_author': ('.arxiv_tools', None),
15
+ 'get_papers_by_category': ('.arxiv_tools', None),
16
+ 'arxiv_tools': ('.arxiv_tools', None),
17
+
18
+ # Wikipedia Tools
19
+ 'wiki_search': ('.wikipedia_tools', None),
20
+ 'wiki_summary': ('.wikipedia_tools', None),
21
+ 'wiki_page': ('.wikipedia_tools', None),
22
+ 'wiki_random': ('.wikipedia_tools', None),
23
+ 'wiki_language': ('.wikipedia_tools', None),
24
+ 'wikipedia_tools': ('.wikipedia_tools', None),
25
+
26
+ # Newspaper Tools
27
+ 'get_article': ('.newspaper_tools', None),
28
+ 'get_news_sources': ('.newspaper_tools', None),
29
+ 'get_articles_from_source': ('.newspaper_tools', None),
30
+ 'get_trending_topics': ('.newspaper_tools', None),
31
+ 'newspaper_tools': ('.newspaper_tools', None),
32
+
33
+ # Spider Tools
34
+ 'scrape_page': ('.spider_tools', None),
35
+ 'extract_links': ('.spider_tools', None),
36
+ 'crawl': ('.spider_tools', None),
37
+ 'extract_text': ('.spider_tools', None),
38
+ 'spider_tools': ('.spider_tools', None),
39
+
40
+ # DuckDB Tools
41
+ 'query': ('.duckdb_tools', None),
42
+ 'create_table': ('.duckdb_tools', None),
43
+ 'load_data': ('.duckdb_tools', None),
44
+ 'export_data': ('.duckdb_tools', None),
45
+ 'get_table_info': ('.duckdb_tools', None),
46
+ 'analyze_data': ('.duckdb_tools', None),
47
+ 'duckdb_tools': ('.duckdb_tools', None),
48
+
49
+ # Shell Tools
50
+ 'execute_command': ('.shell_tools', None),
51
+ 'list_processes': ('.shell_tools', None),
52
+ 'kill_process': ('.shell_tools', None),
53
+ 'get_system_info': ('.shell_tools', None),
54
+ 'shell_tools': ('.shell_tools', None),
55
+
56
+ # Calculator Tools
57
+ 'evaluate': ('.calculator_tools', None),
58
+ 'solve_equation': ('.calculator_tools', None),
59
+ 'convert_units': ('.calculator_tools', None),
60
+ 'calculate_statistics': ('.calculator_tools', None),
61
+ 'calculate_financial': ('.calculator_tools', None),
62
+ 'calculator_tools': ('.calculator_tools', None),
63
+
11
64
  # Class methods from YFinance
12
65
  'get_stock_price': ('.yfinance_tools', 'YFinanceTools'),
13
66
  'get_stock_info': ('.yfinance_tools', 'YFinanceTools'),
@@ -68,14 +121,6 @@ TOOL_MAPPINGS = {
68
121
  'transform_yaml': ('.yaml_tools', 'YAMLTools'),
69
122
  'yaml_tools': ('.yaml_tools', 'YAMLTools'),
70
123
 
71
- # Calculator Tools
72
- 'evaluate': ('.calculator_tools', 'CalculatorTools'),
73
- 'solve_equation': ('.calculator_tools', 'CalculatorTools'),
74
- 'convert_units': ('.calculator_tools', 'CalculatorTools'),
75
- 'calculate_statistics': ('.calculator_tools', 'CalculatorTools'),
76
- 'calculate_financial': ('.calculator_tools', 'CalculatorTools'),
77
- 'calculator_tools': ('.calculator_tools', 'CalculatorTools'),
78
-
79
124
  # Python Tools
80
125
  'execute_code': ('.python_tools', 'PythonTools'),
81
126
  'analyze_code': ('.python_tools', 'PythonTools'),
@@ -90,51 +135,6 @@ TOOL_MAPPINGS = {
90
135
  'group_by': ('.pandas_tools', 'PandasTools'),
91
136
  'pivot_table': ('.pandas_tools', 'PandasTools'),
92
137
  'pandas_tools': ('.pandas_tools', 'PandasTools'),
93
-
94
- # Wikipedia Tools
95
- 'search': ('.wikipedia_tools', 'WikipediaTools'),
96
- 'get_wikipedia_summary': ('.wikipedia_tools', 'WikipediaTools'),
97
- 'get_wikipedia_page': ('.wikipedia_tools', 'WikipediaTools'),
98
- 'get_random_wikipedia': ('.wikipedia_tools', 'WikipediaTools'),
99
- 'set_wikipedia_language': ('.wikipedia_tools', 'WikipediaTools'),
100
- 'wikipedia_tools': ('.wikipedia_tools', 'WikipediaTools'),
101
-
102
- # Newspaper Tools
103
- 'get_article': ('.newspaper_tools', 'NewspaperTools'),
104
- 'get_news_sources': ('.newspaper_tools', 'NewspaperTools'),
105
- 'get_articles_from_source': ('.newspaper_tools', 'NewspaperTools'),
106
- 'get_trending_topics': ('.newspaper_tools', 'NewspaperTools'),
107
- 'newspaper_tools': ('.newspaper_tools', 'NewspaperTools'),
108
-
109
- # arXiv Tools
110
- 'search_arxiv': ('.arxiv_tools', 'ArxivTools'),
111
- 'get_arxiv_paper': ('.arxiv_tools', 'ArxivTools'),
112
- 'get_papers_by_author': ('.arxiv_tools', 'ArxivTools'),
113
- 'get_papers_by_category': ('.arxiv_tools', 'ArxivTools'),
114
- 'arxiv_tools': ('.arxiv_tools', 'ArxivTools'),
115
-
116
- # Spider Tools
117
- 'scrape_page': ('.spider_tools', 'SpiderTools'),
118
- 'extract_links': ('.spider_tools', 'SpiderTools'),
119
- 'crawl': ('.spider_tools', 'SpiderTools'),
120
- 'extract_text': ('.spider_tools', 'SpiderTools'),
121
- 'spider_tools': ('.spider_tools', 'SpiderTools'),
122
-
123
- # DuckDB Tools
124
- 'query': ('.duckdb_tools', 'DuckDBTools'),
125
- 'create_table': ('.duckdb_tools', 'DuckDBTools'),
126
- 'load_data': ('.duckdb_tools', 'DuckDBTools'),
127
- 'export_data': ('.duckdb_tools', 'DuckDBTools'),
128
- 'get_table_info': ('.duckdb_tools', 'DuckDBTools'),
129
- 'analyze_data': ('.duckdb_tools', 'DuckDBTools'),
130
- 'duckdb_tools': ('.duckdb_tools', 'DuckDBTools'),
131
-
132
- # Shell Tools
133
- 'execute_command': ('.shell_tools', 'ShellTools'),
134
- 'list_processes': ('.shell_tools', 'ShellTools'),
135
- 'kill_process': ('.shell_tools', 'ShellTools'),
136
- 'get_system_info': ('.shell_tools', 'ShellTools'),
137
- 'shell_tools': ('.shell_tools', 'ShellTools'),
138
138
  }
139
139
 
140
140
  _instances = {} # Cache for class instances
@@ -149,7 +149,18 @@ def __getattr__(name: str) -> Any:
149
149
  if class_name is None:
150
150
  # Direct function import
151
151
  module = import_module(module_path, __package__)
152
- if name in ['duckduckgo', 'file_tools', 'pandas_tools', 'wikipedia_tools',
152
+ if name in [
153
+ 'duckduckgo', 'internet_search',
154
+ 'search_arxiv', 'get_arxiv_paper', 'get_papers_by_author', 'get_papers_by_category',
155
+ 'wiki_search', 'wiki_summary', 'wiki_page', 'wiki_random', 'wiki_language',
156
+ 'get_article', 'get_news_sources', 'get_articles_from_source', 'get_trending_topics',
157
+ 'scrape_page', 'extract_links', 'crawl', 'extract_text',
158
+ 'query', 'create_table', 'load_data', 'export_data', 'get_table_info', 'analyze_data',
159
+ 'execute_command', 'list_processes', 'kill_process', 'get_system_info',
160
+ 'evaluate', 'solve_equation', 'convert_units', 'calculate_statistics', 'calculate_financial'
161
+ ]:
162
+ return getattr(module, name)
163
+ if name in ['file_tools', 'pandas_tools', 'wikipedia_tools',
153
164
  'newspaper_tools', 'arxiv_tools', 'spider_tools', 'duckdb_tools', 'csv_tools', 'json_tools', 'excel_tools', 'xml_tools', 'yaml_tools', 'calculator_tools', 'python_tools', 'shell_tools']:
154
165
  return module # Returns the callable module
155
166
  return getattr(module, name)
@@ -12,7 +12,6 @@ results = duckduckgo("AI news")
12
12
  from typing import List, Dict
13
13
  import logging
14
14
  from importlib import util
15
- import sys
16
15
 
17
16
  def internet_search(query: str) -> List[Dict]:
18
17
  """Perform an internet search using DuckDuckGo."""
@@ -40,8 +39,9 @@ def internet_search(query: str) -> List[Dict]:
40
39
  logging.error(error_msg)
41
40
  return [{"error": error_msg}]
42
41
 
43
- # Make the module callable
44
- sys.modules[__name__].__call__ = internet_search
42
+ def duckduckgo(query: str) -> List[Dict]:
43
+ """Alias for internet_search function."""
44
+ return internet_search(query)
45
45
 
46
46
  if __name__ == "__main__":
47
47
  # Example usage
@@ -2,13 +2,13 @@
2
2
 
3
3
  Usage:
4
4
  from praisonaiagents.tools import wikipedia_tools
5
- summary = wikipedia_tools.get_summary("Python programming language")
6
- page = wikipedia_tools.get_page("Python programming language")
7
- results = wikipedia_tools.search("Python programming")
5
+ summary = wikipedia_tools.wiki_summary("Python programming language")
6
+ page = wikipedia_tools.wiki_page("Python programming language")
7
+ results = wikipedia_tools.wiki_search("Python programming")
8
8
 
9
9
  or
10
- from praisonaiagents.tools import get_wikipedia_summary, get_wikipedia_page
11
- summary = get_wikipedia_summary("Python programming language")
10
+ from praisonaiagents.tools import wiki_search, wiki_summary, wiki_page
11
+ summary = wiki_summary("Python programming language")
12
12
  """
13
13
 
14
14
  import logging
@@ -32,7 +32,7 @@ class WikipediaTools:
32
32
  # Set default language to English
33
33
  wikipedia.set_lang("en")
34
34
 
35
- def search(
35
+ def wiki_search(
36
36
  self,
37
37
  query: str,
38
38
  results: int = 10,
@@ -63,7 +63,7 @@ class WikipediaTools:
63
63
  logging.error(error_msg)
64
64
  return {"error": error_msg}
65
65
 
66
- def get_summary(
66
+ def wiki_summary(
67
67
  self,
68
68
  title: str,
69
69
  sentences: int = 5,
@@ -92,7 +92,7 @@ class WikipediaTools:
92
92
  logging.error(error_msg)
93
93
  return {"error": error_msg}
94
94
 
95
- def get_page(
95
+ def wiki_page(
96
96
  self,
97
97
  title: str,
98
98
  auto_suggest: bool = True
@@ -168,7 +168,7 @@ class WikipediaTools:
168
168
 
169
169
  return sections
170
170
 
171
- def get_random(self, pages: int = 1) -> Union[List[str], Dict[str, str]]:
171
+ def wiki_random(self, pages: int = 1) -> Union[List[str], Dict[str, str]]:
172
172
  """
173
173
  Get random Wikipedia page titles.
174
174
 
@@ -185,7 +185,7 @@ class WikipediaTools:
185
185
  logging.error(error_msg)
186
186
  return {"error": error_msg}
187
187
 
188
- def set_language(self, language: str) -> bool:
188
+ def wiki_language(self, language: str) -> bool:
189
189
  """
190
190
  Set the language for Wikipedia searches.
191
191
 
@@ -205,11 +205,11 @@ class WikipediaTools:
205
205
 
206
206
  # Create instance for direct function access
207
207
  _wikipedia_tools = WikipediaTools()
208
- search = _wikipedia_tools.search
209
- get_summary = _wikipedia_tools.get_summary
210
- get_page = _wikipedia_tools.get_page
211
- get_random = _wikipedia_tools.get_random
212
- set_language = _wikipedia_tools.set_language
208
+ wiki_search = _wikipedia_tools.wiki_search
209
+ wiki_summary = _wikipedia_tools.wiki_summary
210
+ wiki_page = _wikipedia_tools.wiki_page
211
+ wiki_random = _wikipedia_tools.wiki_random
212
+ wiki_language = _wikipedia_tools.wiki_language
213
213
 
214
214
  if __name__ == "__main__":
215
215
  # Example usage
@@ -220,7 +220,7 @@ if __name__ == "__main__":
220
220
  # 1. Search for a topic
221
221
  print("1. Searching Wikipedia")
222
222
  print("------------------------------")
223
- search_results = search("Python programming language")
223
+ search_results = wiki_search("Python programming language")
224
224
  print("Search results:")
225
225
  print(json.dumps(search_results, indent=2))
226
226
  print()
@@ -228,7 +228,7 @@ if __name__ == "__main__":
228
228
  # 2. Get a page summary
229
229
  print("2. Getting Page Summary")
230
230
  print("------------------------------")
231
- summary = get_summary("Python programming language", sentences=3)
231
+ summary = wiki_summary("Python programming language", sentences=3)
232
232
  print("Summary:")
233
233
  print(summary)
234
234
  print()
@@ -236,7 +236,7 @@ if __name__ == "__main__":
236
236
  # 3. Get detailed page information
237
237
  print("3. Getting Full Page Information")
238
238
  print("------------------------------")
239
- page = get_page("Python programming language")
239
+ page = wiki_page("Python programming language")
240
240
  if isinstance(page, dict) and "error" not in page:
241
241
  print("Page sections:")
242
242
  for section in page["sections"]:
@@ -252,7 +252,7 @@ if __name__ == "__main__":
252
252
  # 4. Get random pages
253
253
  print("4. Getting Random Pages")
254
254
  print("------------------------------")
255
- random_pages = get_random(3)
255
+ random_pages = wiki_random(3)
256
256
  print("Random page titles:")
257
257
  print(json.dumps(random_pages, indent=2))
258
258
  print()
@@ -260,9 +260,9 @@ if __name__ == "__main__":
260
260
  # 5. Try different language
261
261
  print("5. Changing Language")
262
262
  print("------------------------------")
263
- success = set_language("es")
263
+ success = wiki_language("es")
264
264
  if success:
265
- summary = get_summary("Python (lenguaje de programación)", sentences=1)
265
+ summary = wiki_summary("Python (lenguaje de programación)", sentences=1)
266
266
  print("Spanish summary:")
267
267
  print(summary)
268
268
  print()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: praisonaiagents
3
- Version: 0.0.25
3
+ Version: 0.0.26
4
4
  Summary: Praison AI agents for completing complex tasks with Self Reflection Agents
5
5
  Author: Mervin Praison
6
6
  Requires-Dist: pydantic
@@ -16,12 +16,12 @@ praisonaiagents/process/__init__.py,sha256=lkYbL7Hn5a0ldvJtkdH23vfIIZLIcanK-65C0
16
16
  praisonaiagents/process/process.py,sha256=4qXdrCDQPH5MtvHvdJVURXKNgSl6ae3OYTiqAF_A2ZU,24295
17
17
  praisonaiagents/task/__init__.py,sha256=VL5hXVmyGjINb34AalxpBMl-YW9m5EDcRkMTKkSSl7c,80
18
18
  praisonaiagents/task/task.py,sha256=UiiWgLDOdX_w0opP8h8-u-leVZlq1CkpGUmf7L2qyJs,3110
19
- praisonaiagents/tools/__init__.py,sha256=bFCnpM_MOiYASz7Y7b0WnFjF68QEgToR3JJgfiAWgfA,7012
19
+ praisonaiagents/tools/__init__.py,sha256=-0lV5n5cG54vYW6REjXIfuJnCLKnfQIDlXsySCaPB9s,7347
20
20
  praisonaiagents/tools/arxiv_tools.py,sha256=1stb31zTjLTon4jCnpZG5de9rKc9QWgC0leLegvPXWo,10528
21
21
  praisonaiagents/tools/calculator_tools.py,sha256=S1xPT74Geurvjm52QMMIG29zDXVEWJmM6nmyY7yF298,9571
22
22
  praisonaiagents/tools/csv_tools.py,sha256=gX2nYz4ktmpKvXB36jx5-GqddntEQD4G2fVQWTIKrwU,8435
23
23
  praisonaiagents/tools/duckdb_tools.py,sha256=KB3b-1HcX7ocoxskDpk_7RRpTGHnH8hizIY0ZdLRbIE,8816
24
- praisonaiagents/tools/duckduckgo_tools.py,sha256=LUliFagYtVz7kcgsJfHOC5fbF4RsrT3kFcXoW_4RUr4,1622
24
+ praisonaiagents/tools/duckduckgo_tools.py,sha256=ynlB5ZyWfHYjUq0JZXH12TganqTihgD-2IyRgs32y84,1657
25
25
  praisonaiagents/tools/excel_tools.py,sha256=e2HqcwnyBueOyss0xEKxff3zB4w4sNWCOMXvZfbDYlE,11309
26
26
  praisonaiagents/tools/file_tools.py,sha256=KRskI9q8up3sHaLQSaIGtvpl1brq419Up6YvB9QzSoI,8807
27
27
  praisonaiagents/tools/json_tools.py,sha256=ApUYNuQ1qnbmYNCxSlx6Tth_H1yo8mhWtZ7Rr2WS6C4,16507
@@ -32,11 +32,11 @@ praisonaiagents/tools/shell_tools.py,sha256=P3fSrfOw71CGcrPwdPOA9Fr6Bgt_CAC71bUj
32
32
  praisonaiagents/tools/spider_tools.py,sha256=lrZnT1V1BC46We-AzBrDB1Ryifr3KKGmYNntMsScU7w,15094
33
33
  praisonaiagents/tools/test.py,sha256=UHOTNrnMo0_H6I2g48re1WNZkrR7f6z25UnlWxiOSbM,1600
34
34
  praisonaiagents/tools/tools.py,sha256=TK5njOmDSpMlyBnbeBzNSlnzXWlnNaTpVqkFPhkMArg,265
35
- praisonaiagents/tools/wikipedia_tools.py,sha256=vKYvnJlLnG5Ysvhdi5fq8efDMWInfDCXaizYB5WJo9Q,9435
35
+ praisonaiagents/tools/wikipedia_tools.py,sha256=pGko-f33wqXgxJTv8db7TbizY5XnzBQRkNdq_GsplvI,9465
36
36
  praisonaiagents/tools/xml_tools.py,sha256=iYTMBEk5l3L3ryQ1fkUnNVYK-Nnua2Kx2S0dxNMMs1A,17122
37
37
  praisonaiagents/tools/yaml_tools.py,sha256=uogAZrhXV9O7xvspAtcTfpKSQYL2nlOTvCQXN94-G9A,14215
38
38
  praisonaiagents/tools/yfinance_tools.py,sha256=nmzjS7G_5GqMQD4r867mt17dHg5xvtsYDDfOPh68SgE,8105
39
- praisonaiagents-0.0.25.dist-info/METADATA,sha256=Z5VIr56RrpyJ7xF6mav54_GzlQwmjNMKKj9-4JKeBoY,233
40
- praisonaiagents-0.0.25.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
41
- praisonaiagents-0.0.25.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
42
- praisonaiagents-0.0.25.dist-info/RECORD,,
39
+ praisonaiagents-0.0.26.dist-info/METADATA,sha256=G8cw1HxMSy0OyKcqyOTpF_5C4tHUwnkXtSBriAOzl6M,233
40
+ praisonaiagents-0.0.26.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
41
+ praisonaiagents-0.0.26.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
42
+ praisonaiagents-0.0.26.dist-info/RECORD,,