quantalogic 0.2.10__tar.gz → 0.2.13__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.10/README.md → quantalogic-0.2.13/PKG-INFO +98 -7
- quantalogic-0.2.10/PKG-INFO → quantalogic-0.2.13/README.md +57 -45
- {quantalogic-0.2.10 → quantalogic-0.2.13}/pyproject.toml +4 -1
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/agent.py +5 -7
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/agent_config.py +1 -1
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/coding_agent.py +2 -2
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/generative_model.py +14 -15
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/main.py +51 -9
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/print_event.py +3 -1
- quantalogic-0.2.13/quantalogic/search_agent.py +41 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/server/agent_server.py +13 -13
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/server/state.py +5 -5
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tool_manager.py +4 -4
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/__init__.py +4 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/agent_tool.py +1 -1
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/elixir_tool.py +1 -1
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/llm_tool.py +12 -3
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/llm_vision_tool.py +4 -17
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/nodejs_tool.py +2 -2
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/python_tool.py +2 -2
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/replace_in_file_tool.py +3 -3
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/ripgrep_tool.py +3 -3
- quantalogic-0.2.13/quantalogic/tools/serpapi_search_tool.py +169 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/tool.py +3 -3
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/unified_diff_tool.py +1 -0
- quantalogic-0.2.13/quantalogic/tools/wikipedia_search_tool.py +169 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/write_file_tool.py +1 -0
- quantalogic-0.2.13/quantalogic/utils/check_version.py +37 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/download_http_file.py +4 -4
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/read_http_text_content.py +2 -2
- quantalogic-0.2.13/quantalogic/version.py +5 -0
- quantalogic-0.2.10/quantalogic/version.py +0 -4
- {quantalogic-0.2.10 → quantalogic-0.2.13}/LICENSE +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/__init__.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/event_emitter.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/interactive_text_editor.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/memory.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/model_names.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/prompts.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/server/__init__.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/server/models.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/server/routes.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/server/static/js/event_visualizer.js +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/server/static/js/quantalogic.js +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/server/templates/index.html +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/download_http_file_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/edit_whole_content_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/execute_bash_command_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/input_question_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/__init__.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/c_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/cpp_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/go_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/java_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/javascript_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/python_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/rust_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/scala_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/typescript_handler.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/list_directory_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/markitdown_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/read_file_block_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/read_file_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/search_definition_names.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/tools/task_complete_tool.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/__init__.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/ask_user_validation.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/get_coding_environment.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/get_environment.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/get_quantalogic_rules_content.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/git_ls.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/utils/read_file.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/xml_parser.py +0 -0
- {quantalogic-0.2.10 → quantalogic-0.2.13}/quantalogic/xml_tool_parser.py +0 -0
@@ -1,3 +1,43 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: quantalogic
|
3
|
+
Version: 0.2.13
|
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: fastapi (>=0.115.6,<0.116.0)
|
14
|
+
Requires-Dist: google-auth (>=2.20.0,<3.0.0)
|
15
|
+
Requires-Dist: google-search-results (>=2.4.2,<3.0.0)
|
16
|
+
Requires-Dist: litellm (>=1.56.4,<2.0.0)
|
17
|
+
Requires-Dist: loguru (>=0.7.3,<0.8.0)
|
18
|
+
Requires-Dist: markitdown (>=0.0.1a3,<0.0.2)
|
19
|
+
Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
20
|
+
Requires-Dist: prompt-toolkit (>=3.0.48,<4.0.0)
|
21
|
+
Requires-Dist: pydantic (>=2.10.4,<3.0.0)
|
22
|
+
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
23
|
+
Requires-Dist: serpapi (>=0.1.5,<0.2.0)
|
24
|
+
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
|
25
|
+
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
26
|
+
Requires-Dist: tree-sitter (>=0.23.2,<0.24.0)
|
27
|
+
Requires-Dist: tree-sitter-c (>=0.23.4,<0.24.0)
|
28
|
+
Requires-Dist: tree-sitter-cpp (>=0.23.4,<0.24.0)
|
29
|
+
Requires-Dist: tree-sitter-go (>=0.23.4,<0.24.0)
|
30
|
+
Requires-Dist: tree-sitter-java (>=0.23.5,<0.24.0)
|
31
|
+
Requires-Dist: tree-sitter-javascript (>=0.23.1,<0.24.0)
|
32
|
+
Requires-Dist: tree-sitter-python (>=0.23.6,<0.24.0)
|
33
|
+
Requires-Dist: tree-sitter-rust (>=0.23.2,<0.24.0)
|
34
|
+
Requires-Dist: tree-sitter-scala (>=0.23.4,<0.24.0)
|
35
|
+
Requires-Dist: tree-sitter-typescript (>=0.23.2,<0.24.0)
|
36
|
+
Requires-Dist: types-requests (>=2.32.0.20241016,<3.0.0.0)
|
37
|
+
Requires-Dist: uvicorn (>=0.34.0,<0.35.0)
|
38
|
+
Requires-Dist: websocket (>=0.2.1,<0.3.0)
|
39
|
+
Description-Content-Type: text/markdown
|
40
|
+
|
1
41
|
# QuantaLogic
|
2
42
|
|
3
43
|
[](https://opensource.org/licenses/Apache-2.0)
|
@@ -92,7 +132,7 @@ Options:
|
|
92
132
|
e.g. "openrouter/A/gpt-4o-mini").
|
93
133
|
--log [info|debug|warning] Set logging level (info/debug/warning).
|
94
134
|
--verbose Enable verbose output.
|
95
|
-
--mode [code|basic|interpreter|full|code-basic]
|
135
|
+
--mode [code|basic|interpreter|full|code-basic|search]
|
96
136
|
Agent mode (code/search/full).
|
97
137
|
--help Show this message and exit.
|
98
138
|
|
@@ -103,6 +143,8 @@ Commands:
|
|
103
143
|
### Commands
|
104
144
|
task Execute a task with the QuantaLogic AI Assistant
|
105
145
|
|
146
|
+
|
147
|
+
|
106
148
|
### Detailed Usage
|
107
149
|
|
108
150
|
#### Agent Modes
|
@@ -342,16 +384,19 @@ By integrating these tools into its architecture, QuantaLogic allows agents to p
|
|
342
384
|
|
343
385
|
### Tools Documentation
|
344
386
|
|
387
|
+
|
388
|
+
|
345
389
|
#### Overview of Tools
|
346
390
|
|
347
391
|
| Category | Tools |
|
348
392
|
|-----------------------|---------------------------------------------------------------------------------------------------|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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 |
|
355
400
|
|
356
401
|
---
|
357
402
|
|
@@ -750,6 +795,51 @@ result = markitdown_tool.execute(markdown_path="./path/to/file.md")
|
|
750
795
|
print("Processed Markdown Output:", result)
|
751
796
|
```
|
752
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
|
+
```
|
753
843
|
|
754
844
|
#### Creating Custom Tools
|
755
845
|
|
@@ -979,3 +1069,4 @@ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for detai
|
|
979
1069
|
[](https://star-history.com/#quantalogic/quantalogic&Date)
|
980
1070
|
|
981
1071
|
Initiated with ❤️ by Raphaël MANSUY. Founder of [Quantalogic](https://www.quantalogic.app).
|
1072
|
+
|
@@ -1,40 +1,3 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: quantalogic
|
3
|
-
Version: 0.2.10
|
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: fastapi (>=0.115.6,<0.116.0)
|
14
|
-
Requires-Dist: google-auth (>=2.20.0,<3.0.0)
|
15
|
-
Requires-Dist: litellm (>=1.56.4,<2.0.0)
|
16
|
-
Requires-Dist: loguru (>=0.7.3,<0.8.0)
|
17
|
-
Requires-Dist: markitdown (>=0.0.1a3,<0.0.2)
|
18
|
-
Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
19
|
-
Requires-Dist: prompt-toolkit (>=3.0.48,<4.0.0)
|
20
|
-
Requires-Dist: pydantic (>=2.10.4,<3.0.0)
|
21
|
-
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
22
|
-
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
|
23
|
-
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
24
|
-
Requires-Dist: tree-sitter (>=0.23.2,<0.24.0)
|
25
|
-
Requires-Dist: tree-sitter-c (>=0.23.4,<0.24.0)
|
26
|
-
Requires-Dist: tree-sitter-cpp (>=0.23.4,<0.24.0)
|
27
|
-
Requires-Dist: tree-sitter-go (>=0.23.4,<0.24.0)
|
28
|
-
Requires-Dist: tree-sitter-java (>=0.23.5,<0.24.0)
|
29
|
-
Requires-Dist: tree-sitter-javascript (>=0.23.1,<0.24.0)
|
30
|
-
Requires-Dist: tree-sitter-python (>=0.23.6,<0.24.0)
|
31
|
-
Requires-Dist: tree-sitter-rust (>=0.23.2,<0.24.0)
|
32
|
-
Requires-Dist: tree-sitter-scala (>=0.23.4,<0.24.0)
|
33
|
-
Requires-Dist: tree-sitter-typescript (>=0.23.2,<0.24.0)
|
34
|
-
Requires-Dist: uvicorn (>=0.34.0,<0.35.0)
|
35
|
-
Requires-Dist: websocket (>=0.2.1,<0.3.0)
|
36
|
-
Description-Content-Type: text/markdown
|
37
|
-
|
38
1
|
# QuantaLogic
|
39
2
|
|
40
3
|
[](https://opensource.org/licenses/Apache-2.0)
|
@@ -129,7 +92,7 @@ Options:
|
|
129
92
|
e.g. "openrouter/A/gpt-4o-mini").
|
130
93
|
--log [info|debug|warning] Set logging level (info/debug/warning).
|
131
94
|
--verbose Enable verbose output.
|
132
|
-
--mode [code|basic|interpreter|full|code-basic]
|
95
|
+
--mode [code|basic|interpreter|full|code-basic|search]
|
133
96
|
Agent mode (code/search/full).
|
134
97
|
--help Show this message and exit.
|
135
98
|
|
@@ -140,6 +103,8 @@ Commands:
|
|
140
103
|
### Commands
|
141
104
|
task Execute a task with the QuantaLogic AI Assistant
|
142
105
|
|
106
|
+
|
107
|
+
|
143
108
|
### Detailed Usage
|
144
109
|
|
145
110
|
#### Agent Modes
|
@@ -379,16 +344,19 @@ By integrating these tools into its architecture, QuantaLogic allows agents to p
|
|
379
344
|
|
380
345
|
### Tools Documentation
|
381
346
|
|
347
|
+
|
348
|
+
|
382
349
|
#### Overview of Tools
|
383
350
|
|
384
351
|
| Category | Tools |
|
385
352
|
|-----------------------|---------------------------------------------------------------------------------------------------|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
353
|
+
| 1. Search Tools | 1.1 SerpAPI Search Tool, 1.2 Wikipedia Search Tool |
|
354
|
+
| 2. Task Automation | Agent Tool, Task Complete Tool, Input Question Tool, Execute Bash Command Tool |
|
355
|
+
| 3. Script Execution | Python Tool, Node.js Tool, Elixir Tool |
|
356
|
+
| 4. File Operations | Read File Tool, Write File Tool, Edit Whole Content Tool, Replace In File Tool |
|
357
|
+
| 5. Code Analysis | Search Definition Names Tool, Ripgrep Tool |
|
358
|
+
| 6. Content Generation | LLM Tool, LLMVisionTool |
|
359
|
+
| 7. Utility & Management| Download HTTP File Tool, List Directory Tool, Markitdown Tool, Unified Diff Tool |
|
392
360
|
|
393
361
|
---
|
394
362
|
|
@@ -787,6 +755,51 @@ result = markitdown_tool.execute(markdown_path="./path/to/file.md")
|
|
787
755
|
print("Processed Markdown Output:", result)
|
788
756
|
```
|
789
757
|
|
758
|
+
---
|
759
|
+
|
760
|
+
### 19. SerpAPI Search Tool
|
761
|
+
|
762
|
+
The **SerpAPI Search Tool** allows agents to perform web searches using the SerpAPI service.
|
763
|
+
|
764
|
+
##### Parameters
|
765
|
+
| Parameter | Type | Description | Example |
|
766
|
+
|-----------|--------|---------------------------------|-----------------------------|
|
767
|
+
| query | string | The search query to execute | "latest AI research papers" |
|
768
|
+
| location | string | Geographic location for results | "United States" |
|
769
|
+
| num | int | Number of results to return | 5 |
|
770
|
+
|
771
|
+
##### Example Usage
|
772
|
+
```python
|
773
|
+
from quantalogic.tools import SerpAPISearchTool
|
774
|
+
|
775
|
+
search_tool = SerpAPISearchTool()
|
776
|
+
results = search_tool.execute(query="latest AI research", location="United States", num=5)
|
777
|
+
print(results)
|
778
|
+
```
|
779
|
+
|
780
|
+
---
|
781
|
+
|
782
|
+
### 20. Wikipedia Search Tool
|
783
|
+
|
784
|
+
The **Wikipedia Search Tool** enables agents to search and retrieve information from Wikipedia.
|
785
|
+
|
786
|
+
##### Parameters
|
787
|
+
|
788
|
+
| Parameter | Type | Description | Example |
|
789
|
+
|-----------|--------|---------------------------------|-----------------------------|
|
790
|
+
| query | string | The search query to execute | "Artificial Intelligence" |
|
791
|
+
| lang | string | Language code for results | "en" |
|
792
|
+
| sentences | int | Number of summary sentences | 3 |
|
793
|
+
|
794
|
+
##### Example Usage
|
795
|
+
```python
|
796
|
+
from quantalogic.tools import WikipediaSearchTool
|
797
|
+
|
798
|
+
wiki_tool = WikipediaSearchTool()
|
799
|
+
results = wiki_tool.execute(query="Artificial Intelligence", lang="en", sentences=3)
|
800
|
+
print(results)
|
801
|
+
```
|
802
|
+
```
|
790
803
|
|
791
804
|
#### Creating Custom Tools
|
792
805
|
|
@@ -1016,4 +1029,3 @@ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for detai
|
|
1016
1029
|
[](https://star-history.com/#quantalogic/quantalogic&Date)
|
1017
1030
|
|
1018
1031
|
Initiated with ❤️ by Raphaël MANSUY. Founder of [Quantalogic](https://www.quantalogic.app).
|
1019
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "quantalogic"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.13"
|
4
4
|
description = "QuantaLogic ReAct Agents"
|
5
5
|
authors = ["Raphaël MANSUY <raphael.mansuy@gmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -33,6 +33,9 @@ google-auth = "^2.20.0"
|
|
33
33
|
pathspec = "^0.12.1"
|
34
34
|
click = "^8.1.8"
|
35
35
|
toml = "^0.10.2"
|
36
|
+
types-requests = "^2.32.0.20241016"
|
37
|
+
google-search-results = "^2.4.2"
|
38
|
+
serpapi = "^0.1.5"
|
36
39
|
|
37
40
|
[tool.poetry.scripts]
|
38
41
|
quantalogic = "quantalogic.main:cli"
|
@@ -1,7 +1,5 @@
|
|
1
1
|
"""Enhanced QuantaLogic agent implementing the ReAct framework."""
|
2
2
|
|
3
|
-
import os
|
4
|
-
import sys
|
5
3
|
from collections.abc import Callable
|
6
4
|
from datetime import datetime
|
7
5
|
from typing import Any
|
@@ -583,7 +581,9 @@ class Agent(BaseModel):
|
|
583
581
|
"\n"
|
584
582
|
"Available variables:\n"
|
585
583
|
"\n"
|
586
|
-
f"{', '.join(self.variable_store.keys())}\n"
|
584
|
+
f"{', '.join(self.variable_store.keys())}\n"
|
585
|
+
if len(self.variable_store.keys()) > 0
|
586
|
+
else "None\n"
|
587
587
|
)
|
588
588
|
return prompt_use_variables
|
589
589
|
|
@@ -630,10 +630,10 @@ class Agent(BaseModel):
|
|
630
630
|
|
631
631
|
def _generate_task_summary(self, content: str) -> str:
|
632
632
|
"""Generate a concise summary of the given content using the generative model.
|
633
|
-
|
633
|
+
|
634
634
|
Args:
|
635
635
|
content (str): The content to summarize
|
636
|
-
|
636
|
+
|
637
637
|
Returns:
|
638
638
|
str: Generated summary
|
639
639
|
"""
|
@@ -670,5 +670,3 @@ class Agent(BaseModel):
|
|
670
670
|
"session_add_message",
|
671
671
|
{"role": "assistant", "content": assistant_content},
|
672
672
|
)
|
673
|
-
|
674
|
-
|
@@ -18,7 +18,7 @@ from quantalogic.utils import get_coding_environment
|
|
18
18
|
from quantalogic.utils.get_quantalogic_rules_content import get_quantalogic_rules_file_content
|
19
19
|
|
20
20
|
|
21
|
-
def create_coding_agent(model_name: str,vision_model_name: str | None = None, basic: bool = False) -> Agent:
|
21
|
+
def create_coding_agent(model_name: str, vision_model_name: str | None = None, basic: bool = False) -> Agent:
|
22
22
|
"""Creates and configures a coding agent with a comprehensive set of tools.
|
23
23
|
|
24
24
|
Args:
|
@@ -69,7 +69,7 @@ def create_coding_agent(model_name: str,vision_model_name: str | None = None, ba
|
|
69
69
|
LLMTool(
|
70
70
|
model_name=model_name,
|
71
71
|
system_prompt="You are a software expert, your role is to answer coding questions.",
|
72
|
-
name="coding_consultant", # Handles implementation-level coding questions
|
72
|
+
name="coding_consultant", # Handles implementation-level coding questions
|
73
73
|
)
|
74
74
|
)
|
75
75
|
tools.append(
|
@@ -107,7 +107,9 @@ class GenerativeModel:
|
|
107
107
|
)
|
108
108
|
|
109
109
|
# Retry on specific retriable exceptions
|
110
|
-
def generate_with_history(
|
110
|
+
def generate_with_history(
|
111
|
+
self, messages_history: list[Message], prompt: str, image_url: str | None = None
|
112
|
+
) -> ResponseStats:
|
111
113
|
"""Generate a response with conversation history and optional image.
|
112
114
|
|
113
115
|
Generates a response based on previous conversation messages,
|
@@ -128,20 +130,17 @@ class GenerativeModel:
|
|
128
130
|
Exception: For other unexpected errors.
|
129
131
|
"""
|
130
132
|
messages = [{"role": msg.role, "content": str(msg.content)} for msg in messages_history]
|
131
|
-
|
133
|
+
|
132
134
|
if image_url:
|
133
|
-
messages.append(
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
"type": "image_url",
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
}
|
143
|
-
]
|
144
|
-
})
|
135
|
+
messages.append(
|
136
|
+
{
|
137
|
+
"role": "user",
|
138
|
+
"content": [
|
139
|
+
{"type": "text", "text": str(prompt)},
|
140
|
+
{"type": "image_url", "image_url": {"url": image_url}},
|
141
|
+
],
|
142
|
+
}
|
143
|
+
)
|
145
144
|
else:
|
146
145
|
messages.append({"role": "user", "content": str(prompt)})
|
147
146
|
|
@@ -249,7 +248,7 @@ class GenerativeModel:
|
|
249
248
|
logger.debug(f"Model info retrieved: {model_info.keys()}")
|
250
249
|
else:
|
251
250
|
logger.debug("No model info available")
|
252
|
-
|
251
|
+
|
253
252
|
return model_info
|
254
253
|
|
255
254
|
def get_model_max_input_tokens(self) -> int:
|
@@ -2,6 +2,7 @@
|
|
2
2
|
"""Main module for the QuantaLogic agent."""
|
3
3
|
|
4
4
|
# Standard library imports
|
5
|
+
import random
|
5
6
|
import sys
|
6
7
|
from typing import Optional
|
7
8
|
|
@@ -9,6 +10,9 @@ from typing import Optional
|
|
9
10
|
import click
|
10
11
|
from loguru import logger
|
11
12
|
|
13
|
+
from quantalogic.utils.check_version import check_if_is_latest_version
|
14
|
+
from quantalogic.version import get_version
|
15
|
+
|
12
16
|
# Configure logger
|
13
17
|
logger.remove() # Remove default logger
|
14
18
|
|
@@ -28,9 +32,10 @@ from quantalogic.agent_config import ( # noqa: E402
|
|
28
32
|
)
|
29
33
|
from quantalogic.interactive_text_editor import get_multiline_input # noqa: E402
|
30
34
|
from quantalogic.print_event import console_print_events # noqa: E402
|
31
|
-
from quantalogic.version import get_version # noqa: E402
|
32
35
|
|
33
|
-
|
36
|
+
from quantalogic.search_agent import create_search_agent
|
37
|
+
|
38
|
+
AGENT_MODES = ["code", "basic", "interpreter", "full", "code-basic","search"]
|
34
39
|
|
35
40
|
|
36
41
|
def create_agent_for_mode(mode: str, model_name: str, vision_model_name: str | None) -> Agent:
|
@@ -47,9 +52,35 @@ def create_agent_for_mode(mode: str, model_name: str, vision_model_name: str | N
|
|
47
52
|
return create_full_agent(model_name, vision_model_name)
|
48
53
|
elif mode == "interpreter":
|
49
54
|
return create_interpreter_agent(model_name, vision_model_name)
|
55
|
+
elif mode == "search":
|
56
|
+
return create_search_agent(model_name)
|
50
57
|
else:
|
51
58
|
raise ValueError(f"Unknown agent mode: {mode}")
|
52
59
|
|
60
|
+
def check_new_version():
|
61
|
+
# Randomly check for updates (1 in 10 chance)
|
62
|
+
if random.randint(1, 10) == 1:
|
63
|
+
try:
|
64
|
+
current_version = get_version()
|
65
|
+
has_new_version, latest_version = check_if_is_latest_version()
|
66
|
+
|
67
|
+
if has_new_version:
|
68
|
+
console = Console()
|
69
|
+
console.print(
|
70
|
+
Panel.fit(
|
71
|
+
f"[yellow]⚠️ Update Available![/yellow]\n\n"
|
72
|
+
f"Current version: [bold]{current_version}[/bold]\n"
|
73
|
+
f"Latest version: [bold]{latest_version}[/bold]\n\n"
|
74
|
+
"To update, run:\n"
|
75
|
+
"[bold]pip install --upgrade quantalogic[/bold]\n"
|
76
|
+
"or if using pipx:\n"
|
77
|
+
"[bold]pipx upgrade quantalogic[/bold]",
|
78
|
+
title="[bold]Update Available[/bold]",
|
79
|
+
border_style="yellow",
|
80
|
+
)
|
81
|
+
)
|
82
|
+
except Exception:
|
83
|
+
return
|
53
84
|
|
54
85
|
def configure_logger(log_level: str) -> None:
|
55
86
|
"""Configure the logger with the specified log level and format."""
|
@@ -59,7 +90,7 @@ def configure_logger(log_level: str) -> None:
|
|
59
90
|
level=log_level.upper(),
|
60
91
|
format="<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{process}</cyan> | <magenta>{file}:{line}</magenta> | {message}",
|
61
92
|
)
|
62
|
-
logger.
|
93
|
+
logger.debug(f"Log level set to: {log_level}")
|
63
94
|
|
64
95
|
|
65
96
|
def set_litellm_verbose(verbose_mode: bool) -> None:
|
@@ -192,17 +223,20 @@ def task(
|
|
192
223
|
console = Console()
|
193
224
|
switch_verbose(verbose, log)
|
194
225
|
|
226
|
+
|
195
227
|
try:
|
196
228
|
if file:
|
197
229
|
task_content = get_task_from_file(file)
|
198
230
|
else:
|
199
231
|
if task:
|
232
|
+
check_new_version()
|
200
233
|
task_content = task
|
201
234
|
else:
|
202
235
|
display_welcome_message(console, model_name, vision_model_name)
|
203
|
-
|
236
|
+
check_new_version()
|
237
|
+
logger.debug("Waiting for user input...")
|
204
238
|
task_content = get_multiline_input(console).strip()
|
205
|
-
logger.
|
239
|
+
logger.debug(f"User input received. Task content: {task_content}")
|
206
240
|
if not task_content:
|
207
241
|
logger.info("No task provided. Exiting...")
|
208
242
|
console.print("[yellow]No task provided. Exiting...[/yellow]")
|
@@ -216,9 +250,17 @@ def task(
|
|
216
250
|
border_style="blue",
|
217
251
|
)
|
218
252
|
)
|
219
|
-
|
220
|
-
|
221
|
-
|
253
|
+
if not Confirm.ask("[bold]Are you sure you want to submit this task?[/bold]"):
|
254
|
+
console.print("[yellow]Task submission cancelled. Exiting...[/yellow]")
|
255
|
+
sys.exit(0)
|
256
|
+
|
257
|
+
console.print(
|
258
|
+
Panel.fit(
|
259
|
+
"[green]✓ Task successfully submitted! Processing...[/green]",
|
260
|
+
title="[bold]Status[/bold]",
|
261
|
+
border_style="green",
|
262
|
+
)
|
263
|
+
)
|
222
264
|
|
223
265
|
logger.debug(f"Creating agent for mode: {mode} with model: {model_name}")
|
224
266
|
agent = create_agent_for_mode(mode, model_name, vision_model_name=vision_model_name)
|
@@ -259,7 +301,7 @@ def task(
|
|
259
301
|
|
260
302
|
|
261
303
|
def main():
|
262
|
-
"""Entry point
|
304
|
+
"""Main Entry point"""
|
263
305
|
cli()
|
264
306
|
|
265
307
|
|
@@ -1,12 +1,14 @@
|
|
1
1
|
"""Print events with rich formatting."""
|
2
2
|
|
3
|
+
from typing import Any
|
4
|
+
|
3
5
|
from rich import box
|
4
6
|
from rich.console import Console
|
5
7
|
from rich.panel import Panel
|
6
8
|
from rich.tree import Tree
|
7
9
|
|
8
10
|
|
9
|
-
def console_print_events(event: str, data: dict[str,
|
11
|
+
def console_print_events(event: str, data: dict[str, Any] | None = None):
|
10
12
|
"""Print events with rich formatting.
|
11
13
|
|
12
14
|
Args:
|
@@ -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
|
+
)
|