quantalogic 0.50.1__py3-none-any.whl → 0.50.3__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.
@@ -10,85 +10,94 @@ class LazyLoader:
10
10
  Lazily import a module only when its attributes are accessed.
11
11
  This helps reduce startup time by deferring imports until needed.
12
12
  """
13
- def __init__(self, module_path: str):
13
+ def __init__(self, module_path: str, optional: bool = False):
14
14
  self.module_path = module_path
15
15
  self._module = None
16
+ self.optional = optional
16
17
 
17
18
  def __getattr__(self, name: str) -> Any:
18
19
  if self._module is None:
19
- self._module = importlib.import_module(self.module_path)
20
+ try:
21
+ self._module = importlib.import_module(self.module_path)
22
+ except ImportError as e:
23
+ if self.optional:
24
+ # If the tool is optional, log a warning but don't raise an error
25
+ print(f"Warning: Optional tool {self.module_path} could not be imported: {e}")
26
+ return None
27
+ raise
28
+
20
29
  return getattr(self._module, name)
21
30
 
22
31
 
23
- # Map of tool names to their import paths
32
+ # Map of tool names to their import paths and optional status
24
33
  _TOOL_IMPORTS = {
25
- "AgentTool": ".agent_tool",
26
- "ComposioTool": ".composio.composio",
27
- "GenerateDatabaseReportTool": ".database.generate_database_report_tool",
28
- "SQLQueryToolAdvanced": ".database.sql_query_tool_advanced",
29
- "MarkdownToDocxTool": ".document_tools.markdown_to_docx_tool",
30
- "MarkdownToEpubTool": ".document_tools.markdown_to_epub_tool",
31
- "MarkdownToHtmlTool": ".document_tools.markdown_to_html_tool",
32
- "MarkdownToIpynbTool": ".document_tools.markdown_to_ipynb_tool",
33
- "MarkdownToLatexTool": ".document_tools.markdown_to_latex_tool",
34
- "MarkdownToPdfTool": ".document_tools.markdown_to_pdf_tool",
35
- "MarkdownToPptxTool": ".document_tools.markdown_to_pptx_tool",
36
- "DownloadHttpFileTool": ".download_http_file_tool",
37
- "DuckDuckGoSearchTool": ".duckduckgo_search_tool",
38
- "EditWholeContentTool": ".edit_whole_content_tool",
39
- "ElixirTool": ".elixir_tool",
40
- "ExecuteBashCommandTool": ".execute_bash_command_tool",
41
- "BitbucketCloneTool": ".git.bitbucket_clone_repo_tool",
42
- "BitbucketOperationsTool": ".git.bitbucket_operations_tool",
43
- "CloneRepoTool": ".git.clone_repo_tool",
44
- "GitOperationsTool": ".git.git_operations_tool",
45
- "GoogleNewsTool": ".google_packages.google_news_tool",
46
- "GrepAppTool": ".grep_app_tool",
47
- "LLMImageGenerationTool": ".image_generation.dalle_e",
48
- "InputQuestionTool": ".input_question_tool",
49
- "JinjaTool": ".jinja_tool",
50
- "ListDirectoryTool": ".list_directory_tool",
51
- "LLMTool": ".llm_tool",
52
- "LLMVisionTool": ".llm_vision_tool",
53
- "MarkitdownTool": ".markitdown_tool",
54
- "NasaApodTool": ".nasa_packages.nasa_apod_tool",
55
- "NasaNeoWsTool": ".nasa_packages.nasa_neows_tool",
56
- "NodeJsTool": ".nodejs_tool",
57
- "PresentationLLMTool": ".presentation_tools.presentation_llm_tool",
58
- "ProductHuntTool": ".product_hunt.product_hunt_tool",
59
- "PythonTool": ".python_tool",
60
- "RagTool": ".rag_tool.rag_tool",
61
- "ReadFileBlockTool": ".read_file_block_tool",
62
- "ReadFileTool": ".read_file_tool",
63
- "ReadHTMLTool": ".read_html_tool",
64
- "ReplaceInFileTool": ".replace_in_file_tool",
65
- "RipgrepTool": ".ripgrep_tool",
66
- "SafePythonInterpreterTool": ".safe_python_interpreter_tool",
67
- "SearchDefinitionNames": ".search_definition_names",
68
- "SequenceTool": ".sequence_tool",
69
- "SerpApiSearchTool": ".serpapi_search_tool",
70
- "SQLQueryTool": ".sql_query_tool",
71
- "TaskCompleteTool": ".task_complete_tool",
72
- "Tool": ".tool",
73
- "ToolArgument": ".tool",
74
- "UnifiedDiffTool": ".unified_diff_tool",
75
- "CSVProcessorTool": ".utilities.csv_processor_tool",
76
- "PrepareDownloadTool": ".utilities.download_file_tool",
77
- "MermaidValidatorTool": ".utilities.mermaid_validator_tool",
78
- "WikipediaSearchTool": ".wikipedia_search_tool",
79
- "WriteFileTool": ".write_file_tool",
34
+ "AgentTool": (".agent_tool", False),
35
+ "ComposioTool": (".composio.composio", True),
36
+ "GenerateDatabaseReportTool": (".database.generate_database_report_tool", False),
37
+ "SQLQueryToolAdvanced": (".database.sql_query_tool_advanced", False),
38
+ "MarkdownToDocxTool": (".document_tools.markdown_to_docx_tool", True),
39
+ "MarkdownToEpubTool": (".document_tools.markdown_to_epub_tool", True),
40
+ "MarkdownToHtmlTool": (".document_tools.markdown_to_html_tool", True),
41
+ "MarkdownToIpynbTool": (".document_tools.markdown_to_ipynb_tool", True),
42
+ "MarkdownToLatexTool": (".document_tools.markdown_to_latex_tool", True),
43
+ "MarkdownToPdfTool": (".document_tools.markdown_to_pdf_tool", True),
44
+ "MarkdownToPptxTool": (".document_tools.markdown_to_pptx_tool", True),
45
+ "DownloadHttpFileTool": (".download_http_file_tool", False),
46
+ "DuckDuckGoSearchTool": (".duckduckgo_search_tool", False),
47
+ "EditWholeContentTool": (".edit_whole_content_tool", False),
48
+ "ElixirTool": (".elixir_tool", False),
49
+ "ExecuteBashCommandTool": (".execute_bash_command_tool", False),
50
+ "BitbucketCloneTool": (".git.bitbucket_clone_repo_tool", False),
51
+ "BitbucketOperationsTool": (".git.bitbucket_operations_tool", False),
52
+ "CloneRepoTool": (".git.clone_repo_tool", False),
53
+ "GitOperationsTool": (".git.git_operations_tool", False),
54
+ "GoogleNewsTool": (".google_packages.google_news_tool", False),
55
+ "GrepAppTool": (".grep_app_tool", False),
56
+ "LLMImageGenerationTool": (".image_generation.dalle_e", False),
57
+ "InputQuestionTool": (".input_question_tool", False),
58
+ "JinjaTool": (".jinja_tool", False),
59
+ "ListDirectoryTool": (".list_directory_tool", False),
60
+ "LLMTool": (".llm_tool", False),
61
+ "LLMVisionTool": (".llm_vision_tool", False),
62
+ "MarkitdownTool": (".markitdown_tool", False),
63
+ "NasaApodTool": (".nasa_packages.nasa_apod_tool", False),
64
+ "NasaNeoWsTool": (".nasa_packages.nasa_neows_tool", False),
65
+ "NodeJsTool": (".nodejs_tool", False),
66
+ "PresentationLLMTool": (".presentation_tools.presentation_llm_tool", False),
67
+ "ProductHuntTool": (".product_hunt.product_hunt_tool", False),
68
+ "PythonTool": (".python_tool", False),
69
+ "RagTool": (".rag_tool.rag_tool", False),
70
+ "ReadFileBlockTool": (".read_file_block_tool", False),
71
+ "ReadFileTool": (".read_file_tool", False),
72
+ "ReadHTMLTool": (".read_html_tool", False),
73
+ "ReplaceInFileTool": (".replace_in_file_tool", False),
74
+ "RipgrepTool": (".ripgrep_tool", False),
75
+ "SafePythonInterpreterTool": (".safe_python_interpreter_tool", False),
76
+ "SearchDefinitionNames": (".search_definition_names", False),
77
+ "SequenceTool": (".sequence_tool", False),
78
+ "SerpApiSearchTool": (".serpapi_search_tool", False),
79
+ "SQLQueryTool": (".sql_query_tool", False),
80
+ "TaskCompleteTool": (".task_complete_tool", False),
81
+ "Tool": (".tool", False),
82
+ "ToolArgument": (".tool", False),
83
+ "UnifiedDiffTool": (".unified_diff_tool", False),
84
+ "CSVProcessorTool": (".utilities.csv_processor_tool", False),
85
+ "PrepareDownloadTool": (".utilities.download_file_tool", False),
86
+ "MermaidValidatorTool": (".utilities.mermaid_validator_tool", False),
87
+ "WikipediaSearchTool": (".wikipedia_search_tool", False),
88
+ "WriteFileTool": (".write_file_tool", False),
80
89
  }
81
90
 
82
91
  # Create lazy loaders for each module path
83
92
  _lazy_modules: Dict[str, LazyLoader] = {}
84
- for tool, path in _TOOL_IMPORTS.items():
93
+ for tool, (path, optional) in _TOOL_IMPORTS.items():
85
94
  full_path = f"{__package__}{path}"
86
95
  if full_path not in _lazy_modules:
87
- _lazy_modules[full_path] = LazyLoader(full_path)
96
+ _lazy_modules[full_path] = LazyLoader(full_path, optional)
88
97
 
89
98
  # Set up attributes for lazy loading
90
99
  _tools_to_lazy_modules = {}
91
- for tool, path in _TOOL_IMPORTS.items():
100
+ for tool, (path, optional) in _TOOL_IMPORTS.items():
92
101
  full_path = f"{__package__}{path}"
93
102
  _tools_to_lazy_modules[tool] = _lazy_modules[full_path]
94
103
 
@@ -4,12 +4,24 @@ import json
4
4
  import os
5
5
  import traceback
6
6
  from datetime import datetime
7
- from typing import Any, Dict, Optional
7
+ from typing import Any, Dict, Optional, Union
8
8
 
9
- from composio import Action, ComposioToolSet
10
9
  from loguru import logger
11
10
  from pydantic import BaseModel, ConfigDict, Field
12
11
 
12
+ # Try to import composio, but don't fail if it's not installed
13
+ try:
14
+ from composio import Action, ComposioToolSet
15
+ COMPOSIO_AVAILABLE = True
16
+ except ImportError:
17
+ logger.warning("composio module not installed. ComposioTool will not be available.")
18
+ COMPOSIO_AVAILABLE = False
19
+ # Create dummy classes to avoid errors
20
+ class Action:
21
+ pass
22
+ class ComposioToolSet:
23
+ pass
24
+
13
25
  from quantalogic.tools.tool import Tool, ToolArgument
14
26
 
15
27
 
@@ -96,6 +108,12 @@ class ComposioTool(Tool):
96
108
  need_validation: Whether this specific instance needs validation
97
109
  **data: Additional data for tool initialization
98
110
  """
111
+ # Check if composio is available
112
+ if not COMPOSIO_AVAILABLE:
113
+ logger.error("ComposioTool cannot be initialized: composio module is not installed")
114
+ raise ImportError("The 'composio' package is required to use ComposioTool. "
115
+ "Install it with 'pip install composio' or include it in your dependencies.")
116
+
99
117
  logger.info(f"Initializing ComposioTool for action: {action}")
100
118
  start_time = datetime.now()
101
119
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantalogic
3
- Version: 0.50.1
3
+ Version: 0.50.3
4
4
  Summary: QuantaLogic ReAct Agents
5
5
  Author: Raphaël MANSUY
6
6
  Author-email: raphael.mansuy@gmail.com
@@ -9,11 +9,14 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.12
10
10
  Classifier: Programming Language :: Python :: 3.13
11
11
  Requires-Dist: click (>=8.1.8,<9.0.0)
12
+ Requires-Dist: instructor (>=1.7.2,<2.0.0)
12
13
  Requires-Dist: jinja2 (>=3.1.5,<4.0.0)
13
14
  Requires-Dist: litellm (>=1.56.4,<2.0.0)
14
15
  Requires-Dist: loguru (>=0.7.3,<0.8.0)
16
+ Requires-Dist: pathspec (>=0.12.1,<0.13.0)
15
17
  Requires-Dist: prompt-toolkit (>=3.0.48,<4.0.0)
16
18
  Requires-Dist: pydantic (>=2.10.4,<3.0.0)
19
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
17
20
  Requires-Dist: rich (>=13.9.4,<14.0.0)
18
21
  Requires-Dist: tenacity (>=9.0.0,<10.0.0)
19
22
  Description-Content-Type: text/markdown
@@ -38,9 +38,9 @@ quantalogic/server/templates/index.html,sha256=nDnXJoQEm1vXbhXtgaYk0G5VXj0wwzE6K
38
38
  quantalogic/task_file_reader.py,sha256=oPcB4vTxJ__Y8o7VVABIPOkVw3tGDMdQYwdK27PERlE,1440
39
39
  quantalogic/task_runner.py,sha256=c2QVGKZfHA0wZIBUvehpjMvtRaKZuhuYQerjIiCC9iY,10053
40
40
  quantalogic/tool_manager.py,sha256=vNA7aBKgdU3wpw_goom6i9rg_64pNZapNxvg4cUhhCI,6983
41
- quantalogic/tools/__init__.py,sha256=7_IhMLCJW3Hj1Uo0bXqFqIP71YQ2VTLBPCFCX6AnSag,4212
41
+ quantalogic/tools/__init__.py,sha256=Hpgt8RslYAwAfaKYunTFz_tsNdIZUXH5ovssNZu0H0c,5142
42
42
  quantalogic/tools/agent_tool.py,sha256=MXCXxWHRch7VK4UWhtRP1jeI8Np9Ne2CUGo8vm1oZiM,3064
43
- quantalogic/tools/composio/composio.py,sha256=icVHA_Scr1pViBhahGGBGBRBl9JSB3hGSqpgQzAIUH8,17627
43
+ quantalogic/tools/composio/composio.py,sha256=1FJ8lyZUslQpewX7WUF-sanF0f52gmL0-ZQFBXkiqaE,18373
44
44
  quantalogic/tools/database/generate_database_report_tool.py,sha256=lGgER2VuHqnxliPM806tbwJh7WRW9HJcbBLL7QMvVBQ,1861
45
45
  quantalogic/tools/database/sql_query_tool_advanced.py,sha256=Vale-5nR3e-Mm4joOBII8T1PbLcshXYbM8Mp4TJsS30,9425
46
46
  quantalogic/tools/document_tools/markdown_to_docx_tool.py,sha256=r5AOyQfpcDoqQ6_g2uYyVjTEPtfeNn4mDmmefNZmJyM,22553
@@ -141,8 +141,8 @@ quantalogic/version_check.py,sha256=JyQFTNMDWtpHCLnN-BiakzB2cyXf6kUFsTjvmSruZi4,
141
141
  quantalogic/welcome_message.py,sha256=o4tHdgabNuIV9kbIDPgS3_2yzJhayK30oKad2UouYDc,3020
142
142
  quantalogic/xml_parser.py,sha256=AKuMdJC3QAX3Z_tErHVlZ-msjPemWaZUFiTwkHz76jg,11614
143
143
  quantalogic/xml_tool_parser.py,sha256=Vz4LEgDbelJynD1siLOVkJ3gLlfHsUk65_gCwbYJyGc,3784
144
- quantalogic-0.50.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
145
- quantalogic-0.50.1.dist-info/METADATA,sha256=0GmRS_5DQVkR2tFLJAKH2PIcSkRk6tVRT4FhwR5Vmeg,22657
146
- quantalogic-0.50.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
147
- quantalogic-0.50.1.dist-info/entry_points.txt,sha256=h74O_Q3qBRCrDR99qvwB4BpBGzASPUIjCfxHq6Qnups,183
148
- quantalogic-0.50.1.dist-info/RECORD,,
144
+ quantalogic-0.50.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
145
+ quantalogic-0.50.3.dist-info/METADATA,sha256=8yPjleuhCSPRiv7lwPRB5vObHFWMyrU0Ih7A4W2PA1Y,22785
146
+ quantalogic-0.50.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
147
+ quantalogic-0.50.3.dist-info/entry_points.txt,sha256=h74O_Q3qBRCrDR99qvwB4BpBGzASPUIjCfxHq6Qnups,183
148
+ quantalogic-0.50.3.dist-info/RECORD,,