quantalogic 0.2.12__py3-none-any.whl → 0.2.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quantalogic/main.py +5 -2
- quantalogic/search_agent.py +41 -0
- quantalogic/tools/__init__.py +4 -0
- quantalogic/tools/serpapi_search_tool.py +169 -0
- quantalogic/tools/wikipedia_search_tool.py +169 -0
- quantalogic/utils/check_version.py +1 -1
- {quantalogic-0.2.12.dist-info → quantalogic-0.2.13.dist-info}/METADATA +60 -8
- {quantalogic-0.2.12.dist-info → quantalogic-0.2.13.dist-info}/RECORD +11 -8
- {quantalogic-0.2.12.dist-info → quantalogic-0.2.13.dist-info}/LICENSE +0 -0
- {quantalogic-0.2.12.dist-info → quantalogic-0.2.13.dist-info}/WHEEL +0 -0
- {quantalogic-0.2.12.dist-info → quantalogic-0.2.13.dist-info}/entry_points.txt +0 -0
quantalogic/main.py
CHANGED
@@ -32,9 +32,10 @@ from quantalogic.agent_config import ( # noqa: E402
|
|
32
32
|
)
|
33
33
|
from quantalogic.interactive_text_editor import get_multiline_input # noqa: E402
|
34
34
|
from quantalogic.print_event import console_print_events # noqa: E402
|
35
|
-
from quantalogic.version import get_version # noqa: E402
|
36
35
|
|
37
|
-
|
36
|
+
from quantalogic.search_agent import create_search_agent
|
37
|
+
|
38
|
+
AGENT_MODES = ["code", "basic", "interpreter", "full", "code-basic","search"]
|
38
39
|
|
39
40
|
|
40
41
|
def create_agent_for_mode(mode: str, model_name: str, vision_model_name: str | None) -> Agent:
|
@@ -51,6 +52,8 @@ def create_agent_for_mode(mode: str, model_name: str, vision_model_name: str | N
|
|
51
52
|
return create_full_agent(model_name, vision_model_name)
|
52
53
|
elif mode == "interpreter":
|
53
54
|
return create_interpreter_agent(model_name, vision_model_name)
|
55
|
+
elif mode == "search":
|
56
|
+
return create_search_agent(model_name)
|
54
57
|
else:
|
55
58
|
raise ValueError(f"Unknown agent mode: {mode}")
|
56
59
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from quantalogic.agent import Agent
|
2
|
+
from quantalogic.tools import InputQuestionTool, SerpApiSearchTool, TaskCompleteTool, WikipediaSearchTool, ReadFileBlockTool,ReadFileTool, MarkitdownTool, RipgrepTool
|
3
|
+
|
4
|
+
|
5
|
+
def create_search_agent(model_name: str) -> Agent:
|
6
|
+
"""Creates and configures a search agent with web and knowledge search tools.
|
7
|
+
|
8
|
+
Args:
|
9
|
+
model_name (str): Name of the language model to use for the agent's core capabilities
|
10
|
+
|
11
|
+
Returns:
|
12
|
+
Agent: A fully configured search agent instance with:
|
13
|
+
- Web search capabilities (SerpAPI)
|
14
|
+
- Knowledge search capabilities (Wikipedia)
|
15
|
+
- Basic interaction tools
|
16
|
+
"""
|
17
|
+
specific_expertise = (
|
18
|
+
"Search expert focused on web and knowledge search operations."
|
19
|
+
"Specializes in finding and summarizing information from various sources."
|
20
|
+
)
|
21
|
+
|
22
|
+
tools = [
|
23
|
+
# Search tools
|
24
|
+
SerpApiSearchTool(), # Web search capabilities
|
25
|
+
WikipediaSearchTool(), # Knowledge search capabilities
|
26
|
+
# Basic interaction tools
|
27
|
+
TaskCompleteTool(), # Marks task completion
|
28
|
+
InputQuestionTool(), # Handles user queries
|
29
|
+
# LLM tools
|
30
|
+
ReadFileBlockTool(), # Reads specific file sections
|
31
|
+
ReadFileTool(), # Reads entire file
|
32
|
+
MarkitdownTool(), # Converts markdown to text
|
33
|
+
# Code search tools
|
34
|
+
RipgrepTool(), # Code search capabilities
|
35
|
+
]
|
36
|
+
|
37
|
+
return Agent(
|
38
|
+
model_name=model_name,
|
39
|
+
tools=tools,
|
40
|
+
specific_expertise=specific_expertise,
|
41
|
+
)
|
quantalogic/tools/__init__.py
CHANGED
@@ -17,12 +17,16 @@ from .read_file_tool import ReadFileTool
|
|
17
17
|
from .replace_in_file_tool import ReplaceInFileTool
|
18
18
|
from .ripgrep_tool import RipgrepTool
|
19
19
|
from .search_definition_names import SearchDefinitionNames
|
20
|
+
from .serpapi_search_tool import SerpApiSearchTool
|
20
21
|
from .task_complete_tool import TaskCompleteTool
|
21
22
|
from .tool import Tool, ToolArgument
|
22
23
|
from .unified_diff_tool import UnifiedDiffTool
|
24
|
+
from .wikipedia_search_tool import WikipediaSearchTool
|
23
25
|
from .write_file_tool import WriteFileTool
|
24
26
|
|
25
27
|
__all__ = [
|
28
|
+
"WikipediaSearchTool",
|
29
|
+
"SerpApiSearchTool",
|
26
30
|
"Tool",
|
27
31
|
"ToolArgument",
|
28
32
|
"TaskCompleteTool",
|
@@ -0,0 +1,169 @@
|
|
1
|
+
"""Tool for interacting with SerpApi for search results."""
|
2
|
+
|
3
|
+
import os
|
4
|
+
|
5
|
+
from serpapi.google_search import GoogleSearch
|
6
|
+
|
7
|
+
from quantalogic.tools.tool import Tool, ToolArgument
|
8
|
+
|
9
|
+
|
10
|
+
class SerpApiSearchTool(Tool):
|
11
|
+
"""Tool for retrieving paginated search results from SerpApi.
|
12
|
+
|
13
|
+
This tool provides a convenient interface to SerpAPI's search capabilities,
|
14
|
+
supporting pagination and structured result formatting.
|
15
|
+
|
16
|
+
Example usage:
|
17
|
+
```python
|
18
|
+
tool = SerpApiTool()
|
19
|
+
results = tool.execute(
|
20
|
+
query="machine learning",
|
21
|
+
page=1,
|
22
|
+
num_results=10
|
23
|
+
)
|
24
|
+
print(results)
|
25
|
+
```
|
26
|
+
|
27
|
+
The tool handles:
|
28
|
+
- Query validation
|
29
|
+
- Pagination management
|
30
|
+
- API error handling
|
31
|
+
- Result formatting
|
32
|
+
"""
|
33
|
+
|
34
|
+
name: str = "serpapi_tool"
|
35
|
+
description: str = (
|
36
|
+
"Retrieves search results from SerpAPI (Google Search) with pagination support. "
|
37
|
+
"Handles multiple pages of results and provides structured output."
|
38
|
+
)
|
39
|
+
arguments: list = [
|
40
|
+
ToolArgument(
|
41
|
+
name="query",
|
42
|
+
arg_type="string",
|
43
|
+
description="The search query to execute",
|
44
|
+
required=True,
|
45
|
+
example="machine learning",
|
46
|
+
),
|
47
|
+
ToolArgument(
|
48
|
+
name="page",
|
49
|
+
arg_type="int",
|
50
|
+
description="The page number to retrieve (1-based)",
|
51
|
+
required=True,
|
52
|
+
default="1",
|
53
|
+
example="2",
|
54
|
+
),
|
55
|
+
ToolArgument(
|
56
|
+
name="num_results",
|
57
|
+
arg_type="int",
|
58
|
+
description="Number of results to retrieve per page",
|
59
|
+
required=True,
|
60
|
+
default="10",
|
61
|
+
example="20",
|
62
|
+
),
|
63
|
+
]
|
64
|
+
|
65
|
+
def execute(self, query: str, page: int = 1, num_results: int = 10) -> str:
|
66
|
+
"""Execute a search query using SerpAPI and return results.
|
67
|
+
|
68
|
+
Args:
|
69
|
+
query: The search query to execute
|
70
|
+
page: The page number to retrieve (1-based)
|
71
|
+
num_results: Number of results to retrieve per page (1-100)
|
72
|
+
|
73
|
+
Returns:
|
74
|
+
Formatted search results as a string with the following format:
|
75
|
+
==== Page X of results ====
|
76
|
+
1. Title
|
77
|
+
URL
|
78
|
+
Description
|
79
|
+
2. Title
|
80
|
+
URL
|
81
|
+
Description
|
82
|
+
==== End of page X ====
|
83
|
+
|
84
|
+
Raises:
|
85
|
+
ValueError: If any parameter is invalid
|
86
|
+
RuntimeError: If API request fails or environment variable is missing
|
87
|
+
"""
|
88
|
+
# Validate and convert query
|
89
|
+
if not query:
|
90
|
+
raise ValueError("Query must be a non-empty string")
|
91
|
+
try:
|
92
|
+
query = str(query)
|
93
|
+
except (TypeError, ValueError) as e:
|
94
|
+
raise ValueError(f"Query must be convertible to string: {str(e)}")
|
95
|
+
|
96
|
+
# Validate and convert page
|
97
|
+
try:
|
98
|
+
page = int(page)
|
99
|
+
if page < 1:
|
100
|
+
raise ValueError("Page number must be positive")
|
101
|
+
except (TypeError, ValueError) as e:
|
102
|
+
raise ValueError(f"Invalid page number: {str(e)}")
|
103
|
+
|
104
|
+
# Validate and convert num_results
|
105
|
+
try:
|
106
|
+
num_results = int(num_results)
|
107
|
+
if num_results < 1 or num_results > 100:
|
108
|
+
raise ValueError("Number of results must be between 1 and 100")
|
109
|
+
except (TypeError, ValueError) as e:
|
110
|
+
raise ValueError(f"Invalid number of results: {str(e)}")
|
111
|
+
|
112
|
+
api_key = os.getenv("SERPAPI_API_KEY")
|
113
|
+
if not api_key:
|
114
|
+
raise RuntimeError("SERPAPI_API_KEY environment variable is not set")
|
115
|
+
|
116
|
+
try:
|
117
|
+
params = {"q": query, "start": (page - 1) * num_results, "num": num_results, "api_key": api_key}
|
118
|
+
|
119
|
+
search = GoogleSearch(params)
|
120
|
+
results = search.get_dict()
|
121
|
+
|
122
|
+
if "error" in results:
|
123
|
+
raise RuntimeError(f"API error: {results['error']}")
|
124
|
+
|
125
|
+
# Format results
|
126
|
+
output = []
|
127
|
+
if "organic_results" in results:
|
128
|
+
for idx, result in enumerate(results["organic_results"], 1):
|
129
|
+
output.append(f"{idx}. {result.get('title', 'No title')}")
|
130
|
+
output.append(f" {result.get('link', 'No URL')}")
|
131
|
+
output.append(f" {result.get('snippet', 'No description')}")
|
132
|
+
output.append("")
|
133
|
+
|
134
|
+
if not output:
|
135
|
+
return "No results found"
|
136
|
+
|
137
|
+
# Add pagination info
|
138
|
+
output.insert(0, f"==== Page {page} of results ====")
|
139
|
+
output.append(f"==== End of page {page} ====")
|
140
|
+
|
141
|
+
return "\n".join(output)
|
142
|
+
|
143
|
+
except Exception as e:
|
144
|
+
raise RuntimeError(f"Search failed: {str(e)}")
|
145
|
+
|
146
|
+
|
147
|
+
def main():
|
148
|
+
"""Demonstrate SerpApiTool functionality."""
|
149
|
+
try:
|
150
|
+
tool = SerpApiSearchTool()
|
151
|
+
|
152
|
+
# Test basic search functionality
|
153
|
+
print("Testing SerpApiTool with sample query...")
|
154
|
+
results = tool.execute(query="Python programming", page=1, num_results=3)
|
155
|
+
print(results)
|
156
|
+
|
157
|
+
# Test error handling
|
158
|
+
print("\nTesting error handling with invalid query...")
|
159
|
+
try:
|
160
|
+
tool.execute(query="")
|
161
|
+
except ValueError as e:
|
162
|
+
print(f"Caught expected ValueError: {e}")
|
163
|
+
|
164
|
+
except Exception as e:
|
165
|
+
print(f"Error in main: {e}")
|
166
|
+
|
167
|
+
|
168
|
+
if __name__ == "__main__":
|
169
|
+
main()
|
@@ -0,0 +1,169 @@
|
|
1
|
+
from typing import Union
|
2
|
+
|
3
|
+
"""Tool for interacting with Wikipedia API for search results."""
|
4
|
+
|
5
|
+
import requests # noqa: E402
|
6
|
+
|
7
|
+
from quantalogic.tools.tool import Tool, ToolArgument # noqa: E402
|
8
|
+
|
9
|
+
|
10
|
+
class WikipediaSearchTool(Tool):
|
11
|
+
"""Tool for retrieving paginated search results from Wikipedia.
|
12
|
+
|
13
|
+
This tool provides a convenient interface to Wikipedia's search API,
|
14
|
+
supporting pagination and structured result formatting.
|
15
|
+
|
16
|
+
Example usage:
|
17
|
+
```python
|
18
|
+
tool = WikipediaSearchTool()
|
19
|
+
results = tool.execute(
|
20
|
+
query="machine learning",
|
21
|
+
page=1,
|
22
|
+
num_results=10
|
23
|
+
)
|
24
|
+
print(results)
|
25
|
+
```
|
26
|
+
|
27
|
+
The tool handles:
|
28
|
+
- Query validation
|
29
|
+
- Pagination management
|
30
|
+
- API error handling
|
31
|
+
- Result formatting
|
32
|
+
"""
|
33
|
+
|
34
|
+
name: str = "wikipedia_tool"
|
35
|
+
description: str = (
|
36
|
+
"Retrieves search results from Wikipedia with pagination support. "
|
37
|
+
"Handles multiple pages of results and provides structured output."
|
38
|
+
)
|
39
|
+
arguments: list = [
|
40
|
+
ToolArgument(
|
41
|
+
name="query",
|
42
|
+
arg_type="string",
|
43
|
+
description="The search query to execute",
|
44
|
+
required=True,
|
45
|
+
example="machine learning",
|
46
|
+
),
|
47
|
+
ToolArgument(
|
48
|
+
name="page",
|
49
|
+
arg_type="int",
|
50
|
+
description="The page number to retrieve (1-based)",
|
51
|
+
required=True,
|
52
|
+
default="1",
|
53
|
+
example="2",
|
54
|
+
),
|
55
|
+
ToolArgument(
|
56
|
+
name="num_results",
|
57
|
+
arg_type="int",
|
58
|
+
description="Number of results to retrieve per page (1-50)",
|
59
|
+
required=True,
|
60
|
+
default="10",
|
61
|
+
example="20",
|
62
|
+
),
|
63
|
+
]
|
64
|
+
|
65
|
+
def execute(self, query: str, page: Union[str, int] = 1, num_results: Union[str, int] = 10) -> str:
|
66
|
+
"""Execute a search query using Wikipedia API and return results.
|
67
|
+
|
68
|
+
Args:
|
69
|
+
query: The search query to execute
|
70
|
+
page: The page number to retrieve (1-based)
|
71
|
+
num_results: Number of results to retrieve per page (1-50)
|
72
|
+
|
73
|
+
Returns:
|
74
|
+
Formatted search results as a string with the following format:
|
75
|
+
==== Page X of results ====
|
76
|
+
1. Title
|
77
|
+
URL
|
78
|
+
Description
|
79
|
+
2. Title
|
80
|
+
URL
|
81
|
+
Description
|
82
|
+
==== End of page X ====
|
83
|
+
|
84
|
+
Raises:
|
85
|
+
ValueError: If any parameter is invalid
|
86
|
+
RuntimeError: If API request fails
|
87
|
+
"""
|
88
|
+
if not query or not isinstance(query, str):
|
89
|
+
raise ValueError("Query must be a non-empty string")
|
90
|
+
|
91
|
+
try:
|
92
|
+
page = int(page) if str(page).strip() else 1
|
93
|
+
num_results = int(num_results) if str(num_results).strip() else 10
|
94
|
+
except (ValueError, TypeError) as e:
|
95
|
+
raise ValueError(f"Invalid parameter type: {e}. Expected integers for page and num_results")
|
96
|
+
|
97
|
+
if page < 1:
|
98
|
+
raise ValueError("Page number must be positive")
|
99
|
+
|
100
|
+
if num_results < 1 or num_results > 50:
|
101
|
+
raise ValueError("Number of results must be between 1 and 50")
|
102
|
+
|
103
|
+
try:
|
104
|
+
# Wikipedia API endpoint
|
105
|
+
url = "https://en.wikipedia.org/w/api.php"
|
106
|
+
params = {
|
107
|
+
"action": "query",
|
108
|
+
"format": "json",
|
109
|
+
"list": "search",
|
110
|
+
"srsearch": query,
|
111
|
+
"srlimit": num_results,
|
112
|
+
"sroffset": (page - 1) * num_results
|
113
|
+
}
|
114
|
+
|
115
|
+
response = requests.get(url, params=params)
|
116
|
+
response.raise_for_status()
|
117
|
+
data = response.json()
|
118
|
+
|
119
|
+
output = []
|
120
|
+
if "query" in data and "search" in data["query"]:
|
121
|
+
for idx, result in enumerate(data["query"]["search"], 1):
|
122
|
+
title = result.get("title", "No title")
|
123
|
+
snippet = result.get("snippet", "No description")
|
124
|
+
url = f"https://en.wikipedia.org/wiki/{title.replace(' ', '_')}"
|
125
|
+
|
126
|
+
output.append(f"{idx}. {title}")
|
127
|
+
output.append(f" {url}")
|
128
|
+
output.append(f" {snippet}")
|
129
|
+
output.append("")
|
130
|
+
|
131
|
+
if not output:
|
132
|
+
return "No results found"
|
133
|
+
|
134
|
+
output.insert(0, f"==== Page {page} of results ====")
|
135
|
+
output.append(f"==== End of page {page} ====")
|
136
|
+
|
137
|
+
return "\n".join(output)
|
138
|
+
|
139
|
+
except Exception as e:
|
140
|
+
raise RuntimeError(f"Search failed: {str(e)}")
|
141
|
+
|
142
|
+
|
143
|
+
def main():
|
144
|
+
"""Demonstrate WikipediaSearchTool functionality."""
|
145
|
+
try:
|
146
|
+
tool = WikipediaSearchTool()
|
147
|
+
|
148
|
+
# Test basic search functionality
|
149
|
+
print("Testing WikipediaSearchTool with sample query...")
|
150
|
+
results = tool.execute(
|
151
|
+
query="Python programming",
|
152
|
+
page=1,
|
153
|
+
num_results=3
|
154
|
+
)
|
155
|
+
print(results)
|
156
|
+
|
157
|
+
# Test error handling
|
158
|
+
print("\nTesting error handling with invalid query...")
|
159
|
+
try:
|
160
|
+
tool.execute(query="")
|
161
|
+
except ValueError as e:
|
162
|
+
print(f"Caught expected ValueError: {e}")
|
163
|
+
|
164
|
+
except Exception as e:
|
165
|
+
print(f"Error in main: {e}")
|
166
|
+
|
167
|
+
|
168
|
+
if __name__ == "__main__":
|
169
|
+
main()
|
@@ -16,7 +16,7 @@ def check_if_is_latest_version() -> (bool,str|None):
|
|
16
16
|
response = requests.get("https://pypi.org/pypi/quantalogic/json", timeout=5)
|
17
17
|
response.raise_for_status()
|
18
18
|
latest_version = response.json()["info"]["version"]
|
19
|
-
return version.parse(current_version)
|
19
|
+
return version.parse(current_version) < version.parse(latest_version), latest_version
|
20
20
|
except (requests.RequestException, KeyError):
|
21
21
|
return False, None
|
22
22
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: quantalogic
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.13
|
4
4
|
Summary: QuantaLogic ReAct Agents
|
5
5
|
Author: Raphaël MANSUY
|
6
6
|
Author-email: raphael.mansuy@gmail.com
|
@@ -12,6 +12,7 @@ Requires-Dist: boto3 (>=1.35.86,<2.0.0)
|
|
12
12
|
Requires-Dist: click (>=8.1.8,<9.0.0)
|
13
13
|
Requires-Dist: fastapi (>=0.115.6,<0.116.0)
|
14
14
|
Requires-Dist: google-auth (>=2.20.0,<3.0.0)
|
15
|
+
Requires-Dist: google-search-results (>=2.4.2,<3.0.0)
|
15
16
|
Requires-Dist: litellm (>=1.56.4,<2.0.0)
|
16
17
|
Requires-Dist: loguru (>=0.7.3,<0.8.0)
|
17
18
|
Requires-Dist: markitdown (>=0.0.1a3,<0.0.2)
|
@@ -19,6 +20,7 @@ Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
|
19
20
|
Requires-Dist: prompt-toolkit (>=3.0.48,<4.0.0)
|
20
21
|
Requires-Dist: pydantic (>=2.10.4,<3.0.0)
|
21
22
|
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
23
|
+
Requires-Dist: serpapi (>=0.1.5,<0.2.0)
|
22
24
|
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
|
23
25
|
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
24
26
|
Requires-Dist: tree-sitter (>=0.23.2,<0.24.0)
|
@@ -130,7 +132,7 @@ Options:
|
|
130
132
|
e.g. "openrouter/A/gpt-4o-mini").
|
131
133
|
--log [info|debug|warning] Set logging level (info/debug/warning).
|
132
134
|
--verbose Enable verbose output.
|
133
|
-
--mode [code|basic|interpreter|full|code-basic]
|
135
|
+
--mode [code|basic|interpreter|full|code-basic|search]
|
134
136
|
Agent mode (code/search/full).
|
135
137
|
--help Show this message and exit.
|
136
138
|
|
@@ -141,6 +143,8 @@ Commands:
|
|
141
143
|
### Commands
|
142
144
|
task Execute a task with the QuantaLogic AI Assistant
|
143
145
|
|
146
|
+
|
147
|
+
|
144
148
|
### Detailed Usage
|
145
149
|
|
146
150
|
#### Agent Modes
|
@@ -380,16 +384,19 @@ By integrating these tools into its architecture, QuantaLogic allows agents to p
|
|
380
384
|
|
381
385
|
### Tools Documentation
|
382
386
|
|
387
|
+
|
388
|
+
|
383
389
|
#### Overview of Tools
|
384
390
|
|
385
391
|
| Category | Tools |
|
386
392
|
|-----------------------|---------------------------------------------------------------------------------------------------|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
+
| 1. Search Tools | 1.1 SerpAPI Search Tool, 1.2 Wikipedia Search Tool |
|
394
|
+
| 2. Task Automation | Agent Tool, Task Complete Tool, Input Question Tool, Execute Bash Command Tool |
|
395
|
+
| 3. Script Execution | Python Tool, Node.js Tool, Elixir Tool |
|
396
|
+
| 4. File Operations | Read File Tool, Write File Tool, Edit Whole Content Tool, Replace In File Tool |
|
397
|
+
| 5. Code Analysis | Search Definition Names Tool, Ripgrep Tool |
|
398
|
+
| 6. Content Generation | LLM Tool, LLMVisionTool |
|
399
|
+
| 7. Utility & Management| Download HTTP File Tool, List Directory Tool, Markitdown Tool, Unified Diff Tool |
|
393
400
|
|
394
401
|
---
|
395
402
|
|
@@ -788,6 +795,51 @@ result = markitdown_tool.execute(markdown_path="./path/to/file.md")
|
|
788
795
|
print("Processed Markdown Output:", result)
|
789
796
|
```
|
790
797
|
|
798
|
+
---
|
799
|
+
|
800
|
+
### 19. SerpAPI Search Tool
|
801
|
+
|
802
|
+
The **SerpAPI Search Tool** allows agents to perform web searches using the SerpAPI service.
|
803
|
+
|
804
|
+
##### Parameters
|
805
|
+
| Parameter | Type | Description | Example |
|
806
|
+
|-----------|--------|---------------------------------|-----------------------------|
|
807
|
+
| query | string | The search query to execute | "latest AI research papers" |
|
808
|
+
| location | string | Geographic location for results | "United States" |
|
809
|
+
| num | int | Number of results to return | 5 |
|
810
|
+
|
811
|
+
##### Example Usage
|
812
|
+
```python
|
813
|
+
from quantalogic.tools import SerpAPISearchTool
|
814
|
+
|
815
|
+
search_tool = SerpAPISearchTool()
|
816
|
+
results = search_tool.execute(query="latest AI research", location="United States", num=5)
|
817
|
+
print(results)
|
818
|
+
```
|
819
|
+
|
820
|
+
---
|
821
|
+
|
822
|
+
### 20. Wikipedia Search Tool
|
823
|
+
|
824
|
+
The **Wikipedia Search Tool** enables agents to search and retrieve information from Wikipedia.
|
825
|
+
|
826
|
+
##### Parameters
|
827
|
+
|
828
|
+
| Parameter | Type | Description | Example |
|
829
|
+
|-----------|--------|---------------------------------|-----------------------------|
|
830
|
+
| query | string | The search query to execute | "Artificial Intelligence" |
|
831
|
+
| lang | string | Language code for results | "en" |
|
832
|
+
| sentences | int | Number of summary sentences | 3 |
|
833
|
+
|
834
|
+
##### Example Usage
|
835
|
+
```python
|
836
|
+
from quantalogic.tools import WikipediaSearchTool
|
837
|
+
|
838
|
+
wiki_tool = WikipediaSearchTool()
|
839
|
+
results = wiki_tool.execute(query="Artificial Intelligence", lang="en", sentences=3)
|
840
|
+
print(results)
|
841
|
+
```
|
842
|
+
```
|
791
843
|
|
792
844
|
#### Creating Custom Tools
|
793
845
|
|
@@ -5,11 +5,12 @@ quantalogic/coding_agent.py,sha256=FrodyypgtOOV-AvJiQP8PLkUIDQkDrye26dbOxIEKjM,3
|
|
5
5
|
quantalogic/event_emitter.py,sha256=jqot2g4JRXc88K6PW837Oqxbf7shZfO-xdPaUWmzupk,7901
|
6
6
|
quantalogic/generative_model.py,sha256=LKuv_aRpEwMgeEUzHg4r3XkQdPHAr4Mu-ZfWIAqR4Ik,10651
|
7
7
|
quantalogic/interactive_text_editor.py,sha256=kYeTA2qej5kxtPvAUHy_Dr2MhrGQAyenLFpW9mU9Rmw,6855
|
8
|
-
quantalogic/main.py,sha256=
|
8
|
+
quantalogic/main.py,sha256=LitSK1GfFgBAAbe6WiL9xOPyu9-UZB3PDqWINH_cPLU,11144
|
9
9
|
quantalogic/memory.py,sha256=zbtRuM05jaS2lJll-92dt5JfYVLERnF_m_9xqp2x-k0,6304
|
10
10
|
quantalogic/model_names.py,sha256=UZlz25zG9B2dpfwdw_e1Gw5qFsKQ7iME9FJh9Ts4u6s,938
|
11
11
|
quantalogic/print_event.py,sha256=nl1aRdYnsU72SRezafePF82zKtrqGfY8OoTx2QfbdE8,2206
|
12
12
|
quantalogic/prompts.py,sha256=BHIST57DYcTeTb7rvV1QkGLt0_B8Wk8a_9tsnsN6suk,3547
|
13
|
+
quantalogic/search_agent.py,sha256=HD13Ug8Zn6GpCn_3WwzNE0fhyLoitldv9lwmZ4SxCfk,1545
|
13
14
|
quantalogic/server/__init__.py,sha256=8sz_PYAUCrkM6JM5EAUeIzNM4NPW6j6UT72JVkc21WQ,91
|
14
15
|
quantalogic/server/agent_server.py,sha256=38GEK_MpLp--CX_dCkopTFOU7KcGuOw4-GciwmRJyyg,22502
|
15
16
|
quantalogic/server/models.py,sha256=nVUGWElOsUw8QnRCGJylk25wCew_5gohe6nldYighUA,1322
|
@@ -19,7 +20,7 @@ quantalogic/server/static/js/event_visualizer.js,sha256=eFkkWyNZw3zOZlF18kxbfsWq
|
|
19
20
|
quantalogic/server/static/js/quantalogic.js,sha256=x7TrlZGR1Y0WLK2DWl1xY847BhEWMPnL0Ua7KtOldUc,22311
|
20
21
|
quantalogic/server/templates/index.html,sha256=nDnXJoQEm1vXbhXtgaYk0G5VXj0wwzE6KrqEDhHFpj4,7773
|
21
22
|
quantalogic/tool_manager.py,sha256=JAC5E5kLfYzYJx0QRIWbG14q1hlkOcwJFBG7HE8twpU,2425
|
22
|
-
quantalogic/tools/__init__.py,sha256=
|
23
|
+
quantalogic/tools/__init__.py,sha256=ZjcsmkDkg79P8EkH7SkyqP2KiJndRqBjEji7KUDv6mw,1653
|
23
24
|
quantalogic/tools/agent_tool.py,sha256=MXCXxWHRch7VK4UWhtRP1jeI8Np9Ne2CUGo8vm1oZiM,3064
|
24
25
|
quantalogic/tools/download_http_file_tool.py,sha256=wTfanbXjIRi5-qrbluuLvNmDNhvmYAnlMVb3dO8C2ss,2210
|
25
26
|
quantalogic/tools/edit_whole_content_tool.py,sha256=nXmpAvojvqvAcqNMy1kUKZ1ocboky_ZcnCR4SNCSPgw,2360
|
@@ -47,13 +48,15 @@ quantalogic/tools/read_file_tool.py,sha256=bOWJbA0GU-hYbFOJ-tQVlSVz0r6WrVAfzy4aX
|
|
47
48
|
quantalogic/tools/replace_in_file_tool.py,sha256=n63s09Y8RXOKGjxfWw0D6F6JpQ6ERSJxVJOzmceVXLk,12953
|
48
49
|
quantalogic/tools/ripgrep_tool.py,sha256=sRzHaWac9fa0cCGhECJN04jw_Ko0O3u45KDWzMIYcvY,14291
|
49
50
|
quantalogic/tools/search_definition_names.py,sha256=qolDbRUssE5EyghWqgs69Kmu_dhzeO9GliqgP9pkUHM,16704
|
51
|
+
quantalogic/tools/serpapi_search_tool.py,sha256=sX-Noch77kGP2XiwislPNFyy3_4TH6TwMK6C81L3q9Y,5316
|
50
52
|
quantalogic/tools/task_complete_tool.py,sha256=L8tuyVoN07Q2hOsxx17JTW0C5Jd_N-C0i_0PtCUQUKU,929
|
51
53
|
quantalogic/tools/tool.py,sha256=ixouKOcmyYMP4YnzXANhIxixh4xgBVCRqvnBccqrAY0,5650
|
52
54
|
quantalogic/tools/unified_diff_tool.py,sha256=wTKXIoBEPcC_EcQmpJZVi95vq0Ncvsw1Kyc7XqPO6dU,14147
|
55
|
+
quantalogic/tools/wikipedia_search_tool.py,sha256=bdZ_0dYTxpEfU04tBFsatnLM5P9Z3kAZgKQEjsopJLA,5405
|
53
56
|
quantalogic/tools/write_file_tool.py,sha256=_mx9_Zjg2oMAAVzlcHEKjZVZUxQVgbRfcoMKgWnoZcg,3764
|
54
57
|
quantalogic/utils/__init__.py,sha256=Ltq7tzLuHCl9BpCvfRVA9Sjrtp1RJesrn7G980lbl_c,563
|
55
58
|
quantalogic/utils/ask_user_validation.py,sha256=F0jkbFJVXAImcSSP7op6dov5i80hRvZGRvBHbfcZrxg,340
|
56
|
-
quantalogic/utils/check_version.py,sha256=
|
59
|
+
quantalogic/utils/check_version.py,sha256=gGfT7hn64Rsrs-wWMJQJsoP4dGvyR6Q7AHHFogpmbLs,1094
|
57
60
|
quantalogic/utils/download_http_file.py,sha256=FTN3brq9WvCFvuBX-lYAhjsdYTzQT4m9m2vqlcyjkNk,3472
|
58
61
|
quantalogic/utils/get_coding_environment.py,sha256=ujZ2_nDryrLWe6ZUalSu9WDG6t53UJFn7FJ_ER7Jixc,389
|
59
62
|
quantalogic/utils/get_environment.py,sha256=7wWruSHYTUlnQWW27qU3WFYZnncqqqdofsxAsUU7lhw,875
|
@@ -64,8 +67,8 @@ quantalogic/utils/read_http_text_content.py,sha256=n3IayT5KcqctIVVF2gOQQAMf3Ow6e
|
|
64
67
|
quantalogic/version.py,sha256=ea_cRutaQk5_lwlLbUUvPFuOT7Of7-gAsDl7wdveS-g,107
|
65
68
|
quantalogic/xml_parser.py,sha256=cTRorr5sVfkIzH72M0C-GQ9ROGPiz2FTT66U9ndjzhE,9538
|
66
69
|
quantalogic/xml_tool_parser.py,sha256=lsVzClZBrZan7wjCuCKnGHWzksXI3VMy_vWthxu2_bo,3738
|
67
|
-
quantalogic-0.2.
|
68
|
-
quantalogic-0.2.
|
69
|
-
quantalogic-0.2.
|
70
|
-
quantalogic-0.2.
|
71
|
-
quantalogic-0.2.
|
70
|
+
quantalogic-0.2.13.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
71
|
+
quantalogic-0.2.13.dist-info/METADATA,sha256=-OOOtDoX2-bad_R1v3kV-Zv_ujvPl8_dtiN3lXn7wcU,41650
|
72
|
+
quantalogic-0.2.13.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
73
|
+
quantalogic-0.2.13.dist-info/entry_points.txt,sha256=wgSq5SRU98yvlRHGEZD1Xn7sS5CSjH2RfUtTa6Qy28Q,52
|
74
|
+
quantalogic-0.2.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|