quantalogic 0.2.7__tar.gz → 0.2.10__tar.gz
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-0.2.7 → quantalogic-0.2.10}/PKG-INFO +58 -89
- {quantalogic-0.2.7 → quantalogic-0.2.10}/README.md +57 -88
- {quantalogic-0.2.7 → quantalogic-0.2.10}/pyproject.toml +1 -1
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/agent.py +35 -2
- quantalogic-0.2.10/quantalogic/agent_config.py +169 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/coding_agent.py +6 -1
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/generative_model.py +63 -12
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/main.py +62 -18
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/prompts.py +15 -21
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/__init__.py +2 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/llm_tool.py +2 -2
- quantalogic-0.2.10/quantalogic/tools/llm_vision_tool.py +140 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/version.py +1 -1
- quantalogic-0.2.7/quantalogic/agent_config.py +0 -136
- {quantalogic-0.2.7 → quantalogic-0.2.10}/LICENSE +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/__init__.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/event_emitter.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/interactive_text_editor.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/memory.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/model_names.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/print_event.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/server/__init__.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/server/agent_server.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/server/models.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/server/routes.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/server/state.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/server/static/js/event_visualizer.js +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/server/static/js/quantalogic.js +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/server/templates/index.html +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tool_manager.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/agent_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/download_http_file_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/edit_whole_content_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/elixir_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/execute_bash_command_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/input_question_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/__init__.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/c_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/cpp_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/go_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/java_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/javascript_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/python_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/rust_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/scala_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/language_handlers/typescript_handler.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/list_directory_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/markitdown_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/nodejs_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/python_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/read_file_block_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/read_file_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/replace_in_file_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/ripgrep_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/search_definition_names.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/task_complete_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/unified_diff_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/tools/write_file_tool.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/__init__.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/ask_user_validation.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/download_http_file.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/get_coding_environment.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/get_environment.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/get_quantalogic_rules_content.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/git_ls.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/read_file.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/utils/read_http_text_content.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/xml_parser.py +0 -0
- {quantalogic-0.2.7 → quantalogic-0.2.10}/quantalogic/xml_tool_parser.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: quantalogic
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.10
|
4
4
|
Summary: QuantaLogic ReAct Agents
|
5
5
|
Author: Raphaël MANSUY
|
6
6
|
Author-email: raphael.mansuy@gmail.com
|
@@ -117,15 +117,25 @@ pipx install quantalogic
|
|
117
117
|
The QuantaLogic CLI provides powerful command-line capabilities:
|
118
118
|
|
119
119
|
```bash
|
120
|
-
quantalogic [OPTIONS] COMMAND [ARGS]...
|
121
|
-
|
120
|
+
Usage: quantalogic [OPTIONS] COMMAND [ARGS]...
|
121
|
+
|
122
|
+
QuantaLogic AI Assistant - A powerful AI tool for various tasks.
|
122
123
|
|
123
|
-
|
124
|
-
--
|
125
|
-
--
|
126
|
-
|
127
|
-
--
|
128
|
-
|
124
|
+
Options:
|
125
|
+
--version Show version information.
|
126
|
+
--model-name TEXT Specify the text model to use (litellm format,
|
127
|
+
e.g. "openrouter/deepseek-chat").
|
128
|
+
--vision-model-name TEXT Specify the vision model to use (litellm format,
|
129
|
+
e.g. "openrouter/A/gpt-4o-mini").
|
130
|
+
--log [info|debug|warning] Set logging level (info/debug/warning).
|
131
|
+
--verbose Enable verbose output.
|
132
|
+
--mode [code|basic|interpreter|full|code-basic]
|
133
|
+
Agent mode (code/search/full).
|
134
|
+
--help Show this message and exit.
|
135
|
+
|
136
|
+
Commands:
|
137
|
+
task Execute a task with the QuantaLogic AI Assistant.
|
138
|
+
```
|
129
139
|
|
130
140
|
### Commands
|
131
141
|
task Execute a task with the QuantaLogic AI Assistant
|
@@ -140,33 +150,25 @@ task Execute a task with the QuantaLogic AI Assistant
|
|
140
150
|
- code-basic: Coding agent with basic reasoning
|
141
151
|
|
142
152
|
#### Task Execution
|
153
|
+
|
143
154
|
Tasks can be provided:
|
144
|
-
|
155
|
+
|
156
|
+
1. Directly via `task` parameter
|
145
157
|
2. Through a file using --file parameter
|
146
158
|
3. Interactively via standard input
|
147
159
|
|
148
|
-
#### Error Handling
|
149
|
-
The CLI provides comprehensive error handling:
|
150
|
-
- File not found errors
|
151
|
-
- Permission errors
|
152
|
-
- Model configuration errors
|
153
|
-
- Task validation errors
|
154
160
|
|
155
161
|
#### Examples
|
156
162
|
|
157
|
-
Basic task execution:
|
158
|
-
```bash
|
159
|
-
quantalogic --task "Write a Python function to calculate Fibonacci numbers"
|
160
|
-
```
|
161
163
|
|
162
164
|
Using a task file:
|
163
165
|
```bash
|
164
|
-
quantalogic --file tasks/example.md --verbose
|
166
|
+
quantalogic task --file tasks/example.md --verbose
|
165
167
|
```
|
166
168
|
|
167
169
|
Selecting agent mode:
|
168
170
|
```bash
|
169
|
-
quantalogic --mode interpreter
|
171
|
+
quantalogic --mode interpreter task "Explain quantum computing"
|
170
172
|
```
|
171
173
|
|
172
174
|
Interactive mode:
|
@@ -174,22 +176,7 @@ Interactive mode:
|
|
174
176
|
quantalogic
|
175
177
|
```
|
176
178
|
|
177
|
-
###
|
178
|
-
|
179
|
-
Basic task execution:
|
180
|
-
```bash
|
181
|
-
quantalogic --task "Write a Python function to calculate Fibonacci numbers"
|
182
|
-
```
|
183
|
-
|
184
|
-
Using a task file:
|
185
|
-
```bash
|
186
|
-
quantalogic --file tasks/example.md --verbose
|
187
|
-
```
|
188
|
-
|
189
|
-
Selecting agent mode:
|
190
|
-
```bash
|
191
|
-
quantalogic --mode interpreter --task "Explain quantum computing"
|
192
|
-
```
|
179
|
+
### Using QuantaLogic With code
|
193
180
|
|
194
181
|
```python
|
195
182
|
from quantalogic import Agent
|
@@ -223,32 +210,6 @@ result = agent.solve_task("Create a Python function that calculates the Fibonacc
|
|
223
210
|
print(result)
|
224
211
|
```
|
225
212
|
|
226
|
-
### Command Line Interface
|
227
|
-
|
228
|
-
```bash
|
229
|
-
# Simple task execution
|
230
|
-
quantalogic --task "Write a FastAPI endpoint that handles file uploads"
|
231
|
-
```
|
232
|
-
|
233
|
-
|
234
|
-
`instruction.md`
|
235
|
-
|
236
|
-
```md
|
237
|
-
Write a poem
|
238
|
-
Translate the poem in English
|
239
|
-
Choose 2 French Authors
|
240
|
-
And then rewrite the translation with the style of each author
|
241
|
-
```
|
242
|
-
|
243
|
-
`
|
244
|
-
```bash
|
245
|
-
# Advanced usage with options
|
246
|
-
quantalogic \
|
247
|
-
--model openrouter/deepseek-chat \
|
248
|
-
--execute-file instruction.md \
|
249
|
-
--verbose
|
250
|
-
```
|
251
|
-
|
252
213
|
## 📖 Examples
|
253
214
|
|
254
215
|
Here are some practical examples to help you get started:
|
@@ -426,7 +387,7 @@ By integrating these tools into its architecture, QuantaLogic allows agents to p
|
|
426
387
|
| Script Execution | Python Tool, Node.js Tool, Elixir Tool |
|
427
388
|
| File Operations | Read File Tool, Write File Tool, Edit Whole Content Tool, Replace In File Tool |
|
428
389
|
| Code Analysis | Search Definition Names Tool, Ripgrep Tool |
|
429
|
-
| Content Generation | LLM Tool
|
390
|
+
| Content Generation | LLM Tool, LLMVisionTool |
|
430
391
|
| Utility and Management | Download HTTP File Tool, List Directory Tool, Markitdown Tool, Unified Diff Tool |
|
431
392
|
|
432
393
|
---
|
@@ -722,7 +683,30 @@ print("Ripgrep Results:", output)
|
|
722
683
|
|
723
684
|
---
|
724
685
|
|
725
|
-
|
686
|
+
#### 14. LLMVisionTool
|
687
|
+
|
688
|
+
The **LLMVisionTool** enables processing of visual inputs using vision-language models.
|
689
|
+
|
690
|
+
##### Parameters
|
691
|
+
|
692
|
+
| Parameter | Type | Description | Example |
|
693
|
+
|----------------|---------|------------------------------------------------------------------------|--------------------------------------------|
|
694
|
+
| `image_path` | string | Path to the image file to process | `./path/to/image.png` |
|
695
|
+
| `prompt` | string | The question or instruction for the vision model | `Describe the contents of this image` |
|
696
|
+
| `temperature` | float | Sampling temperature between 0.0 and 1.0 | `0.7` |
|
697
|
+
|
698
|
+
##### Example Usage
|
699
|
+
```python
|
700
|
+
vision_tool = LLMVisionTool()
|
701
|
+
response = vision_tool.execute(
|
702
|
+
image_path="./path/to/image.png",
|
703
|
+
prompt="Describe the contents of this image",
|
704
|
+
temperature=0.7
|
705
|
+
)
|
706
|
+
print("Vision Model Response:", response)
|
707
|
+
```
|
708
|
+
|
709
|
+
#### 15. LLM Tool
|
726
710
|
|
727
711
|
The **LLM Tool** generates answers using a specified language model.
|
728
712
|
|
@@ -747,7 +731,7 @@ print("LLM Response:", response)
|
|
747
731
|
|
748
732
|
---
|
749
733
|
|
750
|
-
###
|
734
|
+
### 16. Download HTTP File Tool
|
751
735
|
|
752
736
|
The **Download HTTP File Tool** downloads a file from a specified HTTP URL.
|
753
737
|
|
@@ -767,7 +751,7 @@ print(result)
|
|
767
751
|
|
768
752
|
---
|
769
753
|
|
770
|
-
###
|
754
|
+
### 17. List Directory Tool
|
771
755
|
|
772
756
|
The **List Directory Tool** lists files in a specified directory.
|
773
757
|
|
@@ -786,7 +770,7 @@ print("Directory Files:", result)
|
|
786
770
|
|
787
771
|
---
|
788
772
|
|
789
|
-
###
|
773
|
+
### 18. Markitdown Tool
|
790
774
|
|
791
775
|
The **Markitdown Tool** processes markdown files, possibly for conversion or rendering.
|
792
776
|
|
@@ -803,26 +787,6 @@ result = markitdown_tool.execute(markdown_path="./path/to/file.md")
|
|
803
787
|
print("Processed Markdown Output:", result)
|
804
788
|
```
|
805
789
|
|
806
|
-
---
|
807
|
-
|
808
|
-
### 18. Unified Diff Tool
|
809
|
-
|
810
|
-
The **Unified Diff Tool** generates a unified diff between two texts or files.
|
811
|
-
|
812
|
-
#### Parameters
|
813
|
-
|
814
|
-
| Parameter | Type | Description | Example |
|
815
|
-
|--------------|--------|------------------------------------------------|------------------------|
|
816
|
-
| `original` | string | The original content or file path. | `old_text.txt` |
|
817
|
-
| `updated` | string | The updated content or file path. | `new_text.txt` |
|
818
|
-
|
819
|
-
#### Example Usage
|
820
|
-
```python
|
821
|
-
diff_tool = UnifiedDiffTool()
|
822
|
-
result = diff_tool.execute(original="old_text.txt", updated="new_text.txt")
|
823
|
-
print("Unified Diff Output:", result)
|
824
|
-
```
|
825
|
-
|
826
790
|
|
827
791
|
#### Creating Custom Tools
|
828
792
|
|
@@ -1048,3 +1012,8 @@ Copyright 2024 QuantaLogic Contributors
|
|
1048
1012
|
|
1049
1013
|
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
1050
1014
|
|
1015
|
+
## Project Growth
|
1016
|
+
[](https://star-history.com/#quantalogic/quantalogic&Date)
|
1017
|
+
|
1018
|
+
Initiated with ❤️ by Raphaël MANSUY. Founder of [Quantalogic](https://www.quantalogic.app).
|
1019
|
+
|
@@ -80,15 +80,25 @@ pipx install quantalogic
|
|
80
80
|
The QuantaLogic CLI provides powerful command-line capabilities:
|
81
81
|
|
82
82
|
```bash
|
83
|
-
quantalogic [OPTIONS] COMMAND [ARGS]...
|
84
|
-
|
83
|
+
Usage: quantalogic [OPTIONS] COMMAND [ARGS]...
|
84
|
+
|
85
|
+
QuantaLogic AI Assistant - A powerful AI tool for various tasks.
|
85
86
|
|
86
|
-
|
87
|
-
--
|
88
|
-
--
|
89
|
-
|
90
|
-
--
|
91
|
-
|
87
|
+
Options:
|
88
|
+
--version Show version information.
|
89
|
+
--model-name TEXT Specify the text model to use (litellm format,
|
90
|
+
e.g. "openrouter/deepseek-chat").
|
91
|
+
--vision-model-name TEXT Specify the vision model to use (litellm format,
|
92
|
+
e.g. "openrouter/A/gpt-4o-mini").
|
93
|
+
--log [info|debug|warning] Set logging level (info/debug/warning).
|
94
|
+
--verbose Enable verbose output.
|
95
|
+
--mode [code|basic|interpreter|full|code-basic]
|
96
|
+
Agent mode (code/search/full).
|
97
|
+
--help Show this message and exit.
|
98
|
+
|
99
|
+
Commands:
|
100
|
+
task Execute a task with the QuantaLogic AI Assistant.
|
101
|
+
```
|
92
102
|
|
93
103
|
### Commands
|
94
104
|
task Execute a task with the QuantaLogic AI Assistant
|
@@ -103,33 +113,25 @@ task Execute a task with the QuantaLogic AI Assistant
|
|
103
113
|
- code-basic: Coding agent with basic reasoning
|
104
114
|
|
105
115
|
#### Task Execution
|
116
|
+
|
106
117
|
Tasks can be provided:
|
107
|
-
|
118
|
+
|
119
|
+
1. Directly via `task` parameter
|
108
120
|
2. Through a file using --file parameter
|
109
121
|
3. Interactively via standard input
|
110
122
|
|
111
|
-
#### Error Handling
|
112
|
-
The CLI provides comprehensive error handling:
|
113
|
-
- File not found errors
|
114
|
-
- Permission errors
|
115
|
-
- Model configuration errors
|
116
|
-
- Task validation errors
|
117
123
|
|
118
124
|
#### Examples
|
119
125
|
|
120
|
-
Basic task execution:
|
121
|
-
```bash
|
122
|
-
quantalogic --task "Write a Python function to calculate Fibonacci numbers"
|
123
|
-
```
|
124
126
|
|
125
127
|
Using a task file:
|
126
128
|
```bash
|
127
|
-
quantalogic --file tasks/example.md --verbose
|
129
|
+
quantalogic task --file tasks/example.md --verbose
|
128
130
|
```
|
129
131
|
|
130
132
|
Selecting agent mode:
|
131
133
|
```bash
|
132
|
-
quantalogic --mode interpreter
|
134
|
+
quantalogic --mode interpreter task "Explain quantum computing"
|
133
135
|
```
|
134
136
|
|
135
137
|
Interactive mode:
|
@@ -137,22 +139,7 @@ Interactive mode:
|
|
137
139
|
quantalogic
|
138
140
|
```
|
139
141
|
|
140
|
-
###
|
141
|
-
|
142
|
-
Basic task execution:
|
143
|
-
```bash
|
144
|
-
quantalogic --task "Write a Python function to calculate Fibonacci numbers"
|
145
|
-
```
|
146
|
-
|
147
|
-
Using a task file:
|
148
|
-
```bash
|
149
|
-
quantalogic --file tasks/example.md --verbose
|
150
|
-
```
|
151
|
-
|
152
|
-
Selecting agent mode:
|
153
|
-
```bash
|
154
|
-
quantalogic --mode interpreter --task "Explain quantum computing"
|
155
|
-
```
|
142
|
+
### Using QuantaLogic With code
|
156
143
|
|
157
144
|
```python
|
158
145
|
from quantalogic import Agent
|
@@ -186,32 +173,6 @@ result = agent.solve_task("Create a Python function that calculates the Fibonacc
|
|
186
173
|
print(result)
|
187
174
|
```
|
188
175
|
|
189
|
-
### Command Line Interface
|
190
|
-
|
191
|
-
```bash
|
192
|
-
# Simple task execution
|
193
|
-
quantalogic --task "Write a FastAPI endpoint that handles file uploads"
|
194
|
-
```
|
195
|
-
|
196
|
-
|
197
|
-
`instruction.md`
|
198
|
-
|
199
|
-
```md
|
200
|
-
Write a poem
|
201
|
-
Translate the poem in English
|
202
|
-
Choose 2 French Authors
|
203
|
-
And then rewrite the translation with the style of each author
|
204
|
-
```
|
205
|
-
|
206
|
-
`
|
207
|
-
```bash
|
208
|
-
# Advanced usage with options
|
209
|
-
quantalogic \
|
210
|
-
--model openrouter/deepseek-chat \
|
211
|
-
--execute-file instruction.md \
|
212
|
-
--verbose
|
213
|
-
```
|
214
|
-
|
215
176
|
## 📖 Examples
|
216
177
|
|
217
178
|
Here are some practical examples to help you get started:
|
@@ -389,7 +350,7 @@ By integrating these tools into its architecture, QuantaLogic allows agents to p
|
|
389
350
|
| Script Execution | Python Tool, Node.js Tool, Elixir Tool |
|
390
351
|
| File Operations | Read File Tool, Write File Tool, Edit Whole Content Tool, Replace In File Tool |
|
391
352
|
| Code Analysis | Search Definition Names Tool, Ripgrep Tool |
|
392
|
-
| Content Generation | LLM Tool
|
353
|
+
| Content Generation | LLM Tool, LLMVisionTool |
|
393
354
|
| Utility and Management | Download HTTP File Tool, List Directory Tool, Markitdown Tool, Unified Diff Tool |
|
394
355
|
|
395
356
|
---
|
@@ -685,7 +646,30 @@ print("Ripgrep Results:", output)
|
|
685
646
|
|
686
647
|
---
|
687
648
|
|
688
|
-
|
649
|
+
#### 14. LLMVisionTool
|
650
|
+
|
651
|
+
The **LLMVisionTool** enables processing of visual inputs using vision-language models.
|
652
|
+
|
653
|
+
##### Parameters
|
654
|
+
|
655
|
+
| Parameter | Type | Description | Example |
|
656
|
+
|----------------|---------|------------------------------------------------------------------------|--------------------------------------------|
|
657
|
+
| `image_path` | string | Path to the image file to process | `./path/to/image.png` |
|
658
|
+
| `prompt` | string | The question or instruction for the vision model | `Describe the contents of this image` |
|
659
|
+
| `temperature` | float | Sampling temperature between 0.0 and 1.0 | `0.7` |
|
660
|
+
|
661
|
+
##### Example Usage
|
662
|
+
```python
|
663
|
+
vision_tool = LLMVisionTool()
|
664
|
+
response = vision_tool.execute(
|
665
|
+
image_path="./path/to/image.png",
|
666
|
+
prompt="Describe the contents of this image",
|
667
|
+
temperature=0.7
|
668
|
+
)
|
669
|
+
print("Vision Model Response:", response)
|
670
|
+
```
|
671
|
+
|
672
|
+
#### 15. LLM Tool
|
689
673
|
|
690
674
|
The **LLM Tool** generates answers using a specified language model.
|
691
675
|
|
@@ -710,7 +694,7 @@ print("LLM Response:", response)
|
|
710
694
|
|
711
695
|
---
|
712
696
|
|
713
|
-
###
|
697
|
+
### 16. Download HTTP File Tool
|
714
698
|
|
715
699
|
The **Download HTTP File Tool** downloads a file from a specified HTTP URL.
|
716
700
|
|
@@ -730,7 +714,7 @@ print(result)
|
|
730
714
|
|
731
715
|
---
|
732
716
|
|
733
|
-
###
|
717
|
+
### 17. List Directory Tool
|
734
718
|
|
735
719
|
The **List Directory Tool** lists files in a specified directory.
|
736
720
|
|
@@ -749,7 +733,7 @@ print("Directory Files:", result)
|
|
749
733
|
|
750
734
|
---
|
751
735
|
|
752
|
-
###
|
736
|
+
### 18. Markitdown Tool
|
753
737
|
|
754
738
|
The **Markitdown Tool** processes markdown files, possibly for conversion or rendering.
|
755
739
|
|
@@ -766,26 +750,6 @@ result = markitdown_tool.execute(markdown_path="./path/to/file.md")
|
|
766
750
|
print("Processed Markdown Output:", result)
|
767
751
|
```
|
768
752
|
|
769
|
-
---
|
770
|
-
|
771
|
-
### 18. Unified Diff Tool
|
772
|
-
|
773
|
-
The **Unified Diff Tool** generates a unified diff between two texts or files.
|
774
|
-
|
775
|
-
#### Parameters
|
776
|
-
|
777
|
-
| Parameter | Type | Description | Example |
|
778
|
-
|--------------|--------|------------------------------------------------|------------------------|
|
779
|
-
| `original` | string | The original content or file path. | `old_text.txt` |
|
780
|
-
| `updated` | string | The updated content or file path. | `new_text.txt` |
|
781
|
-
|
782
|
-
#### Example Usage
|
783
|
-
```python
|
784
|
-
diff_tool = UnifiedDiffTool()
|
785
|
-
result = diff_tool.execute(original="old_text.txt", updated="new_text.txt")
|
786
|
-
print("Unified Diff Output:", result)
|
787
|
-
```
|
788
|
-
|
789
753
|
|
790
754
|
#### Creating Custom Tools
|
791
755
|
|
@@ -1010,3 +974,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
|
|
1010
974
|
Copyright 2024 QuantaLogic Contributors
|
1011
975
|
|
1012
976
|
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
977
|
+
|
978
|
+
## Project Growth
|
979
|
+
[](https://star-history.com/#quantalogic/quantalogic&Date)
|
980
|
+
|
981
|
+
Initiated with ❤️ by Raphaël MANSUY. Founder of [Quantalogic](https://www.quantalogic.app).
|
@@ -64,6 +64,7 @@ class Agent(BaseModel):
|
|
64
64
|
event_emitter: EventEmitter = EventEmitter()
|
65
65
|
config: AgentConfig
|
66
66
|
task_to_solve: str
|
67
|
+
task_to_solve_summary: str = ""
|
67
68
|
ask_for_user_validation: Callable[[str], bool] = console_ask_for_user_validation
|
68
69
|
last_tool_call: dict[str, Any] = {} # Stores the last tool call information
|
69
70
|
total_tokens: int = 0 # Total tokens in the conversation
|
@@ -137,6 +138,9 @@ class Agent(BaseModel):
|
|
137
138
|
logger.debug(f"Solving task... {task}")
|
138
139
|
self._reset_session(task_to_solve=task, max_iterations=max_iterations)
|
139
140
|
|
141
|
+
# Generate task summary
|
142
|
+
self.task_to_solve_summary = self._generate_task_summary(task)
|
143
|
+
|
140
144
|
# Add system prompt to memory
|
141
145
|
self.memory.add(Message(role="system", content=self.config.system_prompt))
|
142
146
|
|
@@ -166,7 +170,7 @@ class Agent(BaseModel):
|
|
166
170
|
self._update_total_tokens(message_history=self.memory.memory, prompt=current_prompt)
|
167
171
|
|
168
172
|
# Emit event: Task Think Start after updating total tokens
|
169
|
-
self._emit_event("task_think_start")
|
173
|
+
self._emit_event("task_think_start", {"prompt": current_prompt})
|
170
174
|
|
171
175
|
self._compact_memory_if_needed(current_prompt)
|
172
176
|
|
@@ -443,6 +447,10 @@ class Agent(BaseModel):
|
|
443
447
|
"You must analyze this answer and evaluate what to do next to solve the task.\n"
|
444
448
|
"If the step failed, take a step back and rethink your approach.\n"
|
445
449
|
"\n"
|
450
|
+
"--- Task to solve summary ---\n"
|
451
|
+
"\n"
|
452
|
+
f"{self.task_to_solve_summary}"
|
453
|
+
"\n"
|
446
454
|
"--- Format ---\n"
|
447
455
|
"\n"
|
448
456
|
"You MUST respond with exactly two XML blocks formatted in markdown:\n"
|
@@ -546,6 +554,7 @@ class Agent(BaseModel):
|
|
546
554
|
"\n### Tools:\n"
|
547
555
|
"-----------------------------\n"
|
548
556
|
f"{self._get_tools_names_prompt()}\n"
|
557
|
+
"\n"
|
549
558
|
"### Variables:\n"
|
550
559
|
"-----------------------------\n"
|
551
560
|
f"{self._get_variable_prompt()}\n"
|
@@ -574,7 +583,7 @@ class Agent(BaseModel):
|
|
574
583
|
"\n"
|
575
584
|
"Available variables:\n"
|
576
585
|
"\n"
|
577
|
-
f"{', '.join(self.variable_store.keys())}\n"
|
586
|
+
f"{', '.join(self.variable_store.keys())}\n" if len(self.variable_store.keys()) > 0 else "None\n"
|
578
587
|
)
|
579
588
|
return prompt_use_variables
|
580
589
|
|
@@ -619,6 +628,28 @@ class Agent(BaseModel):
|
|
619
628
|
self.memory.memory = memory_copy
|
620
629
|
return summary.response
|
621
630
|
|
631
|
+
def _generate_task_summary(self, content: str) -> str:
|
632
|
+
"""Generate a concise summary of the given content using the generative model.
|
633
|
+
|
634
|
+
Args:
|
635
|
+
content (str): The content to summarize
|
636
|
+
|
637
|
+
Returns:
|
638
|
+
str: Generated summary
|
639
|
+
"""
|
640
|
+
try:
|
641
|
+
prompt = (
|
642
|
+
"Rewrite this task in a precise, dense, and concise manner:\n"
|
643
|
+
f"{content}\n"
|
644
|
+
"Summary should be 2-3 sentences maximum. No extra comments should be added.\n"
|
645
|
+
)
|
646
|
+
result = self.model.generate(prompt=prompt)
|
647
|
+
logger.debug(f"Generated summary: {result.response}")
|
648
|
+
return result.response
|
649
|
+
except Exception as e:
|
650
|
+
logger.error(f"Error generating summary: {str(e)}")
|
651
|
+
return f"Summary generation failed: {str(e)}"
|
652
|
+
|
622
653
|
def _update_session_memory(self, user_content: str, assistant_content: str) -> None:
|
623
654
|
"""
|
624
655
|
Log session messages to memory and emit events.
|
@@ -639,3 +670,5 @@ class Agent(BaseModel):
|
|
639
670
|
"session_add_message",
|
640
671
|
{"role": "assistant", "content": assistant_content},
|
641
672
|
)
|
673
|
+
|
674
|
+
|