oagi 0.2.1__py3-none-any.whl → 0.3.0__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 +6 -0
- oagi/pil_image.py +98 -0
- oagi/screenshot_maker.py +16 -48
- oagi/short_task.py +8 -0
- oagi/single_step.py +4 -3
- oagi/task.py +7 -2
- oagi/types/__init__.py +10 -2
- oagi/types/models/__init__.py +2 -1
- oagi/types/models/image_config.py +47 -0
- oagi-0.3.0.dist-info/METADATA +119 -0
- oagi-0.3.0.dist-info/RECORD +22 -0
- oagi-0.2.1.dist-info/METADATA +0 -55
- oagi-0.2.1.dist-info/RECORD +0 -20
- {oagi-0.2.1.dist-info → oagi-0.3.0.dist-info}/WHEEL +0 -0
- {oagi-0.2.1.dist-info → oagi-0.3.0.dist-info}/licenses/LICENSE +0 -0
oagi/__init__.py
CHANGED
|
@@ -18,12 +18,14 @@ from oagi.exceptions import (
|
|
|
18
18
|
ServerError,
|
|
19
19
|
ValidationError,
|
|
20
20
|
)
|
|
21
|
+
from oagi.pil_image import PILImage
|
|
21
22
|
from oagi.pyautogui_action_handler import PyautoguiActionHandler
|
|
22
23
|
from oagi.screenshot_maker import ScreenshotMaker
|
|
23
24
|
from oagi.short_task import ShortTask
|
|
24
25
|
from oagi.single_step import single_step
|
|
25
26
|
from oagi.sync_client import ErrorDetail, ErrorResponse, LLMResponse, SyncClient
|
|
26
27
|
from oagi.task import Task
|
|
28
|
+
from oagi.types import ImageConfig
|
|
27
29
|
|
|
28
30
|
__all__ = [
|
|
29
31
|
# Core classes
|
|
@@ -32,9 +34,13 @@ __all__ = [
|
|
|
32
34
|
"SyncClient",
|
|
33
35
|
# Functions
|
|
34
36
|
"single_step",
|
|
37
|
+
# Image classes
|
|
38
|
+
"PILImage",
|
|
35
39
|
# Handler classes
|
|
36
40
|
"PyautoguiActionHandler",
|
|
37
41
|
"ScreenshotMaker",
|
|
42
|
+
# Configuration
|
|
43
|
+
"ImageConfig",
|
|
38
44
|
# Response models
|
|
39
45
|
"LLMResponse",
|
|
40
46
|
"ErrorResponse",
|
oagi/pil_image.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) OpenAGI Foundation
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# This file is part of the official API project.
|
|
6
|
+
# Licensed under the MIT License.
|
|
7
|
+
# -----------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
import io
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
import pyautogui
|
|
13
|
+
from PIL import Image as PILImageLib
|
|
14
|
+
|
|
15
|
+
from .types.models.image_config import ImageConfig
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PILImage:
|
|
19
|
+
"""PIL image wrapper with transformation capabilities."""
|
|
20
|
+
|
|
21
|
+
def __init__(self, image: PILImageLib.Image, config: ImageConfig | None = None):
|
|
22
|
+
"""Initialize with a PIL image and optional config."""
|
|
23
|
+
self.image = image
|
|
24
|
+
self.config = config or ImageConfig()
|
|
25
|
+
self._cached_bytes: Optional[bytes] = None
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
def from_file(cls, path: str, config: ImageConfig | None = None) -> "PILImage":
|
|
29
|
+
"""Create PILImage from file path."""
|
|
30
|
+
image = PILImageLib.open(path)
|
|
31
|
+
return cls(image, config)
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_bytes(cls, data: bytes, config: ImageConfig | None = None) -> "PILImage":
|
|
35
|
+
"""Create PILImage from raw bytes."""
|
|
36
|
+
image = PILImageLib.open(io.BytesIO(data))
|
|
37
|
+
return cls(image, config)
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def from_screenshot(cls, config: ImageConfig | None = None) -> "PILImage":
|
|
41
|
+
"""Create PILImage from screenshot."""
|
|
42
|
+
screenshot = pyautogui.screenshot()
|
|
43
|
+
return cls(screenshot, config)
|
|
44
|
+
|
|
45
|
+
def transform(self, config: ImageConfig) -> "PILImage":
|
|
46
|
+
"""Apply transformations (resize) based on config and return new PILImage."""
|
|
47
|
+
# Apply resize if needed
|
|
48
|
+
transformed = self._resize(self.image, config)
|
|
49
|
+
# Return new PILImage with the config (format conversion happens on read())
|
|
50
|
+
return PILImage(transformed, config)
|
|
51
|
+
|
|
52
|
+
def _resize(
|
|
53
|
+
self, image: PILImageLib.Image, config: ImageConfig
|
|
54
|
+
) -> PILImageLib.Image:
|
|
55
|
+
"""Resize image based on config."""
|
|
56
|
+
if config.width or config.height:
|
|
57
|
+
# Get target dimensions (use original if not specified)
|
|
58
|
+
target_width = config.width or image.width
|
|
59
|
+
target_height = config.height or image.height
|
|
60
|
+
|
|
61
|
+
# Map resample string to PIL constant
|
|
62
|
+
resample_map = {
|
|
63
|
+
"NEAREST": PILImageLib.NEAREST,
|
|
64
|
+
"BILINEAR": PILImageLib.BILINEAR,
|
|
65
|
+
"BICUBIC": PILImageLib.BICUBIC,
|
|
66
|
+
"LANCZOS": PILImageLib.LANCZOS,
|
|
67
|
+
}
|
|
68
|
+
resample = resample_map[config.resample]
|
|
69
|
+
|
|
70
|
+
# Resize to exact dimensions
|
|
71
|
+
return image.resize((target_width, target_height), resample)
|
|
72
|
+
return image
|
|
73
|
+
|
|
74
|
+
def _convert_format(self, image: PILImageLib.Image) -> bytes:
|
|
75
|
+
"""Convert image to configured format (PNG or JPEG)."""
|
|
76
|
+
buffer = io.BytesIO()
|
|
77
|
+
save_kwargs = {"format": self.config.format}
|
|
78
|
+
|
|
79
|
+
if self.config.format == "JPEG":
|
|
80
|
+
save_kwargs["quality"] = self.config.quality
|
|
81
|
+
# Convert RGBA to RGB for JPEG if needed
|
|
82
|
+
if image.mode == "RGBA":
|
|
83
|
+
rgb_image = PILImageLib.new("RGB", image.size, (255, 255, 255))
|
|
84
|
+
rgb_image.paste(image, mask=image.split()[3])
|
|
85
|
+
rgb_image.save(buffer, **save_kwargs)
|
|
86
|
+
else:
|
|
87
|
+
image.save(buffer, **save_kwargs)
|
|
88
|
+
elif self.config.format == "PNG":
|
|
89
|
+
save_kwargs["optimize"] = self.config.optimize
|
|
90
|
+
image.save(buffer, **save_kwargs)
|
|
91
|
+
|
|
92
|
+
return buffer.getvalue()
|
|
93
|
+
|
|
94
|
+
def read(self) -> bytes:
|
|
95
|
+
"""Read image as bytes with current config (implements Image protocol)."""
|
|
96
|
+
if self._cached_bytes is None:
|
|
97
|
+
self._cached_bytes = self._convert_format(self.image)
|
|
98
|
+
return self._cached_bytes
|
oagi/screenshot_maker.py
CHANGED
|
@@ -6,68 +6,36 @@
|
|
|
6
6
|
# Licensed under the MIT License.
|
|
7
7
|
# -----------------------------------------------------------------------------
|
|
8
8
|
|
|
9
|
-
import io
|
|
10
9
|
from typing import Optional
|
|
11
10
|
|
|
12
|
-
import
|
|
13
|
-
|
|
11
|
+
from .pil_image import PILImage
|
|
14
12
|
from .types import Image
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class FileImage:
|
|
18
|
-
def __init__(self, path: str):
|
|
19
|
-
self.path = path
|
|
20
|
-
with open(path, "rb") as f:
|
|
21
|
-
self.data = f.read()
|
|
22
|
-
|
|
23
|
-
def read(self) -> bytes:
|
|
24
|
-
return self.data
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class MockImage:
|
|
28
|
-
def read(self) -> bytes:
|
|
29
|
-
return b"mock screenshot data"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class ScreenshotImage:
|
|
33
|
-
"""Image class that wraps a pyautogui screenshot."""
|
|
34
|
-
|
|
35
|
-
def __init__(self, screenshot):
|
|
36
|
-
"""Initialize with a PIL Image from pyautogui."""
|
|
37
|
-
self.screenshot = screenshot
|
|
38
|
-
self._cached_bytes: Optional[bytes] = None
|
|
39
|
-
|
|
40
|
-
def read(self) -> bytes:
|
|
41
|
-
"""Convert the screenshot to bytes (PNG format)."""
|
|
42
|
-
if self._cached_bytes is None:
|
|
43
|
-
# Convert PIL Image to bytes
|
|
44
|
-
buffer = io.BytesIO()
|
|
45
|
-
self.screenshot.save(buffer, format="PNG")
|
|
46
|
-
self._cached_bytes = buffer.getvalue()
|
|
47
|
-
return self._cached_bytes
|
|
13
|
+
from .types.models.image_config import ImageConfig
|
|
48
14
|
|
|
49
15
|
|
|
50
16
|
class ScreenshotMaker:
|
|
51
17
|
"""Takes screenshots using pyautogui."""
|
|
52
18
|
|
|
53
|
-
def __init__(self):
|
|
54
|
-
self.
|
|
19
|
+
def __init__(self, config: ImageConfig | None = None):
|
|
20
|
+
self.config = config or ImageConfig()
|
|
21
|
+
self._last_image: Optional[PILImage] = None
|
|
55
22
|
|
|
56
23
|
def __call__(self) -> Image:
|
|
57
|
-
"""Take
|
|
58
|
-
#
|
|
59
|
-
|
|
24
|
+
"""Take and process a screenshot."""
|
|
25
|
+
# Create PILImage from screenshot
|
|
26
|
+
pil_image = PILImage.from_screenshot()
|
|
60
27
|
|
|
61
|
-
#
|
|
62
|
-
|
|
28
|
+
# Apply transformation if config is set
|
|
29
|
+
if self.config:
|
|
30
|
+
pil_image = pil_image.transform(self.config)
|
|
63
31
|
|
|
64
|
-
# Store as the last
|
|
65
|
-
self.
|
|
32
|
+
# Store as the last image
|
|
33
|
+
self._last_image = pil_image
|
|
66
34
|
|
|
67
|
-
return
|
|
35
|
+
return pil_image
|
|
68
36
|
|
|
69
37
|
def last_image(self) -> Image:
|
|
70
38
|
"""Return the last screenshot taken, or take a new one if none exists."""
|
|
71
|
-
if self.
|
|
39
|
+
if self._last_image is None:
|
|
72
40
|
return self()
|
|
73
|
-
return self.
|
|
41
|
+
return self._last_image
|
oagi/short_task.py
CHANGED
|
@@ -16,6 +16,14 @@ logger = get_logger("short_task")
|
|
|
16
16
|
class ShortTask(Task):
|
|
17
17
|
"""Task implementation with automatic mode for short-duration tasks."""
|
|
18
18
|
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
api_key: str | None = None,
|
|
22
|
+
base_url: str | None = None,
|
|
23
|
+
model: str = "vision-model-v1",
|
|
24
|
+
):
|
|
25
|
+
super().__init__(api_key=api_key, base_url=base_url, model=model)
|
|
26
|
+
|
|
19
27
|
def auto_mode(
|
|
20
28
|
self,
|
|
21
29
|
task_desc: str,
|
oagi/single_step.py
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
|
+
from .pil_image import PILImage
|
|
11
12
|
from .task import Task
|
|
12
13
|
from .types import Image, Step
|
|
13
14
|
|
|
@@ -59,12 +60,12 @@ def single_step(
|
|
|
59
60
|
... screenshot=image
|
|
60
61
|
... )
|
|
61
62
|
"""
|
|
62
|
-
# Convert file paths to bytes
|
|
63
|
+
# Convert file paths to bytes using PILImage
|
|
63
64
|
if isinstance(screenshot, (str, Path)):
|
|
64
65
|
path = Path(screenshot) if isinstance(screenshot, str) else screenshot
|
|
65
66
|
if path.exists():
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
pil_image = PILImage.from_file(str(path))
|
|
68
|
+
screenshot_bytes = pil_image.read()
|
|
68
69
|
else:
|
|
69
70
|
raise FileNotFoundError(f"Screenshot file not found: {path}")
|
|
70
71
|
elif isinstance(screenshot, bytes):
|
oagi/task.py
CHANGED
|
@@ -16,13 +16,18 @@ logger = get_logger("task")
|
|
|
16
16
|
class Task:
|
|
17
17
|
"""Base class for task automation with the OAGI API."""
|
|
18
18
|
|
|
19
|
-
def __init__(
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
api_key: str | None = None,
|
|
22
|
+
base_url: str | None = None,
|
|
23
|
+
model: str = "vision-model-v1",
|
|
24
|
+
):
|
|
20
25
|
self.client = SyncClient(base_url=base_url, api_key=api_key)
|
|
21
26
|
self.api_key = self.client.api_key
|
|
22
27
|
self.base_url = self.client.base_url
|
|
23
28
|
self.task_id: str | None = None
|
|
24
29
|
self.task_description: str | None = None
|
|
25
|
-
self.model =
|
|
30
|
+
self.model = model
|
|
26
31
|
|
|
27
32
|
def init_task(self, task_desc: str, max_steps: int = 5):
|
|
28
33
|
"""Initialize a new task with the given description."""
|
oagi/types/__init__.py
CHANGED
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
from .action_handler import ActionHandler
|
|
10
10
|
from .image import Image
|
|
11
11
|
from .image_provider import ImageProvider
|
|
12
|
-
from .models import Action, ActionType, Step
|
|
12
|
+
from .models import Action, ActionType, ImageConfig, Step
|
|
13
13
|
|
|
14
|
-
__all__ = [
|
|
14
|
+
__all__ = [
|
|
15
|
+
"Action",
|
|
16
|
+
"ActionType",
|
|
17
|
+
"Image",
|
|
18
|
+
"ImageConfig",
|
|
19
|
+
"Step",
|
|
20
|
+
"ActionHandler",
|
|
21
|
+
"ImageProvider",
|
|
22
|
+
]
|
oagi/types/models/__init__.py
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
# -----------------------------------------------------------------------------
|
|
8
8
|
|
|
9
9
|
from .action import Action, ActionType
|
|
10
|
+
from .image_config import ImageConfig
|
|
10
11
|
from .step import Step
|
|
11
12
|
|
|
12
|
-
__all__ = ["Action", "ActionType", "Step"]
|
|
13
|
+
__all__ = ["Action", "ActionType", "ImageConfig", "Step"]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) OpenAGI Foundation
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# This file is part of the official API project.
|
|
6
|
+
# Licensed under the MIT License.
|
|
7
|
+
# -----------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
from typing import Literal
|
|
10
|
+
|
|
11
|
+
from pydantic import BaseModel, Field, field_validator
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ImageConfig(BaseModel):
|
|
15
|
+
"""Configuration for image capture and processing."""
|
|
16
|
+
|
|
17
|
+
format: Literal["PNG", "JPEG"] = Field(
|
|
18
|
+
default="JPEG", description="Image format for encoding"
|
|
19
|
+
)
|
|
20
|
+
quality: int = Field(
|
|
21
|
+
default=85,
|
|
22
|
+
ge=1,
|
|
23
|
+
le=100,
|
|
24
|
+
description="JPEG quality (1-100, only applies to JPEG format)",
|
|
25
|
+
)
|
|
26
|
+
width: int | None = Field(
|
|
27
|
+
default=1260, description="Target width in pixels (will resize to exact size)"
|
|
28
|
+
)
|
|
29
|
+
height: int | None = Field(
|
|
30
|
+
default=700, description="Target height in pixels (will resize to exact size)"
|
|
31
|
+
)
|
|
32
|
+
optimize: bool = Field(
|
|
33
|
+
default=False,
|
|
34
|
+
description="Enable PNG optimization (only applies to PNG format)",
|
|
35
|
+
)
|
|
36
|
+
resample: Literal["NEAREST", "BILINEAR", "BICUBIC", "LANCZOS"] = Field(
|
|
37
|
+
default="LANCZOS", description="Resampling filter for resizing"
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
@field_validator("quality")
|
|
41
|
+
@classmethod
|
|
42
|
+
def validate_quality(cls, v: int, info) -> int:
|
|
43
|
+
"""Validate quality parameter based on format."""
|
|
44
|
+
values = info.data
|
|
45
|
+
if values.get("format") == "PNG" and v != 85:
|
|
46
|
+
return 85
|
|
47
|
+
return v
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: oagi
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Official API of OpenAGI Foundation
|
|
5
|
+
Project-URL: Homepage, https://github.com/agiopen-org/oagi
|
|
6
|
+
Author-email: OpenAGI Foundation <contact@agiopen.org>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 OpenAGI Foundation
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: httpx>=0.28.0
|
|
30
|
+
Requires-Dist: pillow>=11.3.0
|
|
31
|
+
Requires-Dist: pyautogui>=0.9.54
|
|
32
|
+
Requires-Dist: pydantic>=2.0.0
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# OAGI Python SDK
|
|
36
|
+
|
|
37
|
+
Python SDK for the OAGI API - vision-based task automation.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install oagi # requires Python >= 3.10
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
Set your API credentials:
|
|
48
|
+
```bash
|
|
49
|
+
export OAGI_API_KEY="your-api-key"
|
|
50
|
+
export OAGI_BASE_URL="https://api.oagi.com" # or your server URL
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Single-Step Analysis
|
|
54
|
+
|
|
55
|
+
Analyze a screenshot and get recommended actions:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from oagi import single_step
|
|
59
|
+
|
|
60
|
+
step = single_step(
|
|
61
|
+
task_description="Click the submit button",
|
|
62
|
+
screenshot="screenshot.png" # or bytes, or Image object
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
print(f"Actions: {step.actions}")
|
|
66
|
+
print(f"Complete: {step.is_complete}")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Automated Task Execution
|
|
70
|
+
|
|
71
|
+
Run tasks automatically with screenshot capture and action execution:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from oagi import ShortTask, ScreenshotMaker, PyautoguiActionHandler
|
|
75
|
+
|
|
76
|
+
task = ShortTask()
|
|
77
|
+
completed = task.auto_mode(
|
|
78
|
+
"Search weather on Google",
|
|
79
|
+
max_steps=10,
|
|
80
|
+
executor=PyautoguiActionHandler(), # Executes mouse/keyboard actions
|
|
81
|
+
image_provider=ScreenshotMaker(), # Captures screenshots
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Image Processing
|
|
86
|
+
|
|
87
|
+
Process and optimize images before sending to API:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from oagi import PILImage, ImageConfig
|
|
91
|
+
|
|
92
|
+
# Load and compress an image
|
|
93
|
+
image = PILImage.from_file("large_screenshot.png")
|
|
94
|
+
config = ImageConfig(
|
|
95
|
+
format="JPEG",
|
|
96
|
+
quality=85,
|
|
97
|
+
width=1260,
|
|
98
|
+
height=700
|
|
99
|
+
)
|
|
100
|
+
compressed = image.transform(config)
|
|
101
|
+
|
|
102
|
+
# Use with single_step
|
|
103
|
+
step = single_step("Click button", screenshot=compressed)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Examples
|
|
107
|
+
|
|
108
|
+
See the [`examples/`](examples/) directory for more usage patterns:
|
|
109
|
+
- `google_weather.py` - Basic task execution with `ShortTask`
|
|
110
|
+
- `single_step.py` - Basic single-step inference
|
|
111
|
+
- `screenshot_with_config.py` - Image compression and optimization
|
|
112
|
+
- `execute_task_auto.py` - Automated task execution
|
|
113
|
+
|
|
114
|
+
## Documentation
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
oagi/__init__.py,sha256=1pewp0wOcGI8urjOOCskwiJC9VghhGCRpsslf-VUiLI,1493
|
|
2
|
+
oagi/exceptions.py,sha256=VMwVS8ouE9nHhBpN3AZMYt5_U2kGcihWaTnBhoQLquo,1662
|
|
3
|
+
oagi/logging.py,sha256=CWe89mA5MKTipIvfrqSYkv2CAFNBSwHMDQMDkG_g64g,1350
|
|
4
|
+
oagi/pil_image.py,sha256=Zp7YNwyE_AT25ZEFsWKbzMxbO8JOQsJ1Espph5ye8k8,3804
|
|
5
|
+
oagi/pyautogui_action_handler.py,sha256=LBWmtqkXzZSJo07s3uOw-NWUE9rZZtbNAx0YI83pCbk,5482
|
|
6
|
+
oagi/screenshot_maker.py,sha256=sVuW7jn-K4FmLhmYI-akdNI-UVcTeBzh9P1_qJhoq1s,1282
|
|
7
|
+
oagi/short_task.py,sha256=fJcirqD7X3_GyINTGdOoe6wi-VFHfP-C8m-zxCvgY5M,1779
|
|
8
|
+
oagi/single_step.py,sha256=djhGOHzA5Y3-9_ity9QiJr_ObZZ04blSmNZsLXXXfkg,2939
|
|
9
|
+
oagi/sync_client.py,sha256=E6EgFIe-H91rdsPhF1puwrBTpOnKaL6JA1WHR4R-CLY,9395
|
|
10
|
+
oagi/task.py,sha256=JfsugIhBrwDmi1xOEVQdqmXsGFK-H4p17-B4rM8kbWs,4001
|
|
11
|
+
oagi/types/__init__.py,sha256=dj_UWdpRzhuVyi-pegQAv2V0f1DxidFxjWUhpcWzYKE,608
|
|
12
|
+
oagi/types/action_handler.py,sha256=NH8E-m5qpGqWcXzTSWfF7W0Xdp8SkzJsbhCmQ0B96cg,1075
|
|
13
|
+
oagi/types/image.py,sha256=KgPCCTJ6D5vHIaGZdbTE7eQEa1WlT6G9tf59ZuUCV2U,537
|
|
14
|
+
oagi/types/image_provider.py,sha256=oYFdOYznrK_VOR9egzOjw5wFM5w8EY2sY01pH0ANAgU,1112
|
|
15
|
+
oagi/types/models/__init__.py,sha256=bVzzGxb6lVxAQyJpy0Z1QknSe-xC3g4OIDr7t-p_3Ys,467
|
|
16
|
+
oagi/types/models/action.py,sha256=8Xd3IcH32ENq7uXczo-mbQ736yUOGxO_TaZTfHVRY7w,935
|
|
17
|
+
oagi/types/models/image_config.py,sha256=tl6abVg_-IAPLwpaWprgknXu7wRWriMg-AEVyUX73v0,1567
|
|
18
|
+
oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
|
|
19
|
+
oagi-0.3.0.dist-info/METADATA,sha256=BtkLuhcIXhL43C23nZa6uZNcUuhlhXjJ67OaaXxeEmI,3461
|
|
20
|
+
oagi-0.3.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
21
|
+
oagi-0.3.0.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
|
|
22
|
+
oagi-0.3.0.dist-info/RECORD,,
|
oagi-0.2.1.dist-info/METADATA
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: oagi
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: Official API of OpenAGI Foundation
|
|
5
|
-
Project-URL: Homepage, https://github.com/agiopen-org/oagi
|
|
6
|
-
Author-email: OpenAGI Foundation <contact@agiopen.org>
|
|
7
|
-
License: MIT License
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2025 OpenAGI Foundation
|
|
10
|
-
|
|
11
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions:
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|
|
28
|
-
Requires-Python: >=3.10
|
|
29
|
-
Requires-Dist: httpx>=0.28.0
|
|
30
|
-
Requires-Dist: pillow>=11.3.0
|
|
31
|
-
Requires-Dist: pyautogui>=0.9.54
|
|
32
|
-
Requires-Dist: pydantic>=2.0.0
|
|
33
|
-
Description-Content-Type: text/markdown
|
|
34
|
-
|
|
35
|
-
# OAGI Python SDK
|
|
36
|
-
|
|
37
|
-
## Basic Usage
|
|
38
|
-
```bash
|
|
39
|
-
pip install oagi # python >= 3.10
|
|
40
|
-
```
|
|
41
|
-
```bash
|
|
42
|
-
export OAGI_BASE_URL=""
|
|
43
|
-
export OAGI_API_KEY="sk-xxxx"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
```python
|
|
47
|
-
from oagi import PyautoguiActionHandler, ScreenshotMaker, ShortTask
|
|
48
|
-
short_task = ShortTask()
|
|
49
|
-
is_completed = short_task.auto_mode(
|
|
50
|
-
"Search weather with Google",
|
|
51
|
-
max_steps=5,
|
|
52
|
-
executor=PyautoguiActionHandler(),
|
|
53
|
-
image_provider=(sm := ScreenshotMaker()),
|
|
54
|
-
)
|
|
55
|
-
```
|
oagi-0.2.1.dist-info/RECORD
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
oagi/__init__.py,sha256=ms9ahLdHNrMWtiqX93q8Iv55ag__tO4Id0DQ3hA2TVM,1347
|
|
2
|
-
oagi/exceptions.py,sha256=VMwVS8ouE9nHhBpN3AZMYt5_U2kGcihWaTnBhoQLquo,1662
|
|
3
|
-
oagi/logging.py,sha256=CWe89mA5MKTipIvfrqSYkv2CAFNBSwHMDQMDkG_g64g,1350
|
|
4
|
-
oagi/pyautogui_action_handler.py,sha256=LBWmtqkXzZSJo07s3uOw-NWUE9rZZtbNAx0YI83pCbk,5482
|
|
5
|
-
oagi/screenshot_maker.py,sha256=lyJSMFagHeaqg59CQGMTqLvSzQN_pBbhbV2oIFG46vA,2077
|
|
6
|
-
oagi/short_task.py,sha256=ofcMi7vbu9W1MCSGOk_FNEHJcB02pfgNcx1-Y8UkpJY,1552
|
|
7
|
-
oagi/single_step.py,sha256=JEsF7ABa4wwW5Pi5AfjeKzyuKhC4kC4fcotnmnNye5o,2874
|
|
8
|
-
oagi/sync_client.py,sha256=E6EgFIe-H91rdsPhF1puwrBTpOnKaL6JA1WHR4R-CLY,9395
|
|
9
|
-
oagi/task.py,sha256=NmpNMu8CJll50zGsGtVie1kdpKeWnAAWudEa-aasBbU,3959
|
|
10
|
-
oagi/types/__init__.py,sha256=eh-1IEqMTY2hUrvQJeTg6vsvlE6F4Iz5C0_K86AnWn8,549
|
|
11
|
-
oagi/types/action_handler.py,sha256=NH8E-m5qpGqWcXzTSWfF7W0Xdp8SkzJsbhCmQ0B96cg,1075
|
|
12
|
-
oagi/types/image.py,sha256=KgPCCTJ6D5vHIaGZdbTE7eQEa1WlT6G9tf59ZuUCV2U,537
|
|
13
|
-
oagi/types/image_provider.py,sha256=oYFdOYznrK_VOR9egzOjw5wFM5w8EY2sY01pH0ANAgU,1112
|
|
14
|
-
oagi/types/models/__init__.py,sha256=4qhKxWXsXEVzD6U_RM6PXR45os765qigtZs1BsS4WHg,414
|
|
15
|
-
oagi/types/models/action.py,sha256=8Xd3IcH32ENq7uXczo-mbQ736yUOGxO_TaZTfHVRY7w,935
|
|
16
|
-
oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
|
|
17
|
-
oagi-0.2.1.dist-info/METADATA,sha256=5W_aB_J2LUEyKAvE6G_iOcySv7tf0PWiGikOQe_K7l4,2066
|
|
18
|
-
oagi-0.2.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
19
|
-
oagi-0.2.1.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
|
|
20
|
-
oagi-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|