aip-agents-binary 0.5.19__py3-none-macosx_13_0_arm64.whl → 0.5.20__py3-none-macosx_13_0_arm64.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.
@@ -1,6 +1,33 @@
1
1
  """Initialize Tools Module for AIP Agents."""
2
2
 
3
+ from importlib import import_module
4
+
3
5
  from aip_agents.tools.bosa_tools import BOSA_AUTOMATED_TOOLS
4
6
  from aip_agents.tools.gl_connector import GLConnectorTool
7
+ from aip_agents.tools.time_tool import TimeTool
8
+ from aip_agents.tools.web_search import GoogleSerperTool
9
+
10
+ __all__ = ["BOSA_AUTOMATED_TOOLS", "GLConnectorTool", "GoogleSerperTool", "TimeTool"]
11
+
12
+
13
+ def _register_optional(module_path: str, export_name: str) -> None:
14
+ """Try to import optional tool module and expose it in __all__.
15
+
16
+ Args:
17
+ module_path: The module path to import.
18
+ export_name: The name to export in __all__.
19
+ """
20
+ try:
21
+ module = import_module(module_path)
22
+ except ImportError:
23
+ return
24
+
25
+ globals()[export_name] = getattr(module, export_name)
26
+ __all__.append(export_name)
27
+
5
28
 
6
- __all__ = ["BOSA_AUTOMATED_TOOLS", "GLConnectorTool"]
29
+ _register_optional("aip_agents.tools.browser_use", "BrowserUseTool")
30
+ _register_optional("aip_agents.tools.code_sandbox", "E2BCodeSandboxTool")
31
+ _register_optional("aip_agents.tools.document_loader", "DocxReaderTool")
32
+ _register_optional("aip_agents.tools.document_loader", "ExcelReaderTool")
33
+ _register_optional("aip_agents.tools.document_loader", "PDFReaderTool")
@@ -1,4 +1,13 @@
1
1
  from aip_agents.tools.bosa_tools import BOSA_AUTOMATED_TOOLS as BOSA_AUTOMATED_TOOLS
2
2
  from aip_agents.tools.gl_connector import GLConnectorTool as GLConnectorTool
3
+ from aip_agents.tools.time_tool import TimeTool as TimeTool
4
+ from aip_agents.tools.web_search import GoogleSerperTool as GoogleSerperTool
3
5
 
4
- __all__ = ['BOSA_AUTOMATED_TOOLS', 'GLConnectorTool']
6
+ __all__ = ['BOSA_AUTOMATED_TOOLS', 'GLConnectorTool', 'GoogleSerperTool', 'TimeTool', 'BrowserUseTool', 'E2BCodeSandboxTool', 'DocxReaderTool', 'ExcelReaderTool', 'PDFReaderTool']
7
+
8
+ # Names in __all__ with no definition:
9
+ # BrowserUseTool
10
+ # DocxReaderTool
11
+ # E2BCodeSandboxTool
12
+ # ExcelReaderTool
13
+ # PDFReaderTool
@@ -0,0 +1,117 @@
1
+ """Tool to get the current time.
2
+
3
+ Authors:
4
+ Saul Sayers (saul.sayers@gdplabs.id)
5
+ """
6
+
7
+ import re
8
+ from datetime import datetime, timedelta, timezone, tzinfo
9
+
10
+ from dateutil import tz
11
+ from langchain_core.tools import BaseTool
12
+ from pydantic import BaseModel, Field
13
+
14
+ FORMAT_STRING = "%m/%d/%y %H:%M:%S"
15
+ DEFAULT_TIMEZONE = "UTC+7"
16
+
17
+
18
+ class TimeToolInput(BaseModel):
19
+ """Input schema for the TimeTool."""
20
+
21
+ datetime_format: str = Field(
22
+ default=FORMAT_STRING,
23
+ description="""
24
+ Optional datetime format string. Default: '%m/%d/%y %H:%M:%S'
25
+
26
+ Common format codes:
27
+ %Y: Year with century (2024)
28
+ %m: Month as number (01-12)
29
+ %d: Day of month (01-31)
30
+ %A: Full weekday name (Wednesday)
31
+ %a: Short weekday name (Wed)
32
+ %H: Hour (00-23)
33
+ %M: Minute (00-59)
34
+ %S: Second (00-59)
35
+ %Z: Timezone name
36
+ %j: Day of year (001-366)
37
+ %W: Week number (00-53, Monday first)
38
+ %U: Week number (00-53, Sunday first)
39
+ %c: Locale's date and time
40
+ %x: Locale's date
41
+ %X: Locale's time
42
+ """,
43
+ )
44
+ timezone: str | None = Field(
45
+ default=DEFAULT_TIMEZONE,
46
+ description="""
47
+ Optional timezone identifier. Supports IANA names (e.g., 'Asia/Jakarta')
48
+ or offsets (e.g., 'UTC+7', 'UTC-04:30'). Default: 'UTC+7' (Asia/Jakarta).
49
+ Highly recommended to be filled when getting the current time to ensure
50
+ the time is in the correct timezone.
51
+ """,
52
+ )
53
+
54
+
55
+ def _parse_timezone(timezone_value: str | None) -> tzinfo | None:
56
+ """Return a tzinfo instance for a given timezone string.
57
+
58
+ Args:
59
+ timezone_value: Timezone string (e.g., "UTC+7", "UTC-5:30") or None.
60
+
61
+ Returns:
62
+ tzinfo instance or None if invalid/None input.
63
+ """
64
+ if timezone_value is None:
65
+ return None
66
+
67
+ tz_string = timezone_value.strip()
68
+ if not tz_string:
69
+ return None
70
+
71
+ offset_match = re.fullmatch(r"UTC([+-])(\d{1,2})(?::?(\d{2}))?$", tz_string.upper())
72
+ if offset_match:
73
+ sign, hours_str, minutes_str = offset_match.groups()
74
+ hours = int(hours_str)
75
+ minutes = int(minutes_str) if minutes_str else 0
76
+ MAX_HOURS_OFFSET = 12
77
+ MINUTES_OFFSETS = [0, 30, 45]
78
+ if hours > MAX_HOURS_OFFSET or minutes not in MINUTES_OFFSETS:
79
+ raise ValueError(f"Invalid timezone offset: {timezone_value}")
80
+ delta = timedelta(hours=hours, minutes=minutes)
81
+ if sign == "-":
82
+ delta = -delta
83
+ return timezone(delta)
84
+
85
+ tzinfo = tz.gettz(tz_string)
86
+ if tzinfo is not None:
87
+ return tzinfo
88
+
89
+ raise ValueError(f"Unknown timezone: {timezone_value}")
90
+
91
+
92
+ class TimeTool(BaseTool):
93
+ """Tool to get the current time."""
94
+
95
+ name: str = "time_tool"
96
+ description: str = """
97
+ Useful for getting the current time in a specified format and timezone.
98
+ Default format: '%m/%d/%y %H:%M:%S' (e.g., '05/15/24 17:30:00')
99
+
100
+ Supports timezone specification to get the current time in any timezone.
101
+ It is highly recommended to specify a timezone to ensure accurate results.
102
+ """
103
+ args_schema: type[BaseModel] = TimeToolInput
104
+
105
+ def _run(self, datetime_format: str = FORMAT_STRING, timezone: str | None = DEFAULT_TIMEZONE) -> str:
106
+ """Get current time formatted according to the specified format and timezone.
107
+
108
+ Args:
109
+ datetime_format: Format string for datetime (default: ISO format).
110
+ timezone: Timezone string (default: UTC).
111
+
112
+ Returns:
113
+ Formatted datetime string.
114
+ """
115
+ tzinfo = _parse_timezone(timezone)
116
+ current_time = datetime.now(tz=tzinfo)
117
+ return current_time.strftime(datetime_format)
@@ -0,0 +1,16 @@
1
+ from langchain_core.tools import BaseTool
2
+ from pydantic import BaseModel
3
+
4
+ FORMAT_STRING: str
5
+ DEFAULT_TIMEZONE: str
6
+
7
+ class TimeToolInput(BaseModel):
8
+ """Input schema for the TimeTool."""
9
+ datetime_format: str
10
+ timezone: str | None
11
+
12
+ class TimeTool(BaseTool):
13
+ """Tool to get the current time."""
14
+ name: str
15
+ description: str
16
+ args_schema: type[BaseModel]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aip-agents-binary
3
- Version: 0.5.19
3
+ Version: 0.5.20
4
4
  Summary: A library for managing agents in Gen AI applications.
5
5
  Author-email: Raymond Christopher <raymond.christopher@gdplabs.id>
6
6
  Requires-Python: <3.13,>=3.11
@@ -370,14 +370,16 @@ aip_agents/storage/providers/memory.py,sha256=81E9yT_oRkH7tMVr5azZv1oXIaeTzTAtTu
370
370
  aip_agents/storage/providers/memory.pyi,sha256=r0meeCsjKyE9FHJqCysfQ5ZH_FWRRv2SWg-NOHCUD-g,2109
371
371
  aip_agents/storage/providers/object_storage.py,sha256=Q268Sn8Y09gS-ilP6fe4CR0YIOvdbunh3V6SmuQsAVs,6413
372
372
  aip_agents/storage/providers/object_storage.pyi,sha256=nBIKJjUAWkIKhYhBFmFcypjoOieIYOghy55f62x7AX8,2878
373
- aip_agents/tools/__init__.py,sha256=1axwxcs8h0hFcPIeslib-9N0Kh0bNn_OzpX6Ac8YlmY,221
374
- aip_agents/tools/__init__.pyi,sha256=11EgOX_y_nTPJCTwgO--owBm5cwo2GXMNKNot75YuHY,217
373
+ aip_agents/tools/__init__.py,sha256=9nQiB63jqn0G45fN3rF7wXmYOn2TrWASGbHBPr6LTd4,1199
374
+ aip_agents/tools/__init__.pyi,sha256=ViizRq0Pv0cFxX90X6WoXZPcWrZ4-dJzbOnw5UgWUmc,619
375
375
  aip_agents/tools/bosa_tools.py,sha256=uhRImaIACt_Ol9nraUGr0ddT8e35c8doVzwlJV6kGeA,3411
376
376
  aip_agents/tools/bosa_tools.pyi,sha256=GpWQhkytk4XS_rKWGBiS70y5mXC8b-1GGCkN1BaE97s,1128
377
377
  aip_agents/tools/constants.py,sha256=pVmUJx8WN1gYtDT52B4FsetnaYZZWozKQQ7wW18xIHo,5274
378
378
  aip_agents/tools/constants.pyi,sha256=QucwMEKTXywF72m8ofImoswbj6zA-BsfP0tRaIy7A6Y,3393
379
379
  aip_agents/tools/memory_search_tool.py,sha256=gqTTb_Fao_Hl-SavfaFsqPDhnFQUjzIQUkzizSD2L0A,653
380
380
  aip_agents/tools/memory_search_tool.pyi,sha256=BCVFEEgH3pETnI9b6vRlMm2_PnnIeBe_vuMlL9y3LpU,453
381
+ aip_agents/tools/time_tool.py,sha256=NPjz73hy1SNc3okWhDXdR45q84vmRUerDGDk_E-XyZk,3732
382
+ aip_agents/tools/time_tool.pyi,sha256=sF8INR8-VRmETquuQ6BIY0geEGXhMLzbcddpnMb0H7k,374
381
383
  aip_agents/tools/tool_config_injector.py,sha256=rk8uqwz-LUpZ_d0cUK0ywxnkzINfTPMN3GMxcKPLVjE,10559
382
384
  aip_agents/tools/tool_config_injector.pyi,sha256=TzxFCQ9KkTT3CSTJfU7lgsW5RcbZ9RqXR8Btyny_dTs,1055
383
385
  aip_agents/tools/browser_use/__init__.py,sha256=_ZYoSads6DRHK9odnPfvEBRDAncIkkFUo7Ach5kPrlI,2118
@@ -538,7 +540,7 @@ aip_agents/utils/pii/pii_helper.py,sha256=g0yRzakfA2AA6vjUNLWHqFlcxyLql6MXQ90NN3
538
540
  aip_agents/utils/pii/pii_helper.pyi,sha256=dulZs150ikbAL3Bw2YLcz3_g4DsGmL3lciwf8mKxEjI,2939
539
541
  aip_agents/utils/pii/uuid_deanonymizer_mapping.py,sha256=Gks8l8t0cuS9pzoQnrpiK1CaLmWYksjOnTeiHh3_7EE,7348
540
542
  aip_agents/utils/pii/uuid_deanonymizer_mapping.pyi,sha256=gnWfD1rWZh_tloJjgKiZ6f6iNUuBaHpKqCSiP0d-9bs,3084
541
- aip_agents_binary-0.5.19.dist-info/METADATA,sha256=3SORaqjs5lh60tl5arWKz10eVrgzUE57LfNKasoEB9g,22207
542
- aip_agents_binary-0.5.19.dist-info/WHEEL,sha256=PaP4PvkDyiSc4C6Dhw6ccQmfxsWFrSv-lJQjBshu0hw,105
543
- aip_agents_binary-0.5.19.dist-info/top_level.txt,sha256=PEz8vcwC1bH4UrkhF0LkIYCNfXGWZUHdSklbvkBe25E,11
544
- aip_agents_binary-0.5.19.dist-info/RECORD,,
543
+ aip_agents_binary-0.5.20.dist-info/METADATA,sha256=mfxqDEti6yRl2Rh5gjxpO278NjMj1UfGq41na3pT_jE,22207
544
+ aip_agents_binary-0.5.20.dist-info/WHEEL,sha256=PaP4PvkDyiSc4C6Dhw6ccQmfxsWFrSv-lJQjBshu0hw,105
545
+ aip_agents_binary-0.5.20.dist-info/top_level.txt,sha256=PEz8vcwC1bH4UrkhF0LkIYCNfXGWZUHdSklbvkBe25E,11
546
+ aip_agents_binary-0.5.20.dist-info/RECORD,,