quantalogic 0.2.19__py3-none-any.whl → 0.2.20__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/agent.py +26 -5
- quantalogic/coding_agent.py +13 -0
- quantalogic/tools/__init__.py +3 -1
- quantalogic/tools/jinja_tool.py +91 -0
- quantalogic/tools/llm_tool.py +5 -0
- quantalogic/tools/search_definition_names.py +55 -4
- quantalogic/tools/tool.py +114 -7
- quantalogic/xml_tool_parser.py +4 -2
- quantalogic-0.2.20.dist-info/METADATA +515 -0
- {quantalogic-0.2.19.dist-info → quantalogic-0.2.20.dist-info}/RECORD +13 -12
- quantalogic-0.2.19.dist-info/METADATA +0 -992
- {quantalogic-0.2.19.dist-info → quantalogic-0.2.20.dist-info}/LICENSE +0 -0
- {quantalogic-0.2.19.dist-info → quantalogic-0.2.20.dist-info}/WHEEL +0 -0
- {quantalogic-0.2.19.dist-info → quantalogic-0.2.20.dist-info}/entry_points.txt +0 -0
@@ -1,992 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: quantalogic
|
3
|
-
Version: 0.2.19
|
4
|
-
Summary: QuantaLogic ReAct Agents
|
5
|
-
Author: Raphaël MANSUY
|
6
|
-
Author-email: raphael.mansuy@gmail.com
|
7
|
-
Requires-Python: >=3.12,<4.0
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: Programming Language :: Python :: 3.12
|
10
|
-
Classifier: Programming Language :: Python :: 3.13
|
11
|
-
Requires-Dist: boto3 (>=1.35.86,<2.0.0)
|
12
|
-
Requires-Dist: click (>=8.1.8,<9.0.0)
|
13
|
-
Requires-Dist: duckduckgo-search (>=7.2.1,<8.0.0)
|
14
|
-
Requires-Dist: fastapi (>=0.115.6,<0.116.0)
|
15
|
-
Requires-Dist: google-auth (>=2.20.0,<3.0.0)
|
16
|
-
Requires-Dist: google-search-results (>=2.4.2,<3.0.0)
|
17
|
-
Requires-Dist: litellm (>=1.56.4,<2.0.0)
|
18
|
-
Requires-Dist: llmlingua (>=0.2.2,<0.3.0)
|
19
|
-
Requires-Dist: loguru (>=0.7.3,<0.8.0)
|
20
|
-
Requires-Dist: markitdown (>=0.0.1a3,<0.0.2)
|
21
|
-
Requires-Dist: mkdocs-git-revision-date-localized-plugin (>=1.2.0,<2.0.0)
|
22
|
-
Requires-Dist: mkdocs-macros-plugin (>=1.0.4,<2.0.0)
|
23
|
-
Requires-Dist: mkdocs-material[imaging] (>=9.5.49,<10.0.0)
|
24
|
-
Requires-Dist: mkdocs-mermaid2-plugin (>=1.1.1,<2.0.0)
|
25
|
-
Requires-Dist: mkdocs-minify-plugin (>=0.7.1,<0.8.0)
|
26
|
-
Requires-Dist: mkdocstrings (>=0.24.0,<0.25.0)
|
27
|
-
Requires-Dist: mkdocstrings-python (>=1.7.0,<2.0.0)
|
28
|
-
Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
29
|
-
Requires-Dist: prompt-toolkit (>=3.0.48,<4.0.0)
|
30
|
-
Requires-Dist: pydantic (>=2.10.4,<3.0.0)
|
31
|
-
Requires-Dist: pymdown-extensions (>=10.3.1,<11.0.0)
|
32
|
-
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
33
|
-
Requires-Dist: serpapi (>=0.1.5,<0.2.0)
|
34
|
-
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
|
35
|
-
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
36
|
-
Requires-Dist: tree-sitter (>=0.23.2,<0.24.0)
|
37
|
-
Requires-Dist: tree-sitter-c (>=0.23.4,<0.24.0)
|
38
|
-
Requires-Dist: tree-sitter-cpp (>=0.23.4,<0.24.0)
|
39
|
-
Requires-Dist: tree-sitter-go (>=0.23.4,<0.24.0)
|
40
|
-
Requires-Dist: tree-sitter-java (>=0.23.5,<0.24.0)
|
41
|
-
Requires-Dist: tree-sitter-javascript (>=0.23.1,<0.24.0)
|
42
|
-
Requires-Dist: tree-sitter-python (>=0.23.6,<0.24.0)
|
43
|
-
Requires-Dist: tree-sitter-rust (>=0.23.2,<0.24.0)
|
44
|
-
Requires-Dist: tree-sitter-scala (>=0.23.4,<0.24.0)
|
45
|
-
Requires-Dist: tree-sitter-typescript (>=0.23.2,<0.24.0)
|
46
|
-
Requires-Dist: types-requests (>=2.32.0.20241016,<3.0.0.0)
|
47
|
-
Requires-Dist: uvicorn (>=0.34.0,<0.35.0)
|
48
|
-
Requires-Dist: websocket (>=0.2.1,<0.3.0)
|
49
|
-
Description-Content-Type: text/markdown
|
50
|
-
|
51
|
-
# QuantaLogic
|
52
|
-
|
53
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
54
|
-
[](https://www.python.org/downloads/)
|
55
|
-
[](https://quantalogic.github.io/quantalogic/)
|
56
|
-
[HowTo Guide](./docs/howto/howto.md)
|
57
|
-
|
58
|
-
QuantaLogic is a ReAct (Reasoning & Action) framework for building advanced AI agents.
|
59
|
-
|
60
|
-
It seamlessly integrates large language models (LLMs) with a robust tool system, enabling agents to understand, reason about, and execute complex tasks through natural language interaction.
|
61
|
-
|
62
|
-
The `cli` version include coding capabilities comparable to Aider.
|
63
|
-
|
64
|
-
[📖 Documentation](https://quantalogic.github.io/quantalogic/)
|
65
|
-
|
66
|
-

|
67
|
-
|
68
|
-
## Why QuantaLogic?
|
69
|
-
|
70
|
-
We created [QuantaLogic](https://www.quantalogic.app) because we saw a significant gap between the advanced AI models developed by companies like OpenAI, Anthropic, DeepSeek and their practical implementation in everyday business processes.
|
71
|
-
|
72
|
-
> Our mission is to bridge this gap, making the power of generative AI accessible and actionable for businesses of all sizes.
|
73
|
-
|
74
|
-
|
75
|
-
## 🌟 Highlights
|
76
|
-
|
77
|
-
- **ReAct Framework**: Advanced implementation combining LLM reasoning with concrete actions
|
78
|
-
- **Universal LLM Support**: Integration with OpenAI, Anthropic, LM Studio, Bedrock, Ollama, DeepSeek V3, via LiteLLM
|
79
|
-
- **Secure Tool System**: Docker-based code execution and file manipulation tools
|
80
|
-
- **Real-time Monitoring**: Web interface with SSE-based event visualization
|
81
|
-
- **Memory Management**: Intelligent context handling and optimization
|
82
|
-
- **Enterprise Ready**: Comprehensive logging, error handling, and validation system
|
83
|
-
|
84
|
-
## 📋 Table of Contents
|
85
|
-
|
86
|
-
- [Release Notes](#release-notes)
|
87
|
-
|
88
|
-
- [Installation](#-installation)
|
89
|
-
- [Quick Start](#-quickstart)
|
90
|
-
- [Key Components](#-key-components)
|
91
|
-
- [Agent System](#-agent-system)
|
92
|
-
- [Tool System](#-tool-system)
|
93
|
-
- [Web Interface](#-web-interface)
|
94
|
-
- [Examples](#-examples)
|
95
|
-
- [Development](#-development)
|
96
|
-
- [Contributing](#-contributing)
|
97
|
-
- [License](#-license)
|
98
|
-
- [Documentation Development](#-documentation-development)
|
99
|
-
|
100
|
-
## Release Notes
|
101
|
-
|
102
|
-
See our [Release Notes](RELEASE_NOTES.MD) for detailed version history and changes.
|
103
|
-
|
104
|
-
[TODO List](TODO.md)
|
105
|
-
|
106
|
-
## 📦 Installation
|
107
|
-
|
108
|
-
### Prerequisites
|
109
|
-
|
110
|
-
- Python 3.12+
|
111
|
-
- Docker (optional for code execution tools)
|
112
|
-
|
113
|
-
### Via pip
|
114
|
-
|
115
|
-
```bash
|
116
|
-
# Basic installation
|
117
|
-
pip install quantalogic
|
118
|
-
```
|
119
|
-
|
120
|
-
### From Source
|
121
|
-
|
122
|
-
```bash
|
123
|
-
git clone https://github.com/quantalogic/quantalogic.git
|
124
|
-
cd quantalogic
|
125
|
-
python -m venv .venv
|
126
|
-
source ./venv/bin/activate
|
127
|
-
poetry install
|
128
|
-
```
|
129
|
-
|
130
|
-
## Using pipx
|
131
|
-
|
132
|
-
```
|
133
|
-
pipx install quantalogic
|
134
|
-
```
|
135
|
-
|
136
|
-
|
137
|
-
## 🚀 Quickstart
|
138
|
-
|
139
|
-
### Basic Usage
|
140
|
-
|
141
|
-
## 📖 CLI Reference
|
142
|
-
|
143
|
-
The QuantaLogic CLI provides powerful command-line capabilities:
|
144
|
-
|
145
|
-
```bash
|
146
|
-
Usage: quantalogic [OPTIONS] COMMAND [ARGS]...
|
147
|
-
QuantaLogic AI Assistant - A powerful AI tool for various tasks.
|
148
|
-
|
149
|
-
Options:
|
150
|
-
--version Show version information.
|
151
|
-
--model-name TEXT Specify the model (litellm format, e.g., "openrouter/deepseek/deepseek-chat").
|
152
|
-
--log [info|debug|warning] Set logging level.
|
153
|
-
--verbose Enable verbose output.
|
154
|
-
--mode [code|basic|interpreter|full|code-basic|search|search-full] Agent mode.
|
155
|
-
--vision-model-name TEXT Specify the vision model (litellm format, e.g., "openrouter/A/gpt-4o-mini").
|
156
|
-
--max-iterations INTEGER Maximum iterations for task solving (default: 30).
|
157
|
-
--max-tokens-working-memory INTEGER Maximum tokens to keep in working memory (default: 4000).
|
158
|
-
--compact-every-n-iteration INTEGER Compact memory every N iterations (default: 5).
|
159
|
-
--help Show this message and exit.
|
160
|
-
|
161
|
-
Commands:
|
162
|
-
task Execute a task with the QuantaLogic AI Assistant.
|
163
|
-
```
|
164
|
-
|
165
|
-
### Commands
|
166
|
-
task Execute a task with the QuantaLogic AI Assistant
|
167
|
-
|
168
|
-
**Usage:** `quantalogic task [OPTIONS] [TASK]`
|
169
|
-
**Description:** Execute a task with the QuantaLogic AI Assistant.
|
170
|
-
**Options:**
|
171
|
-
- `--file PATH`: Path to task file.
|
172
|
-
- `--model-name TEXT`: Specify the model (litellm format, e.g., `openrouter/deepseek/deepseek-chat`).
|
173
|
-
- `--verbose`: Enable verbose output.
|
174
|
-
- `--mode [code|basic|interpreter|full|code-basic|search|search-full]`: Agent mode.
|
175
|
-
- `--log [info|debug|warning]`: Set logging level.
|
176
|
-
- `--vision-model-name TEXT`: Specify the vision model (litellm format).
|
177
|
-
- `--max-iterations INTEGER`: Maximum iterations for task solving (default: 30).
|
178
|
-
- `--max-tokens-working-memory INTEGER`: Maximum tokens to keep in working memory (default: 4000).
|
179
|
-
- `--compact-every-n-iteration INTEGER`: Compact memory every N iterations (default: 5).
|
180
|
-
- `--no-stream`: Disable streaming output (default: enabled).
|
181
|
-
- `--help`: Show this message and exit.
|
182
|
-
|
183
|
-
**Detailed Parameter Descriptions:**
|
184
|
-
|
185
|
-
- **--model-name**: Specifies the LLM model to use (e.g., "openrouter/deepseek/deepseek-chat")
|
186
|
-
- **--mode**: Selects agent capabilities:
|
187
|
-
- *code*: Coding-focused with basic capabilities
|
188
|
-
- *basic*: General-purpose without coding tools
|
189
|
-
- *interpreter*: Interactive code execution
|
190
|
-
- *full*: All capabilities enabled
|
191
|
-
- *code-basic*: Coding with basic reasoning
|
192
|
-
- *search*: Web search integration
|
193
|
-
- **--log**: Controls logging verbosity (info, debug, warning)
|
194
|
-
- **--vision-model-name**: Specifies vision model for image processing
|
195
|
-
- **--max-iterations**: Limits task-solving attempts (default: 30)
|
196
|
-
- **--max-tokens-working-memory**: Controls memory usage (default: None)
|
197
|
-
- **--compact-every-n-iteration**: Memory optimization frequency (default: None)
|
198
|
-
- **--no-stream**: Disables real-time output streaming
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
### Detailed Usage
|
203
|
-
|
204
|
-
#### Agent Modes
|
205
|
-
- code: Coding-focused agent with basic capabilities
|
206
|
-
- basic: General-purpose agent without coding tools
|
207
|
-
- interpreter: Interactive code execution agent
|
208
|
-
- full: Full-featured agent with all capabilities
|
209
|
-
- code-basic: Coding agent with basic reasoning
|
210
|
-
- search: Web search agent with Wikipedia, DuckDuckGo and SERPApi integration
|
211
|
-
|
212
|
-
#### Task Execution
|
213
|
-
|
214
|
-
Tasks can be provided:
|
215
|
-
|
216
|
-
1. Directly via `task` parameter
|
217
|
-
2. Through a file using --file parameter
|
218
|
-
3. Interactively via standard input
|
219
|
-
|
220
|
-
|
221
|
-
#### Examples
|
222
|
-
|
223
|
-
|
224
|
-
Using a task file:
|
225
|
-
```bash
|
226
|
-
quantalogic task --file tasks/example.md --verbose
|
227
|
-
```
|
228
|
-
|
229
|
-
Selecting agent mode:
|
230
|
-
```bash
|
231
|
-
quantalogic --mode interpreter task "Explain quantum computing"
|
232
|
-
```
|
233
|
-
|
234
|
-
Interactive mode:
|
235
|
-
```bash
|
236
|
-
quantalogic
|
237
|
-
```
|
238
|
-
|
239
|
-
### Using QuantaLogic With code
|
240
|
-
|
241
|
-
```python
|
242
|
-
from quantalogic import Agent
|
243
|
-
|
244
|
-
# Initialize agent with default configuration
|
245
|
-
agent = Agent(model_name="deepseek/deepseek-chat")
|
246
|
-
|
247
|
-
# Execute a task
|
248
|
-
result = agent.solve_task(
|
249
|
-
"Create a Python function that calculates the Fibonacci sequence"
|
250
|
-
)
|
251
|
-
print(result)
|
252
|
-
```
|
253
|
-
|
254
|
-
### Environment Configuration Example
|
255
|
-
|
256
|
-
```python
|
257
|
-
import os
|
258
|
-
|
259
|
-
from quantalogic import Agent
|
260
|
-
|
261
|
-
# Verify that DEEPSEEK_API_KEY is set
|
262
|
-
if not os.environ.get("DEEPSEEK_API_KEY"):
|
263
|
-
raise ValueError("DEEPSEEK_API_KEY environment variable is not set")
|
264
|
-
|
265
|
-
# Initialize the AI agent with default configuration
|
266
|
-
agent = Agent(model_name="deepseek/deepseek-chat")
|
267
|
-
|
268
|
-
# Execute a sample task
|
269
|
-
result = agent.solve_task("Create a Python function that calculates the Fibonacci sequence")
|
270
|
-
print(result)
|
271
|
-
```
|
272
|
-
|
273
|
-
## 📖 Examples
|
274
|
-
|
275
|
-
Watch how QuantaLogic can generate complete tutorials from simple prompts:
|
276
|
-
|
277
|
-
[](./examples/generated_tutorials/python/quantalogic_long.mp4)
|
278
|
-
|
279
|
-
Example prompt: [04-write-a-tutorial.md](./examples/tasks/04-write-a-tutorial.md)
|
280
|
-
|
281
|
-
Here are some practical examples to help you get started:
|
282
|
-
|
283
|
-
Here is the markdown table based on the provided directory listing:
|
284
|
-
|
285
|
-
| Example | Description | File |
|
286
|
-
|---------|-------------|------|
|
287
|
-
| Simple Agent | A basic example of an agent implementation. | [examples/01-simple-agent.py](examples/01-simple-agent.py) |
|
288
|
-
| Agent with Event Monitoring | An example of an agent with event monitoring capabilities. | [examples/02-agent-with-event-monitoring.py](examples/02-agent-with-event-monitoring.py) |
|
289
|
-
| Agent with Interpreter | An example of an agent that includes an interpreter. | [examples/03-agent-with-interpreter.py](examples/03-agent-with-interpreter.py) |
|
290
|
-
| Agent Summary Task | An example of an agent performing a summary task. | [examples/04-agent-summary-task.py](examples/04-agent-summary-task.py) |
|
291
|
-
| Code Example | A general code example. | [examples/05-code.py](examples/05-code.py) |
|
292
|
-
|
293
|
-
|
294
|
-
## 🔨 Key Components
|
295
|
-
|
296
|
-
### Agent System
|
297
|
-
|
298
|
-
The core agent implements the `ReAct`paradigm, combining:
|
299
|
-
|
300
|
-
- Language model reasoning
|
301
|
-
- Tool execution capabilities
|
302
|
-
- Memory management
|
303
|
-
- Event handling
|
304
|
-
- Task validation
|
305
|
-
|
306
|
-
```python
|
307
|
-
from quantalogic import Agent
|
308
|
-
from quantalogic.tools import PythonTool, ReadFileTool
|
309
|
-
|
310
|
-
# Create agent with specific tools
|
311
|
-
agent = Agent(
|
312
|
-
model_name="openrouter/deepseek/deepseek-chat",
|
313
|
-
tools=[
|
314
|
-
PythonTool(),
|
315
|
-
ReadFileTool()
|
316
|
-
]
|
317
|
-
)
|
318
|
-
|
319
|
-
```
|
320
|
-
|
321
|
-
### How it works
|
322
|
-
|
323
|
-
|
324
|
-
The ReAct (Reasoning & Action) framework represents a significant advancement in the development of intelligent agents capable of autonomously reasoning through tasks and taking appropriate actions.
|
325
|
-
|
326
|
-
QuantaLogic implements this framework, allowing integration with large language models (LLMs) to construct sophisticated agents that can tackle complex problems through natural language interaction.
|
327
|
-
|
328
|
-
## What is a ReAct Agent?
|
329
|
-
|
330
|
-
### Basic Concept
|
331
|
-
|
332
|
-
A ReAct agent utilizes the synergy of reasoning and action. It not only processes natural language inputs but also executes actions in response to these inputs, utilizing various available tools. This functionality is particularly beneficial for environments where complex tasks can be decomposed into manageable subtasks.
|
333
|
-
|
334
|
-
### The QuantaLogic Implementation
|
335
|
-
|
336
|
-
QuantaLogic provides an effective implementation of the ReAct framework with several core components:
|
337
|
-
|
338
|
-
- **Generative Model**: This serves as the agent's brain, enabling it to interpret tasks and generate human-like text responses.
|
339
|
-
- **Memory Management**: This capability allows the agent to maintain context, keeping track of previous inputs and interactions to provide coherent responses.
|
340
|
-
- **Tool Management**: The agent has access to a diverse range of tools, enabling it to perform actions such as code execution, file manipulation, and API communication.
|
341
|
-
|
342
|
-
## How the ReAct Framework Works
|
343
|
-
|
344
|
-
### Workflow of a ReAct Agent
|
345
|
-
|
346
|
-
The following state diagram shows the core workflow of a QuantaLogic agent:
|
347
|
-
|
348
|
-
```mermaid
|
349
|
-
stateDiagram-v2
|
350
|
-
[*] --> InitializeAgent
|
351
|
-
InitializeAgent --> Idle: Agent Initialized
|
352
|
-
|
353
|
-
state Idle {
|
354
|
-
[*] --> WaitForTask
|
355
|
-
WaitForTask --> SolveTask: Task Received
|
356
|
-
}
|
357
|
-
|
358
|
-
state SolveTask {
|
359
|
-
[*] --> ResetSession
|
360
|
-
ResetSession --> AddSystemPrompt
|
361
|
-
AddSystemPrompt --> PreparePrompt
|
362
|
-
PreparePrompt --> EmitTaskStartEvent
|
363
|
-
EmitTaskStartEvent --> UpdateTokens
|
364
|
-
UpdateTokens --> CompactMemoryIfNeeded
|
365
|
-
CompactMemoryIfNeeded --> GenerateResponse
|
366
|
-
GenerateResponse --> ObserveResponse
|
367
|
-
ObserveResponse --> CheckToolExecution
|
368
|
-
CheckToolExecution --> TaskComplete: Tool Executed (task_complete)
|
369
|
-
CheckToolExecution --> UpdatePrompt: Tool Not Executed
|
370
|
-
UpdatePrompt --> UpdateTokens
|
371
|
-
TaskComplete --> EmitTaskCompleteEvent
|
372
|
-
EmitTaskCompleteEvent --> [*]
|
373
|
-
}
|
374
|
-
|
375
|
-
state CompactMemoryIfNeeded {
|
376
|
-
[*] --> CheckMemoryOccupancy
|
377
|
-
CheckMemoryOccupancy --> CompactMemory: Memory Occupancy > MAX_OCCUPANCY
|
378
|
-
CheckMemoryOccupancy --> [*]: Memory Occupancy <= MAX_OCCUPANCY
|
379
|
-
CompactMemory --> [*]
|
380
|
-
}
|
381
|
-
|
382
|
-
state ObserveResponse {
|
383
|
-
[*] --> ProcessResponse
|
384
|
-
ProcessResponse --> ExecuteTool: Tool Identified
|
385
|
-
ProcessResponse --> UpdateAnswer: No Tool Identified
|
386
|
-
ExecuteTool --> UpdateAnswer
|
387
|
-
UpdateAnswer --> [*]
|
388
|
-
}
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
Idle --> [*]: Task Completed
|
393
|
-
SolveTask --> Idle: Task Completed
|
394
|
-
```
|
395
|
-
|
396
|
-
The following sequence diagram illustrates the workflow of a ReAct agent as it processes and solves a task:
|
397
|
-
|
398
|
-
```mermaid
|
399
|
-
sequenceDiagram
|
400
|
-
participant User
|
401
|
-
participant Agent
|
402
|
-
participant ToolManager
|
403
|
-
participant Memory
|
404
|
-
|
405
|
-
User->>Agent: Submit task
|
406
|
-
Agent->>Memory: Store task details
|
407
|
-
Agent->>ToolManager: Retrieve tools
|
408
|
-
ToolManager-->>Agent: Provide available tools
|
409
|
-
Agent->>Agent: Prepare prompt for task
|
410
|
-
Agent->>Agent: Analyze input and generate response
|
411
|
-
Agent->>ToolManager: Execute required tool
|
412
|
-
ToolManager-->>Agent: Return tool execution result
|
413
|
-
Agent->>User: Present final result
|
414
|
-
```
|
415
|
-
|
416
|
-
### Key Components Explained
|
417
|
-
|
418
|
-
1. **User Input**: The agent begins by receiving a task or question from the user, which initiates the interaction.
|
419
|
-
2. **Memory Management**: Before tackling the task, the agent logs relevant task details into its memory, ensuring it has the necessary context for processing.
|
420
|
-
3. **Tool Retrieval**: The agent communicates with the ToolManager to inquire about available tools that can facilitate the required actions.
|
421
|
-
4. **Prompt Generation**: The agent constructs a prompt that outlines the task specifics, available tools, and any other pertinent context information.
|
422
|
-
5. **Analysis and Response Generation**: The agent uses its generative model to analyze the task input and formulate a response.
|
423
|
-
6. **Tool Execution**: If certain tools are needed for the task, the agent instructs the ToolManager to execute those tools, fetching the results for processing.
|
424
|
-
7. **Output to User**: Finally, the agent compiles and presents the results back to the user.
|
425
|
-
|
426
|
-
### Tool System
|
427
|
-
|
428
|
-
The QuantaLogic framework incorporates a well-defined tool system that enhances the functionality of AI agents by enabling them to perform a variety of tasks efficiently. Each tool is designed to address specific needs that arise in the context of complex problem-solving and task execution:
|
429
|
-
|
430
|
-
1. **Core Functionality**: Tools such as **AgentTool** and **LLMTool** are fundamental to the agent's operation, allowing it to manage tasks and interact with large language models. The integration of these tools enables the agent to process natural language inputs and execute corresponding actions effectively. **AgentTool** enables the agent to delegate tasks to specialized agents, and **LLMTool** provides the agent to explore a specific area of a latent space using role play.
|
431
|
-
|
432
|
-
2. **Code Execution**: Tools like **PythonTool**, **NodeJsTool**, and **ElixirTool** are vital for executing code in different programming languages. This capability allows the agent to handle programming tasks directly, facilitating real-time coding assistance and code evaluation.
|
433
|
-
|
434
|
-
3. **File Operations**: The framework includes tools for file management, such as **ReadFileTool**, **WriteFileTool**, and **ReplaceInFileTool**. These tools are essential for enabling the agent to read from and write to files, as well as update file content dynamically. This functionality supports scenarios where agents need to manipulate data or configuration files as part of the task execution process.
|
435
|
-
|
436
|
-
4. **Search Capabilities**: Tools like **RipgrepTool** and **SearchDefinitionNames** enhance the agent's ability to search through codebases and identify relevant definitions. This is crucial when dealing with large volumes of code, allowing the agent to quickly locate information necessary for problem-solving.
|
437
|
-
|
438
|
-
5. **Utility Functions**: Additional tools such as **DownloadHttpFileTool**, **ListDirectoryTool**, and **ExecuteBashCommandTool** provide broader functionality that supports various tasks, from fetching external resources to executing system commands. These utilities expand the operational scope of agents, allowing them to perform diverse actions beyond simple text processing.
|
439
|
-
|
440
|
-
6. **Documentation and Representation**: Tools like **MarkitdownTool** facilitate the generation of documentation, ensuring that output from the agent can be formatted and presented clearly. This is particularly beneficial for creating reports or guides based on the agent's findings and actions.
|
441
|
-
|
442
|
-
By integrating these tools into its architecture, QuantaLogic allows agents to perform a wide range of tasks autonomously while ensuring that they have the necessary resources and capabilities to do so effectively. This tool system is fundamental to the agent's ability to reason and act in sophisticated ways, thereby enhancing the overall utility of the framework in complex scenarios.
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
### Tools Documentation
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
#### Overview of Tools
|
451
|
-
|
452
|
-
| Category | Tools |
|
453
|
-
|-----------------------|---------------------------------------------------------------------------------------------------|
|
454
|
-
| 1. Search Tools | 1.1 SerpAPI Search Tool, 1.2 Wikipedia Search Tool |
|
455
|
-
| 2. Task Automation | Agent Tool, Task Complete Tool, Input Question Tool, Execute Bash Command Tool |
|
456
|
-
| 3. Script Execution | Python Tool, Node.js Tool, Elixir Tool |
|
457
|
-
| 4. File Operations | Read File Tool, Write File Tool, Edit Whole Content Tool, Replace In File Tool |
|
458
|
-
| 5. Code Analysis | Search Definition Names Tool, Ripgrep Tool |
|
459
|
-
| 6. Content Generation | LLM Tool, LLMVisionTool |
|
460
|
-
| 7. Utility & Management| Download HTTP File Tool, List Directory Tool, Markitdown Tool, Unified Diff Tool |
|
461
|
-
|
462
|
-
---
|
463
|
-
|
464
|
-
#### 1. Agent Tool
|
465
|
-
|
466
|
-
The **Agent Tool** enables task delegation to another agent, providing specialized functionality for handling tasks.
|
467
|
-
|
468
|
-
##### Parameters
|
469
|
-
|
470
|
-
| Parameter | Type | Description | Example |
|
471
|
-
|--------------|--------|-------------------------------------------------------------------------------------|---------------------------------|
|
472
|
-
| `agent_role` | string | The role of the agent (e.g., expert, assistant) | `expert` |
|
473
|
-
| `agent` | Any | The agent to delegate tasks to | `Agent` object |
|
474
|
-
| `task` | string | The task to delegate to the specified agent. | `Summarize the latest news.` |
|
475
|
-
|
476
|
-
##### Example Usage
|
477
|
-
```python
|
478
|
-
agent_tool = AgentTool(agent_role="expert", agent=some_agent)
|
479
|
-
result = agent_tool.execute(task="Summarize the latest news.")
|
480
|
-
print(result)
|
481
|
-
```
|
482
|
-
|
483
|
-
---
|
484
|
-
|
485
|
-
#### 2. Task Complete Tool
|
486
|
-
|
487
|
-
The **Task Complete Tool** is used to respond to users after a task has been completed.
|
488
|
-
|
489
|
-
##### Parameters
|
490
|
-
|
491
|
-
| Parameter | Type | Description | Example |
|
492
|
-
|-----------|--------|-------------------------------------------------|--------------------------------------|
|
493
|
-
| `answer` | string | The answer to the user. | `"The answer to the meaning of life"`|
|
494
|
-
|
495
|
-
##### Example Usage
|
496
|
-
```python
|
497
|
-
task_tool = TaskCompleteTool()
|
498
|
-
response = task_tool.execute(answer="The answer is 42.")
|
499
|
-
print(response)
|
500
|
-
```
|
501
|
-
|
502
|
-
---
|
503
|
-
|
504
|
-
#### 3. Input Question Tool
|
505
|
-
|
506
|
-
The **Input Question Tool** prompts the user with a question and captures their input.
|
507
|
-
|
508
|
-
##### Parameters
|
509
|
-
|
510
|
-
| Parameter | Type | Description | Example |
|
511
|
-
|-----------|--------|-----------------------------------------------------|-------------------------------|
|
512
|
-
| `question`| string | The question to ask the user. | `What is your favorite color?`|
|
513
|
-
| `default` | string | Optional default value if no input is provided. | `blue` |
|
514
|
-
|
515
|
-
##### Example Usage
|
516
|
-
```python
|
517
|
-
input_tool = InputQuestionTool()
|
518
|
-
user_response = input_tool.execute(question="What is your favorite color?", default="blue")
|
519
|
-
print("User Response:", user_response)
|
520
|
-
```
|
521
|
-
|
522
|
-
---
|
523
|
-
|
524
|
-
#### 4. Execute Bash Command Tool
|
525
|
-
|
526
|
-
The **Execute Bash Command Tool** allows for the execution of bash commands and captures their output.
|
527
|
-
|
528
|
-
##### Parameters
|
529
|
-
|
530
|
-
| Parameter | Type | Description | Example |
|
531
|
-
|-----------------|---------|----------------------------------------------------------------------|---------------------------|
|
532
|
-
| `command` | string | The bash command to execute. | `ls -la` |
|
533
|
-
| `working_dir` | string | The working directory where the command will be executed. | `/path/to/directory` |
|
534
|
-
| `timeout` | int | Maximum time in seconds to wait for the command to complete. | `60` |
|
535
|
-
|
536
|
-
##### Example Usage
|
537
|
-
```python
|
538
|
-
bash_tool = ExecuteBashCommandTool()
|
539
|
-
output = bash_tool.execute(command="ls -la")
|
540
|
-
print(output)
|
541
|
-
```
|
542
|
-
|
543
|
-
---
|
544
|
-
|
545
|
-
#### 5. Python Tool
|
546
|
-
|
547
|
-
The **Python Tool** executes Python scripts in an isolated Docker environment.
|
548
|
-
|
549
|
-
##### Parameters
|
550
|
-
|
551
|
-
| Parameter | Type | Description | Example |
|
552
|
-
|-------------------|---------|------------------------------------------------------------------------------------|--------------------------------------------|
|
553
|
-
| `install_commands` | string | Commands to install Python packages before running the script. | `pip install rich requests` |
|
554
|
-
| `script` | string | The Python script to execute. | `print("Hello, World!")` |
|
555
|
-
| `version` | string | The Python version to use in the Docker container. | `3.11` |
|
556
|
-
| `host_dir` | string | The absolute path on the host machine to mount for file access. | `./demo01/` |
|
557
|
-
| `memory_limit` | string | Optional memory limit for the Docker container. | `1g` |
|
558
|
-
| `environment_vars`| string | Environment variables to set inside the Docker container. | `ENV=production DEBUG=False` |
|
559
|
-
|
560
|
-
#### Example Usage
|
561
|
-
```python
|
562
|
-
python_tool = PythonTool()
|
563
|
-
output = python_tool.execute(
|
564
|
-
install_commands="pip install rich requests",
|
565
|
-
script='print("Hello, World!")',
|
566
|
-
version="3.12",
|
567
|
-
host_dir="./demo01/",
|
568
|
-
)
|
569
|
-
print("Script Output:", output)
|
570
|
-
```
|
571
|
-
|
572
|
-
---
|
573
|
-
|
574
|
-
### 6. Node.js Tool
|
575
|
-
|
576
|
-
The **Node.js Tool** executes Node.js scripts in an isolated Docker environment.
|
577
|
-
|
578
|
-
#### Parameters
|
579
|
-
|
580
|
-
| Parameter | Type | Description | Example |
|
581
|
-
|-------------------|---------|-------------------------------------------------------------------------------|--------------------------------------------|
|
582
|
-
| `install_commands`| string | Commands to install Node.js packages before running the script. | `npm install chalk` |
|
583
|
-
| `script` | string | The Node.js script to execute. | `console.log('Hello, World!');` |
|
584
|
-
| `version` | string | The Node.js version to use in the Docker container. | `20` |
|
585
|
-
| `host_dir` | string | The absolute path on the host machine to mount for file access. | `./project/` |
|
586
|
-
| `memory_limit` | string | Optional memory limit for the Docker container. | `1g` |
|
587
|
-
| `module_type` | string | The module system to use: 'esm' for ECMAScript Modules or 'commonjs' for CommonJS. | `esm` |
|
588
|
-
|
589
|
-
#### Example Usage
|
590
|
-
```python
|
591
|
-
node_tool = NodeJsTool()
|
592
|
-
output = node_tool.execute(
|
593
|
-
install_commands="npm install chalk",
|
594
|
-
script='console.log("Hello, Node.js World!");',
|
595
|
-
version="20",
|
596
|
-
host_dir="./project/"
|
597
|
-
)
|
598
|
-
print("Node.js Output:", output)
|
599
|
-
```
|
600
|
-
|
601
|
-
---
|
602
|
-
|
603
|
-
### 7. Elixir Tool
|
604
|
-
|
605
|
-
The **Elixir Tool** executes Elixir code in an isolated Docker environment with Mix support.
|
606
|
-
|
607
|
-
#### Parameters
|
608
|
-
|
609
|
-
| Parameter | Type | Description | Example |
|
610
|
-
|------------------|---------|-----------------------------------------------------------------------------|-------------------------------------------|
|
611
|
-
| `mix_commands` | string | Mix commands to run before executing the script. | `mix deps.get && mix compile` |
|
612
|
-
| `script` | string | Elixir code to execute. | `IO.puts("Hello from Elixir!")` |
|
613
|
-
| `version` | string | The Elixir version to use. | `1.15` |
|
614
|
-
| `host_dir` | string | Host directory to mount. | `./elixir_project/` |
|
615
|
-
| `memory_limit` | string | Container memory limit. | `512m` |
|
616
|
-
| `environment_vars`| string | Environment variables to set. | `MIX_ENV=prod` |
|
617
|
-
|
618
|
-
#### Example Usage
|
619
|
-
```python
|
620
|
-
elixir_tool = ElixirTool()
|
621
|
-
output = elixir_tool.execute(script='IO.puts("Hello from Elixir!")')
|
622
|
-
print("Elixir Output:", output)
|
623
|
-
```
|
624
|
-
|
625
|
-
---
|
626
|
-
|
627
|
-
### 8. Read File Tool
|
628
|
-
|
629
|
-
The **Read File Tool** reads content from a specified file.
|
630
|
-
|
631
|
-
#### Parameters
|
632
|
-
|
633
|
-
| Parameter | Type | Description | Example |
|
634
|
-
|--------------|--------|-------------------------------------------------|--------------------------------------|
|
635
|
-
| `file_path` | string | The path of the file to read. | `/path/to/file.txt` |
|
636
|
-
|
637
|
-
#### Example Usage
|
638
|
-
```python
|
639
|
-
read_tool = ReadFileTool()
|
640
|
-
content = read_tool.execute(file_path="/path/to/file.txt")
|
641
|
-
print("File Content:", content)
|
642
|
-
```
|
643
|
-
|
644
|
-
---
|
645
|
-
|
646
|
-
### 9. Write File Tool
|
647
|
-
|
648
|
-
The **Write File Tool** writes content to a specified file.
|
649
|
-
|
650
|
-
#### Parameters
|
651
|
-
|
652
|
-
| Parameter | Type | Description | Example |
|
653
|
-
|-------------|--------|-------------------------------------------------|--------------------------------------|
|
654
|
-
| `file_path` | string | The path of the file to write to. | `/path/to/file.txt` |
|
655
|
-
| `content` | string | The content to write. | `Hello, World!` |
|
656
|
-
|
657
|
-
#### Example Usage
|
658
|
-
```python
|
659
|
-
write_tool = WriteFileTool()
|
660
|
-
result = write_tool.execute(file_path="/path/to/file.txt", content="Hello, World!")
|
661
|
-
print(result)
|
662
|
-
```
|
663
|
-
|
664
|
-
---
|
665
|
-
|
666
|
-
### 10. Edit Whole Content Tool
|
667
|
-
|
668
|
-
The **Edit Whole Content Tool** replaces the entire content of a specified file.
|
669
|
-
|
670
|
-
#### Parameters
|
671
|
-
|
672
|
-
| Parameter | Type | Description | Example |
|
673
|
-
|-------------|--------|-------------------------------------------------|--------------------------------------|
|
674
|
-
| `file_path` | string | The path to the file to edit. | `/path/to/file.txt` |
|
675
|
-
| `content` | string | The new content to write to the file. | `New Content Here!` |
|
676
|
-
|
677
|
-
#### Example Usage
|
678
|
-
```python
|
679
|
-
edit_tool = EditWholeContentTool()
|
680
|
-
result = edit_tool.execute(file_path="/path/to/file.txt", content="New Content Here!")
|
681
|
-
print(result)
|
682
|
-
```
|
683
|
-
|
684
|
-
---
|
685
|
-
|
686
|
-
### 11. Replace In File Tool
|
687
|
-
|
688
|
-
The **Replace In File Tool** replaces specific content in a file with new content.
|
689
|
-
|
690
|
-
#### Parameters
|
691
|
-
|
692
|
-
| Parameter | Type | Description | Example |
|
693
|
-
|-------------|--------|-------------------------------------------------|--------------------------------------|
|
694
|
-
| `file_path` | string | The path of the file to edit. | `/path/to/file.txt` |
|
695
|
-
| `search` | string | The string to search for in the file. | `Old Content` |
|
696
|
-
| `replace` | string | The string to replace the searched content. | `New Content` |
|
697
|
-
|
698
|
-
#### Example Usage
|
699
|
-
```python
|
700
|
-
replace_tool = ReplaceInFileTool()
|
701
|
-
result = replace_tool.execute(file_path="/path/to/file.txt", search="Old Content", replace="New Content")
|
702
|
-
print(result)
|
703
|
-
```
|
704
|
-
|
705
|
-
---
|
706
|
-
|
707
|
-
### 12. Search Definition Names Tool
|
708
|
-
|
709
|
-
The **Search Definition Names Tool** searches for definition names in a directory using Tree-sitter.
|
710
|
-
|
711
|
-
#### Parameters
|
712
|
-
|
713
|
-
| Parameter | Type | Description | Example |
|
714
|
-
|----------------|--------|-----------------------------------------------------------|-------------------------------|
|
715
|
-
| `directory_path`| string | The path to the directory to search in. | `./path/to` |
|
716
|
-
| `language_name`| string | The Tree-sitter language name (python, js, etc.). | `python` |
|
717
|
-
| `file_pattern` | string | Optional glob pattern to filter files (default: '*'). | `**/*.py` |
|
718
|
-
|
719
|
-
#### Example Usage
|
720
|
-
```python
|
721
|
-
search_tool = SearchDefinitionNames()
|
722
|
-
results = search_tool.execute(directory_path="./my_project", language_name="python", file_pattern="**/*.py")
|
723
|
-
print("Found Definitions:", results)
|
724
|
-
```
|
725
|
-
|
726
|
-
---
|
727
|
-
|
728
|
-
### 13. Ripgrep Tool
|
729
|
-
|
730
|
-
The **Ripgrep Tool** searches for text blocks in files using ripgrep.
|
731
|
-
|
732
|
-
#### Parameters
|
733
|
-
|
734
|
-
| Parameter | Type | Description | Example |
|
735
|
-
|------------------|---------|------------------------------------------------------------------------------|-------------------------------|
|
736
|
-
| `cwd` | string | Base path for relative searches | `.` |
|
737
|
-
| `directory_path` | string | The directory path to search in. | `./src` |
|
738
|
-
| `regex_rust_syntax`| string| The regex pattern to search for (in Rust syntax). | `r"\bfunction\b"` |
|
739
|
-
| `file_pattern` | string | Optional glob pattern to filter files. | `**/*.js` |
|
740
|
-
| `context_lines` | string | Number of context lines to include before and after matches. | `2` |
|
741
|
-
|
742
|
-
#### Example Usage
|
743
|
-
```python
|
744
|
-
ripgrep_tool = RipgrepTool()
|
745
|
-
output = ripgrep_tool.execute(
|
746
|
-
directory_path="./my_project",
|
747
|
-
regex_rust_syntax=r"\bfunction\b",
|
748
|
-
context_lines="2"
|
749
|
-
)
|
750
|
-
print("Ripgrep Results:", output)
|
751
|
-
```
|
752
|
-
|
753
|
-
---
|
754
|
-
|
755
|
-
#### 14. LLMVisionTool
|
756
|
-
|
757
|
-
The **LLMVisionTool** enables processing of visual inputs using vision-language models.
|
758
|
-
|
759
|
-
##### Parameters
|
760
|
-
|
761
|
-
| Parameter | Type | Description | Example |
|
762
|
-
|----------------|---------|------------------------------------------------------------------------|--------------------------------------------|
|
763
|
-
| `image_path` | string | Path to the image file to process | `./path/to/image.png` |
|
764
|
-
| `prompt` | string | The question or instruction for the vision model | `Describe the contents of this image` |
|
765
|
-
| `temperature` | float | Sampling temperature between 0.0 and 1.0 | `0.7` |
|
766
|
-
|
767
|
-
##### Example Usage
|
768
|
-
```python
|
769
|
-
vision_tool = LLMVisionTool()
|
770
|
-
response = vision_tool.execute(
|
771
|
-
image_path="./path/to/image.png",
|
772
|
-
prompt="Describe the contents of this image",
|
773
|
-
temperature=0.7
|
774
|
-
)
|
775
|
-
print("Vision Model Response:", response)
|
776
|
-
```
|
777
|
-
|
778
|
-
#### 15. LLM Tool
|
779
|
-
|
780
|
-
The **LLM Tool** generates answers using a specified language model.
|
781
|
-
|
782
|
-
#### Parameters
|
783
|
-
|
784
|
-
| Parameter | Type | Description | Example |
|
785
|
-
|----------------|---------|------------------------------------------------------------------------|--------------------------------------------|
|
786
|
-
| `system_prompt`| string | The persona or system prompt to guide the language model's behavior. | `You are a helpful assistant.` |
|
787
|
-
| `prompt` | string | The question to ask the language model. | `What is the meaning of life?` |
|
788
|
-
| `temperature` | string | Sampling temperature between 0.0 and 1.0. | `0.5` |
|
789
|
-
|
790
|
-
#### Example Usage
|
791
|
-
```python
|
792
|
-
llm_tool = LLMTool(model_name="gpt-4")
|
793
|
-
response = llm_tool.execute(
|
794
|
-
system_prompt="You are a knowledgeable assistant.",
|
795
|
-
prompt="What is the meaning of life?",
|
796
|
-
temperature="0.7"
|
797
|
-
)
|
798
|
-
print("LLM Response:", response)
|
799
|
-
```
|
800
|
-
|
801
|
-
---
|
802
|
-
|
803
|
-
### 16. Download HTTP File Tool
|
804
|
-
|
805
|
-
The **Download HTTP File Tool** downloads a file from a specified HTTP URL.
|
806
|
-
|
807
|
-
#### Parameters
|
808
|
-
|
809
|
-
| Parameter | Type | Description | Example |
|
810
|
-
|---------------|--------|------------------------------------------------|------------------------------------|
|
811
|
-
| `url` | string | The URL of the file to download. | `http://example.com/file.txt` |
|
812
|
-
| `destination` | string | The path where the file should be saved. | `/path/to/save/file.txt` |
|
813
|
-
|
814
|
-
#### Example Usage
|
815
|
-
```python
|
816
|
-
download_tool = DownloadHttpFileTool()
|
817
|
-
result = download_tool.execute(url="http://example.com/file.txt", destination="/path/to/save/file.txt")
|
818
|
-
print(result)
|
819
|
-
```
|
820
|
-
|
821
|
-
---
|
822
|
-
|
823
|
-
### 17. List Directory Tool
|
824
|
-
|
825
|
-
The **List Directory Tool** lists files in a specified directory.
|
826
|
-
|
827
|
-
#### Parameters
|
828
|
-
|
829
|
-
| Parameter | Type | Description | Example |
|
830
|
-
|------------------|---------|------------------------------------------------|------------------------|
|
831
|
-
| `directory_path` | string | The path of the directory to list files from. | `./path/to/directory` |
|
832
|
-
|
833
|
-
#### Example Usage
|
834
|
-
```python
|
835
|
-
list_tool = ListDirectoryTool()
|
836
|
-
result = list_tool.execute(directory_path="./path/to/directory")
|
837
|
-
print("Directory Files:", result)
|
838
|
-
```
|
839
|
-
|
840
|
-
---
|
841
|
-
|
842
|
-
### 18. Markitdown Tool
|
843
|
-
|
844
|
-
The **Markitdown Tool** processes markdown files, possibly for conversion or rendering.
|
845
|
-
|
846
|
-
#### Parameters
|
847
|
-
|
848
|
-
| Parameter | Type | Description | Example |
|
849
|
-
|------------------|---------|------------------------------------------------|------------------------|
|
850
|
-
| `markdown_path` | string | The path of the markdown file to process. | `./path/to/file.md` |
|
851
|
-
|
852
|
-
#### Example Usage
|
853
|
-
```python
|
854
|
-
markitdown_tool = MarkitdownTool()
|
855
|
-
result = markitdown_tool.execute(markdown_path="./path/to/file.md")
|
856
|
-
print("Processed Markdown Output:", result)
|
857
|
-
```
|
858
|
-
|
859
|
-
---
|
860
|
-
|
861
|
-
### 19. SerpAPI Search Tool
|
862
|
-
|
863
|
-
The **SerpAPI Search Tool** allows agents to perform web searches using the SerpAPI service.
|
864
|
-
|
865
|
-
##### Parameters
|
866
|
-
| Parameter | Type | Description | Example |
|
867
|
-
|-----------|--------|---------------------------------|-----------------------------|
|
868
|
-
| query | string | The search query to execute | "latest AI research papers" |
|
869
|
-
| location | string | Geographic location for results | "United States" |
|
870
|
-
| num | int | Number of results to return | 5 |
|
871
|
-
|
872
|
-
##### Example Usage
|
873
|
-
```python
|
874
|
-
from quantalogic.tools import SerpAPISearchTool
|
875
|
-
|
876
|
-
search_tool = SerpAPISearchTool()
|
877
|
-
results = search_tool.execute(query="latest AI research", location="United States", num=5)
|
878
|
-
print(results)
|
879
|
-
```
|
880
|
-
|
881
|
-
---
|
882
|
-
|
883
|
-
### 20. Wikipedia Search Tool
|
884
|
-
|
885
|
-
The **Wikipedia Search Tool** enables agents to search and retrieve information from Wikipedia.
|
886
|
-
|
887
|
-
##### Parameters
|
888
|
-
|
889
|
-
| Parameter | Type | Description | Example |
|
890
|
-
|-----------|--------|---------------------------------|-----------------------------|
|
891
|
-
| query | string | The search query to execute | "Artificial Intelligence" |
|
892
|
-
| lang | string | Language code for results | "en" |
|
893
|
-
| sentences | int | Number of summary sentences | 3 |
|
894
|
-
|
895
|
-
##### Example Usage
|
896
|
-
```python
|
897
|
-
from quantalogic.tools import WikipediaSearchTool
|
898
|
-
|
899
|
-
wiki_tool = WikipediaSearchTool()
|
900
|
-
results = wiki_tool.execute(query="Artificial Intelligence", lang="en", sentences=3)
|
901
|
-
print(results)
|
902
|
-
```
|
903
|
-
```
|
904
|
-
|
905
|
-
```
|
906
|
-
### Project Documentation
|
907
|
-
|
908
|
-
```python
|
909
|
-
from quantalogic import Agent
|
910
|
-
from quantalogic.tools import MarkitdownTool, ReadFileTool
|
911
|
-
|
912
|
-
agent = Agent(
|
913
|
-
model_name="openrouter/deepseek/deepseek-chat",
|
914
|
-
tools=[MarkitdownTool(), ReadFileTool()]
|
915
|
-
)
|
916
|
-
|
917
|
-
result = agent.solve_task("""
|
918
|
-
Generate a comprehensive documentation for:
|
919
|
-
|
920
|
-
1. Navigate and Read https://api.nasa.gov/ documentation
|
921
|
-
2. Write an API reference for https://api.nasa.gov/
|
922
|
-
2. Examples how to use the API using curl
|
923
|
-
3. Examples how to use the API from Python
|
924
|
-
""")
|
925
|
-
```
|
926
|
-
|
927
|
-
|
928
|
-
## 🔧 Development
|
929
|
-
|
930
|
-
### Setup Development Environment
|
931
|
-
|
932
|
-
```bash
|
933
|
-
# Clone repository
|
934
|
-
git clone https://github.com/quantalogic/quantalogic.git
|
935
|
-
cd quantalogic
|
936
|
-
|
937
|
-
# Create virtual environment
|
938
|
-
python -m venv venv
|
939
|
-
source venv/bin/activate # Windows: venv\Scripts\activate
|
940
|
-
|
941
|
-
# Install dependencies
|
942
|
-
poetry install
|
943
|
-
|
944
|
-
```
|
945
|
-
|
946
|
-
### Run Tests
|
947
|
-
|
948
|
-
```bash
|
949
|
-
# Run all tests
|
950
|
-
pytest
|
951
|
-
|
952
|
-
# With coverage
|
953
|
-
pytest --cov=quantalogic
|
954
|
-
|
955
|
-
# Run specific tests
|
956
|
-
pytest tests/unit
|
957
|
-
```
|
958
|
-
|
959
|
-
### Code Quality
|
960
|
-
|
961
|
-
```bash
|
962
|
-
# Format code
|
963
|
-
ruff format
|
964
|
-
|
965
|
-
# Type checking
|
966
|
-
mypy quantalogic
|
967
|
-
|
968
|
-
# Linting
|
969
|
-
ruff check quantalogic
|
970
|
-
```
|
971
|
-
|
972
|
-
## 🤝 Contributing
|
973
|
-
|
974
|
-
1. Fork the repository
|
975
|
-
2. Create a feature branch
|
976
|
-
3. Write tests
|
977
|
-
4. Implement changes
|
978
|
-
5. Submit pull request
|
979
|
-
|
980
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
|
981
|
-
|
982
|
-
## 📄 License
|
983
|
-
|
984
|
-
Copyright 2024 QuantaLogic Contributors
|
985
|
-
|
986
|
-
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
987
|
-
|
988
|
-
## Project Growth
|
989
|
-
[](https://star-history.com/#quantalogic/quantalogic&Date)
|
990
|
-
|
991
|
-
Initiated with ❤️ by Raphaël MANSUY. Founder of [Quantalogic](https://www.quantalogic.app).
|
992
|
-
|