quantalogic 0.50.2__py3-none-any.whl → 0.50.5__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.
@@ -32,7 +32,7 @@ class LazyLoader:
32
32
  # Map of tool names to their import paths and optional status
33
33
  _TOOL_IMPORTS = {
34
34
  "AgentTool": (".agent_tool", False),
35
- "ComposioTool": (".composio.composio", False),
35
+ "ComposioTool": (".composio.composio", True),
36
36
  "GenerateDatabaseReportTool": (".database.generate_database_report_tool", False),
37
37
  "SQLQueryToolAdvanced": (".database.sql_query_tool_advanced", False),
38
38
  "MarkdownToDocxTool": (".document_tools.markdown_to_docx_tool", True),
@@ -1,17 +1,32 @@
1
1
  """Tool for interacting with Composio API services."""
2
2
 
3
+ import importlib
4
+ import importlib.util
3
5
  import json
4
6
  import os
5
7
  import traceback
6
8
  from datetime import datetime
7
- from typing import Any, Dict, Optional
9
+ from typing import Any, Dict, Optional, Union, TYPE_CHECKING
10
+
11
+ # Type checking imports - these are only used for type hints and not at runtime
12
+ if TYPE_CHECKING:
13
+ from composio import ComposioToolSet
8
14
 
9
- from composio import Action, ComposioToolSet
10
15
  from loguru import logger
11
16
  from pydantic import BaseModel, ConfigDict, Field
12
17
 
13
18
  from quantalogic.tools.tool import Tool, ToolArgument
14
19
 
20
+ # Flag to check if composio is available
21
+ COMPOSIO_AVAILABLE = False
22
+
23
+ # Try to check if composio is importable without actually importing it
24
+ try:
25
+ spec = importlib.util.find_spec("composio")
26
+ COMPOSIO_AVAILABLE = spec is not None
27
+ except ImportError:
28
+ pass
29
+
15
30
 
16
31
  def setup_logger():
17
32
  """Configure Loguru logger with custom format and levels."""
@@ -72,7 +87,7 @@ class ComposioTool(Tool):
72
87
  )
73
88
  action: str = Field(default="") # Single action per tool instance
74
89
  action_schema: Optional[ActionSchema] = None
75
- toolset: Optional[ComposioToolSet] = None
90
+ toolset: Optional['ComposioToolSet'] = None
76
91
 
77
92
  # Performance tracking
78
93
  _last_execution_time: Optional[datetime] = None
@@ -96,6 +111,20 @@ class ComposioTool(Tool):
96
111
  need_validation: Whether this specific instance needs validation
97
112
  **data: Additional data for tool initialization
98
113
  """
114
+ # Check if composio is available
115
+ if not COMPOSIO_AVAILABLE:
116
+ logger.error("ComposioTool cannot be initialized: composio module is not installed")
117
+ raise ImportError("The 'composio' package is required to use ComposioTool. "
118
+ "Install it with 'pip install composio' or include it in your dependencies.")
119
+
120
+ # Import composio only when needed
121
+ try:
122
+ from composio import Action, ComposioToolSet
123
+ except ImportError:
124
+ logger.error("Failed to import composio module")
125
+ raise ImportError("The 'composio' package is required to use ComposioTool. "
126
+ "Install it with 'pip install composio' or include it in your dependencies.")
127
+
99
128
  logger.info(f"Initializing ComposioTool for action: {action}")
100
129
  start_time = datetime.now()
101
130
 
@@ -150,6 +179,14 @@ class ComposioTool(Tool):
150
179
 
151
180
  def _setup_action(self) -> None:
152
181
  """Set up the Composio action with its schema and parameters."""
182
+ # Import composio only when needed
183
+ try:
184
+ from composio import Action, ComposioToolSet
185
+ except ImportError:
186
+ logger.error("Failed to import composio module")
187
+ raise ImportError("The 'composio' package is required to use ComposioTool. "
188
+ "Install it with 'pip install composio' or include it in your dependencies.")
189
+
153
190
  logger.debug(f"Setting up action: {self.action}")
154
191
  start_time = datetime.now()
155
192
 
@@ -345,6 +382,14 @@ class ComposioTool(Tool):
345
382
 
346
383
  def execute(self, **kwargs: Any) -> str:
347
384
  """Execute the Composio action with the given parameters."""
385
+ # Import composio only when needed
386
+ try:
387
+ from composio import Action, ComposioToolSet
388
+ except ImportError:
389
+ logger.error("Failed to import composio module")
390
+ raise ImportError("The 'composio' package is required to use ComposioTool. "
391
+ "Install it with 'pip install composio' or include it in your dependencies.")
392
+
348
393
  start_time = datetime.now()
349
394
  self._execution_count += 1
350
395
  self._last_execution_time = start_time
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quantalogic
3
- Version: 0.50.2
3
+ Version: 0.50.5
4
4
  Summary: QuantaLogic ReAct Agents
5
5
  Author: Raphaël MANSUY
6
6
  Author-email: raphael.mansuy@gmail.com
@@ -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=AeXs2jtnY8mqHz7egpzVkRDl9W8-Gh0_-wyEnmC2QDE,5143
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=l12notWc2okQYq_vrXRirLZyfc4WiTwY1AyLP96qidQ,19657
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.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
145
- quantalogic-0.50.2.dist-info/METADATA,sha256=XQ7ALbdA_f7UR-j7DE6umu3H2gatHiKtR4A2IeYS5Yo,22785
146
- quantalogic-0.50.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
147
- quantalogic-0.50.2.dist-info/entry_points.txt,sha256=h74O_Q3qBRCrDR99qvwB4BpBGzASPUIjCfxHq6Qnups,183
148
- quantalogic-0.50.2.dist-info/RECORD,,
144
+ quantalogic-0.50.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
145
+ quantalogic-0.50.5.dist-info/METADATA,sha256=CfJryWRRsudR8N1CYEcEpizlRo438fLxRTCCeVdIk9Q,22785
146
+ quantalogic-0.50.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
147
+ quantalogic-0.50.5.dist-info/entry_points.txt,sha256=h74O_Q3qBRCrDR99qvwB4BpBGzASPUIjCfxHq6Qnups,183
148
+ quantalogic-0.50.5.dist-info/RECORD,,