quantalogic 0.2.12__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.
Files changed (73) hide show
  1. quantalogic-0.2.12/README.md → quantalogic-0.2.13/PKG-INFO +98 -7
  2. quantalogic-0.2.12/PKG-INFO → quantalogic-0.2.13/README.md +57 -46
  3. {quantalogic-0.2.12 → quantalogic-0.2.13}/pyproject.toml +3 -1
  4. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/main.py +5 -2
  5. quantalogic-0.2.13/quantalogic/search_agent.py +41 -0
  6. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/__init__.py +4 -0
  7. quantalogic-0.2.13/quantalogic/tools/serpapi_search_tool.py +169 -0
  8. quantalogic-0.2.13/quantalogic/tools/wikipedia_search_tool.py +169 -0
  9. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/check_version.py +1 -1
  10. {quantalogic-0.2.12 → quantalogic-0.2.13}/LICENSE +0 -0
  11. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/__init__.py +0 -0
  12. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/agent.py +0 -0
  13. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/agent_config.py +0 -0
  14. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/coding_agent.py +0 -0
  15. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/event_emitter.py +0 -0
  16. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/generative_model.py +0 -0
  17. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/interactive_text_editor.py +0 -0
  18. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/memory.py +0 -0
  19. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/model_names.py +0 -0
  20. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/print_event.py +0 -0
  21. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/prompts.py +0 -0
  22. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/server/__init__.py +0 -0
  23. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/server/agent_server.py +0 -0
  24. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/server/models.py +0 -0
  25. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/server/routes.py +0 -0
  26. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/server/state.py +0 -0
  27. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/server/static/js/event_visualizer.js +0 -0
  28. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/server/static/js/quantalogic.js +0 -0
  29. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/server/templates/index.html +0 -0
  30. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tool_manager.py +0 -0
  31. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/agent_tool.py +0 -0
  32. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/download_http_file_tool.py +0 -0
  33. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/edit_whole_content_tool.py +0 -0
  34. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/elixir_tool.py +0 -0
  35. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/execute_bash_command_tool.py +0 -0
  36. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/input_question_tool.py +0 -0
  37. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/__init__.py +0 -0
  38. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/c_handler.py +0 -0
  39. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/cpp_handler.py +0 -0
  40. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/go_handler.py +0 -0
  41. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/java_handler.py +0 -0
  42. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/javascript_handler.py +0 -0
  43. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/python_handler.py +0 -0
  44. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/rust_handler.py +0 -0
  45. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/scala_handler.py +0 -0
  46. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/language_handlers/typescript_handler.py +0 -0
  47. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/list_directory_tool.py +0 -0
  48. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/llm_tool.py +0 -0
  49. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/llm_vision_tool.py +0 -0
  50. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/markitdown_tool.py +0 -0
  51. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/nodejs_tool.py +0 -0
  52. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/python_tool.py +0 -0
  53. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/read_file_block_tool.py +0 -0
  54. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/read_file_tool.py +0 -0
  55. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/replace_in_file_tool.py +0 -0
  56. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/ripgrep_tool.py +0 -0
  57. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/search_definition_names.py +0 -0
  58. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/task_complete_tool.py +0 -0
  59. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/tool.py +0 -0
  60. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/unified_diff_tool.py +0 -0
  61. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/tools/write_file_tool.py +0 -0
  62. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/__init__.py +0 -0
  63. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/ask_user_validation.py +0 -0
  64. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/download_http_file.py +0 -0
  65. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/get_coding_environment.py +0 -0
  66. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/get_environment.py +0 -0
  67. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/get_quantalogic_rules_content.py +0 -0
  68. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/git_ls.py +0 -0
  69. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/read_file.py +0 -0
  70. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/utils/read_http_text_content.py +0 -0
  71. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/version.py +0 -0
  72. {quantalogic-0.2.12 → quantalogic-0.2.13}/quantalogic/xml_parser.py +0 -0
  73. {quantalogic-0.2.12 → 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
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](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
- | Task Automation | Agent Tool, Task Complete Tool, Input Question Tool, Execute Bash Command Tool |
350
- | Script Execution | Python Tool, Node.js Tool, Elixir Tool |
351
- | File Operations | Read File Tool, Write File Tool, Edit Whole Content Tool, Replace In File Tool |
352
- | Code Analysis | Search Definition Names Tool, Ripgrep Tool |
353
- | Content Generation | LLM Tool, LLMVisionTool |
354
- | Utility and Management | Download HTTP File Tool, List Directory Tool, Markitdown Tool, Unified Diff Tool |
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
  [![Star History Chart](https://api.star-history.com/svg?repos=quantalogic/quantalogic&type=Date)](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,41 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: quantalogic
3
- Version: 0.2.12
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: types-requests (>=2.32.0.20241016,<3.0.0.0)
35
- Requires-Dist: uvicorn (>=0.34.0,<0.35.0)
36
- Requires-Dist: websocket (>=0.2.1,<0.3.0)
37
- Description-Content-Type: text/markdown
38
-
39
1
  # QuantaLogic
40
2
 
41
3
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
@@ -130,7 +92,7 @@ Options:
130
92
  e.g. "openrouter/A/gpt-4o-mini").
131
93
  --log [info|debug|warning] Set logging level (info/debug/warning).
132
94
  --verbose Enable verbose output.
133
- --mode [code|basic|interpreter|full|code-basic]
95
+ --mode [code|basic|interpreter|full|code-basic|search]
134
96
  Agent mode (code/search/full).
135
97
  --help Show this message and exit.
136
98
 
@@ -141,6 +103,8 @@ Commands:
141
103
  ### Commands
142
104
  task Execute a task with the QuantaLogic AI Assistant
143
105
 
106
+
107
+
144
108
  ### Detailed Usage
145
109
 
146
110
  #### Agent Modes
@@ -380,16 +344,19 @@ By integrating these tools into its architecture, QuantaLogic allows agents to p
380
344
 
381
345
  ### Tools Documentation
382
346
 
347
+
348
+
383
349
  #### Overview of Tools
384
350
 
385
351
  | Category | Tools |
386
352
  |-----------------------|---------------------------------------------------------------------------------------------------|
387
- | Task Automation | Agent Tool, Task Complete Tool, Input Question Tool, Execute Bash Command Tool |
388
- | Script Execution | Python Tool, Node.js Tool, Elixir Tool |
389
- | File Operations | Read File Tool, Write File Tool, Edit Whole Content Tool, Replace In File Tool |
390
- | Code Analysis | Search Definition Names Tool, Ripgrep Tool |
391
- | Content Generation | LLM Tool, LLMVisionTool |
392
- | Utility and Management | Download HTTP File Tool, List Directory Tool, Markitdown Tool, Unified Diff Tool |
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 |
393
360
 
394
361
  ---
395
362
 
@@ -788,6 +755,51 @@ result = markitdown_tool.execute(markdown_path="./path/to/file.md")
788
755
  print("Processed Markdown Output:", result)
789
756
  ```
790
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
+ ```
791
803
 
792
804
  #### Creating Custom Tools
793
805
 
@@ -1017,4 +1029,3 @@ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for detai
1017
1029
  [![Star History Chart](https://api.star-history.com/svg?repos=quantalogic/quantalogic&type=Date)](https://star-history.com/#quantalogic/quantalogic&Date)
1018
1030
 
1019
1031
  Initiated with ❤️ by Raphaël MANSUY. Founder of [Quantalogic](https://www.quantalogic.app).
1020
-
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "quantalogic"
3
- version = "0.2.12"
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"
@@ -34,6 +34,8 @@ pathspec = "^0.12.1"
34
34
  click = "^8.1.8"
35
35
  toml = "^0.10.2"
36
36
  types-requests = "^2.32.0.20241016"
37
+ google-search-results = "^2.4.2"
38
+ serpapi = "^0.1.5"
37
39
 
38
40
  [tool.poetry.scripts]
39
41
  quantalogic = "quantalogic.main:cli"
@@ -32,9 +32,10 @@ from quantalogic.agent_config import ( # noqa: E402
32
32
  )
33
33
  from quantalogic.interactive_text_editor import get_multiline_input # noqa: E402
34
34
  from quantalogic.print_event import console_print_events # noqa: E402
35
- from quantalogic.version import get_version # noqa: E402
36
35
 
37
- AGENT_MODES = ["code", "basic", "interpreter", "full", "code-basic"]
36
+ from quantalogic.search_agent import create_search_agent
37
+
38
+ AGENT_MODES = ["code", "basic", "interpreter", "full", "code-basic","search"]
38
39
 
39
40
 
40
41
  def create_agent_for_mode(mode: str, model_name: str, vision_model_name: str | None) -> Agent:
@@ -51,6 +52,8 @@ def create_agent_for_mode(mode: str, model_name: str, vision_model_name: str | N
51
52
  return create_full_agent(model_name, vision_model_name)
52
53
  elif mode == "interpreter":
53
54
  return create_interpreter_agent(model_name, vision_model_name)
55
+ elif mode == "search":
56
+ return create_search_agent(model_name)
54
57
  else:
55
58
  raise ValueError(f"Unknown agent mode: {mode}")
56
59
 
@@ -0,0 +1,41 @@
1
+ from quantalogic.agent import Agent
2
+ from quantalogic.tools import InputQuestionTool, SerpApiSearchTool, TaskCompleteTool, WikipediaSearchTool, ReadFileBlockTool,ReadFileTool, MarkitdownTool, RipgrepTool
3
+
4
+
5
+ def create_search_agent(model_name: str) -> Agent:
6
+ """Creates and configures a search agent with web and knowledge search tools.
7
+
8
+ Args:
9
+ model_name (str): Name of the language model to use for the agent's core capabilities
10
+
11
+ Returns:
12
+ Agent: A fully configured search agent instance with:
13
+ - Web search capabilities (SerpAPI)
14
+ - Knowledge search capabilities (Wikipedia)
15
+ - Basic interaction tools
16
+ """
17
+ specific_expertise = (
18
+ "Search expert focused on web and knowledge search operations."
19
+ "Specializes in finding and summarizing information from various sources."
20
+ )
21
+
22
+ tools = [
23
+ # Search tools
24
+ SerpApiSearchTool(), # Web search capabilities
25
+ WikipediaSearchTool(), # Knowledge search capabilities
26
+ # Basic interaction tools
27
+ TaskCompleteTool(), # Marks task completion
28
+ InputQuestionTool(), # Handles user queries
29
+ # LLM tools
30
+ ReadFileBlockTool(), # Reads specific file sections
31
+ ReadFileTool(), # Reads entire file
32
+ MarkitdownTool(), # Converts markdown to text
33
+ # Code search tools
34
+ RipgrepTool(), # Code search capabilities
35
+ ]
36
+
37
+ return Agent(
38
+ model_name=model_name,
39
+ tools=tools,
40
+ specific_expertise=specific_expertise,
41
+ )
@@ -17,12 +17,16 @@ from .read_file_tool import ReadFileTool
17
17
  from .replace_in_file_tool import ReplaceInFileTool
18
18
  from .ripgrep_tool import RipgrepTool
19
19
  from .search_definition_names import SearchDefinitionNames
20
+ from .serpapi_search_tool import SerpApiSearchTool
20
21
  from .task_complete_tool import TaskCompleteTool
21
22
  from .tool import Tool, ToolArgument
22
23
  from .unified_diff_tool import UnifiedDiffTool
24
+ from .wikipedia_search_tool import WikipediaSearchTool
23
25
  from .write_file_tool import WriteFileTool
24
26
 
25
27
  __all__ = [
28
+ "WikipediaSearchTool",
29
+ "SerpApiSearchTool",
26
30
  "Tool",
27
31
  "ToolArgument",
28
32
  "TaskCompleteTool",
@@ -0,0 +1,169 @@
1
+ """Tool for interacting with SerpApi for search results."""
2
+
3
+ import os
4
+
5
+ from serpapi.google_search import GoogleSearch
6
+
7
+ from quantalogic.tools.tool import Tool, ToolArgument
8
+
9
+
10
+ class SerpApiSearchTool(Tool):
11
+ """Tool for retrieving paginated search results from SerpApi.
12
+
13
+ This tool provides a convenient interface to SerpAPI's search capabilities,
14
+ supporting pagination and structured result formatting.
15
+
16
+ Example usage:
17
+ ```python
18
+ tool = SerpApiTool()
19
+ results = tool.execute(
20
+ query="machine learning",
21
+ page=1,
22
+ num_results=10
23
+ )
24
+ print(results)
25
+ ```
26
+
27
+ The tool handles:
28
+ - Query validation
29
+ - Pagination management
30
+ - API error handling
31
+ - Result formatting
32
+ """
33
+
34
+ name: str = "serpapi_tool"
35
+ description: str = (
36
+ "Retrieves search results from SerpAPI (Google Search) with pagination support. "
37
+ "Handles multiple pages of results and provides structured output."
38
+ )
39
+ arguments: list = [
40
+ ToolArgument(
41
+ name="query",
42
+ arg_type="string",
43
+ description="The search query to execute",
44
+ required=True,
45
+ example="machine learning",
46
+ ),
47
+ ToolArgument(
48
+ name="page",
49
+ arg_type="int",
50
+ description="The page number to retrieve (1-based)",
51
+ required=True,
52
+ default="1",
53
+ example="2",
54
+ ),
55
+ ToolArgument(
56
+ name="num_results",
57
+ arg_type="int",
58
+ description="Number of results to retrieve per page",
59
+ required=True,
60
+ default="10",
61
+ example="20",
62
+ ),
63
+ ]
64
+
65
+ def execute(self, query: str, page: int = 1, num_results: int = 10) -> str:
66
+ """Execute a search query using SerpAPI and return results.
67
+
68
+ Args:
69
+ query: The search query to execute
70
+ page: The page number to retrieve (1-based)
71
+ num_results: Number of results to retrieve per page (1-100)
72
+
73
+ Returns:
74
+ Formatted search results as a string with the following format:
75
+ ==== Page X of results ====
76
+ 1. Title
77
+ URL
78
+ Description
79
+ 2. Title
80
+ URL
81
+ Description
82
+ ==== End of page X ====
83
+
84
+ Raises:
85
+ ValueError: If any parameter is invalid
86
+ RuntimeError: If API request fails or environment variable is missing
87
+ """
88
+ # Validate and convert query
89
+ if not query:
90
+ raise ValueError("Query must be a non-empty string")
91
+ try:
92
+ query = str(query)
93
+ except (TypeError, ValueError) as e:
94
+ raise ValueError(f"Query must be convertible to string: {str(e)}")
95
+
96
+ # Validate and convert page
97
+ try:
98
+ page = int(page)
99
+ if page < 1:
100
+ raise ValueError("Page number must be positive")
101
+ except (TypeError, ValueError) as e:
102
+ raise ValueError(f"Invalid page number: {str(e)}")
103
+
104
+ # Validate and convert num_results
105
+ try:
106
+ num_results = int(num_results)
107
+ if num_results < 1 or num_results > 100:
108
+ raise ValueError("Number of results must be between 1 and 100")
109
+ except (TypeError, ValueError) as e:
110
+ raise ValueError(f"Invalid number of results: {str(e)}")
111
+
112
+ api_key = os.getenv("SERPAPI_API_KEY")
113
+ if not api_key:
114
+ raise RuntimeError("SERPAPI_API_KEY environment variable is not set")
115
+
116
+ try:
117
+ params = {"q": query, "start": (page - 1) * num_results, "num": num_results, "api_key": api_key}
118
+
119
+ search = GoogleSearch(params)
120
+ results = search.get_dict()
121
+
122
+ if "error" in results:
123
+ raise RuntimeError(f"API error: {results['error']}")
124
+
125
+ # Format results
126
+ output = []
127
+ if "organic_results" in results:
128
+ for idx, result in enumerate(results["organic_results"], 1):
129
+ output.append(f"{idx}. {result.get('title', 'No title')}")
130
+ output.append(f" {result.get('link', 'No URL')}")
131
+ output.append(f" {result.get('snippet', 'No description')}")
132
+ output.append("")
133
+
134
+ if not output:
135
+ return "No results found"
136
+
137
+ # Add pagination info
138
+ output.insert(0, f"==== Page {page} of results ====")
139
+ output.append(f"==== End of page {page} ====")
140
+
141
+ return "\n".join(output)
142
+
143
+ except Exception as e:
144
+ raise RuntimeError(f"Search failed: {str(e)}")
145
+
146
+
147
+ def main():
148
+ """Demonstrate SerpApiTool functionality."""
149
+ try:
150
+ tool = SerpApiSearchTool()
151
+
152
+ # Test basic search functionality
153
+ print("Testing SerpApiTool with sample query...")
154
+ results = tool.execute(query="Python programming", page=1, num_results=3)
155
+ print(results)
156
+
157
+ # Test error handling
158
+ print("\nTesting error handling with invalid query...")
159
+ try:
160
+ tool.execute(query="")
161
+ except ValueError as e:
162
+ print(f"Caught expected ValueError: {e}")
163
+
164
+ except Exception as e:
165
+ print(f"Error in main: {e}")
166
+
167
+
168
+ if __name__ == "__main__":
169
+ main()
@@ -0,0 +1,169 @@
1
+ from typing import Union
2
+
3
+ """Tool for interacting with Wikipedia API for search results."""
4
+
5
+ import requests # noqa: E402
6
+
7
+ from quantalogic.tools.tool import Tool, ToolArgument # noqa: E402
8
+
9
+
10
+ class WikipediaSearchTool(Tool):
11
+ """Tool for retrieving paginated search results from Wikipedia.
12
+
13
+ This tool provides a convenient interface to Wikipedia's search API,
14
+ supporting pagination and structured result formatting.
15
+
16
+ Example usage:
17
+ ```python
18
+ tool = WikipediaSearchTool()
19
+ results = tool.execute(
20
+ query="machine learning",
21
+ page=1,
22
+ num_results=10
23
+ )
24
+ print(results)
25
+ ```
26
+
27
+ The tool handles:
28
+ - Query validation
29
+ - Pagination management
30
+ - API error handling
31
+ - Result formatting
32
+ """
33
+
34
+ name: str = "wikipedia_tool"
35
+ description: str = (
36
+ "Retrieves search results from Wikipedia with pagination support. "
37
+ "Handles multiple pages of results and provides structured output."
38
+ )
39
+ arguments: list = [
40
+ ToolArgument(
41
+ name="query",
42
+ arg_type="string",
43
+ description="The search query to execute",
44
+ required=True,
45
+ example="machine learning",
46
+ ),
47
+ ToolArgument(
48
+ name="page",
49
+ arg_type="int",
50
+ description="The page number to retrieve (1-based)",
51
+ required=True,
52
+ default="1",
53
+ example="2",
54
+ ),
55
+ ToolArgument(
56
+ name="num_results",
57
+ arg_type="int",
58
+ description="Number of results to retrieve per page (1-50)",
59
+ required=True,
60
+ default="10",
61
+ example="20",
62
+ ),
63
+ ]
64
+
65
+ def execute(self, query: str, page: Union[str, int] = 1, num_results: Union[str, int] = 10) -> str:
66
+ """Execute a search query using Wikipedia API and return results.
67
+
68
+ Args:
69
+ query: The search query to execute
70
+ page: The page number to retrieve (1-based)
71
+ num_results: Number of results to retrieve per page (1-50)
72
+
73
+ Returns:
74
+ Formatted search results as a string with the following format:
75
+ ==== Page X of results ====
76
+ 1. Title
77
+ URL
78
+ Description
79
+ 2. Title
80
+ URL
81
+ Description
82
+ ==== End of page X ====
83
+
84
+ Raises:
85
+ ValueError: If any parameter is invalid
86
+ RuntimeError: If API request fails
87
+ """
88
+ if not query or not isinstance(query, str):
89
+ raise ValueError("Query must be a non-empty string")
90
+
91
+ try:
92
+ page = int(page) if str(page).strip() else 1
93
+ num_results = int(num_results) if str(num_results).strip() else 10
94
+ except (ValueError, TypeError) as e:
95
+ raise ValueError(f"Invalid parameter type: {e}. Expected integers for page and num_results")
96
+
97
+ if page < 1:
98
+ raise ValueError("Page number must be positive")
99
+
100
+ if num_results < 1 or num_results > 50:
101
+ raise ValueError("Number of results must be between 1 and 50")
102
+
103
+ try:
104
+ # Wikipedia API endpoint
105
+ url = "https://en.wikipedia.org/w/api.php"
106
+ params = {
107
+ "action": "query",
108
+ "format": "json",
109
+ "list": "search",
110
+ "srsearch": query,
111
+ "srlimit": num_results,
112
+ "sroffset": (page - 1) * num_results
113
+ }
114
+
115
+ response = requests.get(url, params=params)
116
+ response.raise_for_status()
117
+ data = response.json()
118
+
119
+ output = []
120
+ if "query" in data and "search" in data["query"]:
121
+ for idx, result in enumerate(data["query"]["search"], 1):
122
+ title = result.get("title", "No title")
123
+ snippet = result.get("snippet", "No description")
124
+ url = f"https://en.wikipedia.org/wiki/{title.replace(' ', '_')}"
125
+
126
+ output.append(f"{idx}. {title}")
127
+ output.append(f" {url}")
128
+ output.append(f" {snippet}")
129
+ output.append("")
130
+
131
+ if not output:
132
+ return "No results found"
133
+
134
+ output.insert(0, f"==== Page {page} of results ====")
135
+ output.append(f"==== End of page {page} ====")
136
+
137
+ return "\n".join(output)
138
+
139
+ except Exception as e:
140
+ raise RuntimeError(f"Search failed: {str(e)}")
141
+
142
+
143
+ def main():
144
+ """Demonstrate WikipediaSearchTool functionality."""
145
+ try:
146
+ tool = WikipediaSearchTool()
147
+
148
+ # Test basic search functionality
149
+ print("Testing WikipediaSearchTool with sample query...")
150
+ results = tool.execute(
151
+ query="Python programming",
152
+ page=1,
153
+ num_results=3
154
+ )
155
+ print(results)
156
+
157
+ # Test error handling
158
+ print("\nTesting error handling with invalid query...")
159
+ try:
160
+ tool.execute(query="")
161
+ except ValueError as e:
162
+ print(f"Caught expected ValueError: {e}")
163
+
164
+ except Exception as e:
165
+ print(f"Error in main: {e}")
166
+
167
+
168
+ if __name__ == "__main__":
169
+ main()
@@ -16,7 +16,7 @@ def check_if_is_latest_version() -> (bool,str|None):
16
16
  response = requests.get("https://pypi.org/pypi/quantalogic/json", timeout=5)
17
17
  response.raise_for_status()
18
18
  latest_version = response.json()["info"]["version"]
19
- return version.parse(current_version) <= version.parse(latest_version), latest_version
19
+ return version.parse(current_version) < version.parse(latest_version), latest_version
20
20
  except (requests.RequestException, KeyError):
21
21
  return False, None
22
22
 
File without changes