praisonaiagents 0.0.25__tar.gz → 0.0.27__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/PKG-INFO +1 -1
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/agent/agent.py +33 -11
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/__init__.py +65 -54
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/duckduckgo_tools.py +3 -3
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/wikipedia_tools.py +21 -21
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/PKG-INFO +1 -1
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/pyproject.toml +1 -1
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/agent/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/agents/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/agents/agents.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agent/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agent/agent.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agents/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agents/agents.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/main.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/task/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/task/task.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/main.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/process/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/process/process.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/task/__init__.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/task/task.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/arxiv_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/calculator_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/csv_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/duckdb_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/excel_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/file_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/json_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/newspaper_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/pandas_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/python_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/shell_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/spider_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/test.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/xml_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/yaml_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents/tools/yfinance_tools.py +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/SOURCES.txt +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/dependency_links.txt +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/requires.txt +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/top_level.txt +0 -0
- {praisonaiagents-0.0.25 → praisonaiagents-0.0.27}/setup.cfg +0 -0
@@ -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
|
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
|
-
|
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
|
280
|
+
if func:
|
269
281
|
try:
|
270
|
-
|
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}")
|
@@ -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 [
|
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
|
-
|
44
|
-
|
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.
|
6
|
-
page = wikipedia_tools.
|
7
|
-
results = wikipedia_tools.
|
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
|
11
|
-
summary =
|
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
|
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
|
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
|
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
|
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
|
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
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
263
|
+
success = wiki_language("es")
|
264
264
|
if success:
|
265
|
-
summary =
|
265
|
+
summary = wiki_summary("Python (lenguaje de programación)", sentences=1)
|
266
266
|
print("Spanish summary:")
|
267
267
|
print(summary)
|
268
268
|
print()
|
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.25 → praisonaiagents-0.0.27}/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
|
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
|
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.25 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|