oagi 0.6.0__py3-none-any.whl → 0.6.2__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.
Potentially problematic release.
This version of oagi might be problematic. Click here for more details.
- oagi/__init__.py +32 -14
- oagi/async_single_step.py +3 -3
- oagi/pil_image.py +2 -1
- oagi/single_step.py +3 -1
- {oagi-0.6.0.dist-info → oagi-0.6.2.dist-info}/METADATA +1 -1
- {oagi-0.6.0.dist-info → oagi-0.6.2.dist-info}/RECORD +8 -8
- {oagi-0.6.0.dist-info → oagi-0.6.2.dist-info}/WHEEL +0 -0
- {oagi-0.6.0.dist-info → oagi-0.6.2.dist-info}/licenses/LICENSE +0 -0
oagi/__init__.py
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
# This file is part of the official API project.
|
|
6
6
|
# Licensed under the MIT License.
|
|
7
7
|
# -----------------------------------------------------------------------------
|
|
8
|
+
import importlib
|
|
8
9
|
|
|
9
|
-
from oagi.async_pyautogui_action_handler import AsyncPyautoguiActionHandler
|
|
10
|
-
from oagi.async_screenshot_maker import AsyncScreenshotMaker
|
|
11
10
|
from oagi.async_single_step import async_single_step
|
|
12
11
|
from oagi.client import AsyncClient, SyncClient
|
|
13
12
|
from oagi.exceptions import (
|
|
@@ -22,9 +21,6 @@ from oagi.exceptions import (
|
|
|
22
21
|
ServerError,
|
|
23
22
|
ValidationError,
|
|
24
23
|
)
|
|
25
|
-
from oagi.pil_image import PILImage
|
|
26
|
-
from oagi.pyautogui_action_handler import PyautoguiActionHandler, PyautoguiConfig
|
|
27
|
-
from oagi.screenshot_maker import ScreenshotMaker
|
|
28
24
|
from oagi.single_step import single_step
|
|
29
25
|
from oagi.task import AsyncShortTask, AsyncTask, ShortTask, Task
|
|
30
26
|
from oagi.types import (
|
|
@@ -34,6 +30,27 @@ from oagi.types import (
|
|
|
34
30
|
)
|
|
35
31
|
from oagi.types.models import ErrorDetail, ErrorResponse, LLMResponse
|
|
36
32
|
|
|
33
|
+
# Lazy imports for pyautogui-dependent modules
|
|
34
|
+
# These will only be imported when actually accessed
|
|
35
|
+
_LAZY_IMPORTS = {
|
|
36
|
+
"AsyncPyautoguiActionHandler": "oagi.async_pyautogui_action_handler",
|
|
37
|
+
"AsyncScreenshotMaker": "oagi.async_screenshot_maker",
|
|
38
|
+
"PILImage": "oagi.pil_image",
|
|
39
|
+
"PyautoguiActionHandler": "oagi.pyautogui_action_handler",
|
|
40
|
+
"PyautoguiConfig": "oagi.pyautogui_action_handler",
|
|
41
|
+
"ScreenshotMaker": "oagi.screenshot_maker",
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def __getattr__(name: str):
|
|
46
|
+
"""Lazy import for pyautogui-dependent modules."""
|
|
47
|
+
if name in _LAZY_IMPORTS:
|
|
48
|
+
module_name = _LAZY_IMPORTS[name]
|
|
49
|
+
module = importlib.import_module(module_name)
|
|
50
|
+
return getattr(module, name)
|
|
51
|
+
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
|
52
|
+
|
|
53
|
+
|
|
37
54
|
__all__ = [
|
|
38
55
|
# Core sync classes
|
|
39
56
|
"Task",
|
|
@@ -46,15 +63,6 @@ __all__ = [
|
|
|
46
63
|
# Functions
|
|
47
64
|
"single_step",
|
|
48
65
|
"async_single_step",
|
|
49
|
-
# Image classes
|
|
50
|
-
"PILImage",
|
|
51
|
-
# Handler classes
|
|
52
|
-
"PyautoguiActionHandler",
|
|
53
|
-
"PyautoguiConfig",
|
|
54
|
-
"ScreenshotMaker",
|
|
55
|
-
# Async handler classes
|
|
56
|
-
"AsyncPyautoguiActionHandler",
|
|
57
|
-
"AsyncScreenshotMaker",
|
|
58
66
|
# Async protocols
|
|
59
67
|
"AsyncActionHandler",
|
|
60
68
|
"AsyncImageProvider",
|
|
@@ -75,4 +83,14 @@ __all__ = [
|
|
|
75
83
|
"ServerError",
|
|
76
84
|
"RequestTimeoutError",
|
|
77
85
|
"ValidationError",
|
|
86
|
+
# Lazy imports
|
|
87
|
+
# Image classes
|
|
88
|
+
"PILImage",
|
|
89
|
+
# Handler classes
|
|
90
|
+
"PyautoguiActionHandler",
|
|
91
|
+
"PyautoguiConfig",
|
|
92
|
+
"ScreenshotMaker",
|
|
93
|
+
# Async handler classes
|
|
94
|
+
"AsyncPyautoguiActionHandler",
|
|
95
|
+
"AsyncScreenshotMaker",
|
|
78
96
|
]
|
oagi/async_single_step.py
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
|
-
from .pil_image import PILImage
|
|
12
11
|
from .task import AsyncTask
|
|
13
12
|
from .types import Image, Step
|
|
14
13
|
|
|
@@ -64,12 +63,13 @@ async def async_single_step(
|
|
|
64
63
|
... screenshot=image
|
|
65
64
|
... )
|
|
66
65
|
"""
|
|
66
|
+
# Lazy import PILImage only when needed
|
|
67
|
+
from .pil_image import PILImage # noqa: PLC0415
|
|
68
|
+
|
|
67
69
|
# Handle different screenshot input types
|
|
68
70
|
if isinstance(screenshot, (str, Path)):
|
|
69
|
-
# Convert file path to PILImage
|
|
70
71
|
screenshot = PILImage.from_file(str(screenshot))
|
|
71
72
|
elif isinstance(screenshot, bytes):
|
|
72
|
-
# Convert bytes to PILImage
|
|
73
73
|
screenshot = PILImage.from_bytes(screenshot)
|
|
74
74
|
|
|
75
75
|
# Create a temporary task instance
|
oagi/pil_image.py
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import io
|
|
10
10
|
from typing import Optional
|
|
11
11
|
|
|
12
|
-
import pyautogui
|
|
13
12
|
from PIL import Image as PILImageLib
|
|
14
13
|
|
|
15
14
|
from .types.models.image_config import ImageConfig
|
|
@@ -39,6 +38,8 @@ class PILImage:
|
|
|
39
38
|
@classmethod
|
|
40
39
|
def from_screenshot(cls, config: ImageConfig | None = None) -> "PILImage":
|
|
41
40
|
"""Create PILImage from screenshot."""
|
|
41
|
+
import pyautogui # noqa: PLC0415, avoid no DISPLAY issue in headless environment
|
|
42
|
+
|
|
42
43
|
screenshot = pyautogui.screenshot()
|
|
43
44
|
return cls(screenshot, config)
|
|
44
45
|
|
oagi/single_step.py
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
|
-
from .pil_image import PILImage
|
|
12
11
|
from .task import Task
|
|
13
12
|
from .types import Image, Step
|
|
14
13
|
|
|
@@ -62,6 +61,9 @@ def single_step(
|
|
|
62
61
|
... screenshot=image
|
|
63
62
|
... )
|
|
64
63
|
"""
|
|
64
|
+
# Lazy import PILImage only when needed
|
|
65
|
+
from .pil_image import PILImage # noqa: PLC0415
|
|
66
|
+
|
|
65
67
|
# Convert file paths to bytes using PILImage
|
|
66
68
|
if isinstance(screenshot, (str, Path)):
|
|
67
69
|
path = Path(screenshot) if isinstance(screenshot, str) else screenshot
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
oagi/__init__.py,sha256=
|
|
1
|
+
oagi/__init__.py,sha256=Mr_V_lXIZa7n7jrxBMxXAWIaGVi7MblDfcrRsX4IrZI,2605
|
|
2
2
|
oagi/async_pyautogui_action_handler.py,sha256=F-lKyePCONWI03WnSxpX_QwxONbvnfdQu51wTod6mdw,1614
|
|
3
3
|
oagi/async_screenshot_maker.py,sha256=pI-dbLcYOzcO1ffgTmozAdbYJQNBPKA7hmqj1RxEmIY,1688
|
|
4
|
-
oagi/async_single_step.py,sha256=
|
|
4
|
+
oagi/async_single_step.py,sha256=FxOSoZKKegHx0by41a4qrJDPoYZV0qZKtdTNMU8Uqz4,2955
|
|
5
5
|
oagi/exceptions.py,sha256=VMwVS8ouE9nHhBpN3AZMYt5_U2kGcihWaTnBhoQLquo,1662
|
|
6
6
|
oagi/logging.py,sha256=CWe89mA5MKTipIvfrqSYkv2CAFNBSwHMDQMDkG_g64g,1350
|
|
7
|
-
oagi/pil_image.py,sha256=
|
|
7
|
+
oagi/pil_image.py,sha256=c-DmvjZLNU3fzZgF0qiEPEXN1UYFpHrxxr4vuxWLaCo,3878
|
|
8
8
|
oagi/pyautogui_action_handler.py,sha256=8IFbU4p907L4b3TV3Eeh0-c-pYL2lYw-_qf1r8TtPTw,9811
|
|
9
9
|
oagi/screenshot_maker.py,sha256=sVuW7jn-K4FmLhmYI-akdNI-UVcTeBzh9P1_qJhoq1s,1282
|
|
10
|
-
oagi/single_step.py,sha256
|
|
10
|
+
oagi/single_step.py,sha256=62Zip4Uql6E-ZIX6vAlrBoveKqrnABzGqHdLCzju4ag,3138
|
|
11
11
|
oagi/client/__init__.py,sha256=F9DShPUdb6vZYmN1fpM1VYzp4MWqUao_e_R1KYmM4Q4,410
|
|
12
12
|
oagi/client/async_.py,sha256=okeFWLqqaVSZF5AD4WZ2_4jVPeZ_SZefe9yrmkF_lX0,4940
|
|
13
13
|
oagi/client/base.py,sha256=qc2Le28MNpRFvjlO0U0z1rjzqCh9-6YZmO5uOoZO_u8,6538
|
|
@@ -29,7 +29,7 @@ oagi/types/models/action.py,sha256=hh6mRRSSWgrW4jpZo71zGMCOcZpV5_COu4148uG6G48,9
|
|
|
29
29
|
oagi/types/models/client.py,sha256=a6aFwoGG5tBNg3Qr_Dd_TYsg6CpKvA-4tU6b6dCQkoU,983
|
|
30
30
|
oagi/types/models/image_config.py,sha256=tl6abVg_-IAPLwpaWprgknXu7wRWriMg-AEVyUX73v0,1567
|
|
31
31
|
oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
|
|
32
|
-
oagi-0.6.
|
|
33
|
-
oagi-0.6.
|
|
34
|
-
oagi-0.6.
|
|
35
|
-
oagi-0.6.
|
|
32
|
+
oagi-0.6.2.dist-info/METADATA,sha256=VGC76x5orIWmHBHuuPZghKdCMJvP1W6q4U-4BINjlJc,4799
|
|
33
|
+
oagi-0.6.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
34
|
+
oagi-0.6.2.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
|
|
35
|
+
oagi-0.6.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|