oagi 0.4.3__py3-none-any.whl → 0.5.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/async_client.py +8 -0
- oagi/async_short_task.py +18 -2
- oagi/async_task.py +25 -2
- oagi/short_task.py +18 -2
- oagi/sync_client.py +8 -0
- oagi/task.py +25 -2
- {oagi-0.4.3.dist-info → oagi-0.5.0.dist-info}/METADATA +1 -1
- {oagi-0.4.3.dist-info → oagi-0.5.0.dist-info}/RECORD +10 -10
- {oagi-0.4.3.dist-info → oagi-0.5.0.dist-info}/WHEEL +0 -0
- {oagi-0.4.3.dist-info → oagi-0.5.0.dist-info}/licenses/LICENSE +0 -0
oagi/async_client.py
CHANGED
|
@@ -91,6 +91,8 @@ class AsyncClient:
|
|
|
91
91
|
task_id: str | None = None,
|
|
92
92
|
instruction: str | None = None,
|
|
93
93
|
max_actions: int | None = 5,
|
|
94
|
+
last_task_id: str | None = None,
|
|
95
|
+
history_steps: int | None = None,
|
|
94
96
|
api_version: str | None = None,
|
|
95
97
|
) -> LLMResponse:
|
|
96
98
|
"""
|
|
@@ -103,6 +105,8 @@ class AsyncClient:
|
|
|
103
105
|
task_id: Task ID for continuing existing task
|
|
104
106
|
instruction: Additional instruction when continuing a session (only works with task_id)
|
|
105
107
|
max_actions: Maximum number of actions to return (1-20)
|
|
108
|
+
last_task_id: Previous task ID to retrieve history from (only works with task_id)
|
|
109
|
+
history_steps: Number of historical steps to include from last_task_id (default: 1, max: 10)
|
|
106
110
|
api_version: API version header
|
|
107
111
|
|
|
108
112
|
Returns:
|
|
@@ -127,6 +131,10 @@ class AsyncClient:
|
|
|
127
131
|
payload["instruction"] = instruction
|
|
128
132
|
if max_actions is not None:
|
|
129
133
|
payload["max_actions"] = max_actions
|
|
134
|
+
if last_task_id is not None:
|
|
135
|
+
payload["last_task_id"] = last_task_id
|
|
136
|
+
if history_steps is not None:
|
|
137
|
+
payload["history_steps"] = history_steps
|
|
130
138
|
|
|
131
139
|
logger.info(f"Making async API request to /v1/message with model: {model}")
|
|
132
140
|
logger.debug(
|
oagi/async_short_task.py
CHANGED
|
@@ -30,12 +30,28 @@ class AsyncShortTask(AsyncTask):
|
|
|
30
30
|
max_steps: int = 5,
|
|
31
31
|
executor: AsyncActionHandler = None,
|
|
32
32
|
image_provider: AsyncImageProvider = None,
|
|
33
|
+
last_task_id: str | None = None,
|
|
34
|
+
history_steps: int | None = None,
|
|
33
35
|
) -> bool:
|
|
34
|
-
"""Run the task in automatic mode with the provided executor and image provider.
|
|
36
|
+
"""Run the task in automatic mode with the provided executor and image provider.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
task_desc: Task description
|
|
40
|
+
max_steps: Maximum number of steps
|
|
41
|
+
executor: Async handler to execute actions
|
|
42
|
+
image_provider: Async provider for screenshots
|
|
43
|
+
last_task_id: Previous task ID to retrieve history from
|
|
44
|
+
history_steps: Number of historical steps to include
|
|
45
|
+
"""
|
|
35
46
|
logger.info(
|
|
36
47
|
f"Starting async auto mode for task: '{task_desc}' (max_steps: {max_steps})"
|
|
37
48
|
)
|
|
38
|
-
await self.init_task(
|
|
49
|
+
await self.init_task(
|
|
50
|
+
task_desc,
|
|
51
|
+
max_steps=max_steps,
|
|
52
|
+
last_task_id=last_task_id,
|
|
53
|
+
history_steps=history_steps,
|
|
54
|
+
)
|
|
39
55
|
|
|
40
56
|
for i in range(max_steps):
|
|
41
57
|
logger.debug(f"Async auto mode step {i + 1}/{max_steps}")
|
oagi/async_task.py
CHANGED
|
@@ -29,10 +29,27 @@ class AsyncTask:
|
|
|
29
29
|
self.task_id: str | None = None
|
|
30
30
|
self.task_description: str | None = None
|
|
31
31
|
self.model = model
|
|
32
|
+
self.last_task_id: str | None = None
|
|
33
|
+
self.history_steps: int | None = None
|
|
32
34
|
|
|
33
|
-
async def init_task(
|
|
34
|
-
|
|
35
|
+
async def init_task(
|
|
36
|
+
self,
|
|
37
|
+
task_desc: str,
|
|
38
|
+
max_steps: int = 5,
|
|
39
|
+
last_task_id: str | None = None,
|
|
40
|
+
history_steps: int | None = None,
|
|
41
|
+
):
|
|
42
|
+
"""Initialize a new task with the given description.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
task_desc: Task description
|
|
46
|
+
max_steps: Maximum number of steps (for logging)
|
|
47
|
+
last_task_id: Previous task ID to retrieve history from
|
|
48
|
+
history_steps: Number of historical steps to include (default: 1)
|
|
49
|
+
"""
|
|
35
50
|
self.task_description = task_desc
|
|
51
|
+
self.last_task_id = last_task_id
|
|
52
|
+
self.history_steps = history_steps
|
|
36
53
|
response = await self.client.create_message(
|
|
37
54
|
model=self.model,
|
|
38
55
|
screenshot="",
|
|
@@ -41,6 +58,10 @@ class AsyncTask:
|
|
|
41
58
|
)
|
|
42
59
|
self.task_id = response.task_id # Reset task_id for new task
|
|
43
60
|
logger.info(f"Async task initialized: '{task_desc}' (max_steps: {max_steps})")
|
|
61
|
+
if last_task_id:
|
|
62
|
+
logger.info(
|
|
63
|
+
f"Will include {history_steps or 1} steps from previous task: {last_task_id}"
|
|
64
|
+
)
|
|
44
65
|
|
|
45
66
|
async def step(
|
|
46
67
|
self, screenshot: Image | bytes, instruction: str | None = None
|
|
@@ -74,6 +95,8 @@ class AsyncTask:
|
|
|
74
95
|
task_description=self.task_description,
|
|
75
96
|
task_id=self.task_id,
|
|
76
97
|
instruction=instruction,
|
|
98
|
+
last_task_id=self.last_task_id if self.task_id else None,
|
|
99
|
+
history_steps=self.history_steps if self.task_id else None,
|
|
77
100
|
)
|
|
78
101
|
|
|
79
102
|
# Update task_id from response
|
oagi/short_task.py
CHANGED
|
@@ -30,12 +30,28 @@ class ShortTask(Task):
|
|
|
30
30
|
max_steps: int = 5,
|
|
31
31
|
executor: ActionHandler = None,
|
|
32
32
|
image_provider: ImageProvider = None,
|
|
33
|
+
last_task_id: str | None = None,
|
|
34
|
+
history_steps: int | None = None,
|
|
33
35
|
) -> bool:
|
|
34
|
-
"""Run the task in automatic mode with the provided executor and image provider.
|
|
36
|
+
"""Run the task in automatic mode with the provided executor and image provider.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
task_desc: Task description
|
|
40
|
+
max_steps: Maximum number of steps
|
|
41
|
+
executor: Handler to execute actions
|
|
42
|
+
image_provider: Provider for screenshots
|
|
43
|
+
last_task_id: Previous task ID to retrieve history from
|
|
44
|
+
history_steps: Number of historical steps to include
|
|
45
|
+
"""
|
|
35
46
|
logger.info(
|
|
36
47
|
f"Starting auto mode for task: '{task_desc}' (max_steps: {max_steps})"
|
|
37
48
|
)
|
|
38
|
-
self.init_task(
|
|
49
|
+
self.init_task(
|
|
50
|
+
task_desc,
|
|
51
|
+
max_steps=max_steps,
|
|
52
|
+
last_task_id=last_task_id,
|
|
53
|
+
history_steps=history_steps,
|
|
54
|
+
)
|
|
39
55
|
|
|
40
56
|
for i in range(max_steps):
|
|
41
57
|
logger.debug(f"Auto mode step {i + 1}/{max_steps}")
|
oagi/sync_client.py
CHANGED
|
@@ -130,6 +130,8 @@ class SyncClient:
|
|
|
130
130
|
task_id: str | None = None,
|
|
131
131
|
instruction: str | None = None,
|
|
132
132
|
max_actions: int | None = 5,
|
|
133
|
+
last_task_id: str | None = None,
|
|
134
|
+
history_steps: int | None = None,
|
|
133
135
|
api_version: str | None = None,
|
|
134
136
|
) -> LLMResponse:
|
|
135
137
|
"""
|
|
@@ -142,6 +144,8 @@ class SyncClient:
|
|
|
142
144
|
task_id: Task ID for continuing existing task
|
|
143
145
|
instruction: Additional instruction when continuing a session (only works with task_id)
|
|
144
146
|
max_actions: Maximum number of actions to return (1-20)
|
|
147
|
+
last_task_id: Previous task ID to retrieve history from (only works with task_id)
|
|
148
|
+
history_steps: Number of historical steps to include from last_task_id (default: 1, max: 10)
|
|
145
149
|
api_version: API version header
|
|
146
150
|
|
|
147
151
|
Returns:
|
|
@@ -166,6 +170,10 @@ class SyncClient:
|
|
|
166
170
|
payload["instruction"] = instruction
|
|
167
171
|
if max_actions is not None:
|
|
168
172
|
payload["max_actions"] = max_actions
|
|
173
|
+
if last_task_id is not None:
|
|
174
|
+
payload["last_task_id"] = last_task_id
|
|
175
|
+
if history_steps is not None:
|
|
176
|
+
payload["history_steps"] = history_steps
|
|
169
177
|
|
|
170
178
|
logger.info(f"Making API request to /v1/message with model: {model}")
|
|
171
179
|
logger.debug(
|
oagi/task.py
CHANGED
|
@@ -28,10 +28,27 @@ class Task:
|
|
|
28
28
|
self.task_id: str | None = None
|
|
29
29
|
self.task_description: str | None = None
|
|
30
30
|
self.model = model
|
|
31
|
+
self.last_task_id: str | None = None
|
|
32
|
+
self.history_steps: int | None = None
|
|
31
33
|
|
|
32
|
-
def init_task(
|
|
33
|
-
|
|
34
|
+
def init_task(
|
|
35
|
+
self,
|
|
36
|
+
task_desc: str,
|
|
37
|
+
max_steps: int = 5,
|
|
38
|
+
last_task_id: str | None = None,
|
|
39
|
+
history_steps: int | None = None,
|
|
40
|
+
):
|
|
41
|
+
"""Initialize a new task with the given description.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
task_desc: Task description
|
|
45
|
+
max_steps: Maximum number of steps (for logging)
|
|
46
|
+
last_task_id: Previous task ID to retrieve history from
|
|
47
|
+
history_steps: Number of historical steps to include (default: 1)
|
|
48
|
+
"""
|
|
34
49
|
self.task_description = task_desc
|
|
50
|
+
self.last_task_id = last_task_id
|
|
51
|
+
self.history_steps = history_steps
|
|
35
52
|
response = self.client.create_message(
|
|
36
53
|
model=self.model,
|
|
37
54
|
screenshot="",
|
|
@@ -40,6 +57,10 @@ class Task:
|
|
|
40
57
|
)
|
|
41
58
|
self.task_id = response.task_id # Reset task_id for new task
|
|
42
59
|
logger.info(f"Task initialized: '{task_desc}' (max_steps: {max_steps})")
|
|
60
|
+
if last_task_id:
|
|
61
|
+
logger.info(
|
|
62
|
+
f"Will include {history_steps or 1} steps from previous task: {last_task_id}"
|
|
63
|
+
)
|
|
43
64
|
|
|
44
65
|
def step(self, screenshot: Image | bytes, instruction: str | None = None) -> Step:
|
|
45
66
|
"""Send screenshot to the server and get the next actions.
|
|
@@ -71,6 +92,8 @@ class Task:
|
|
|
71
92
|
task_description=self.task_description,
|
|
72
93
|
task_id=self.task_id,
|
|
73
94
|
instruction=instruction,
|
|
95
|
+
last_task_id=self.last_task_id if self.task_id else None,
|
|
96
|
+
history_steps=self.history_steps if self.task_id else None,
|
|
74
97
|
)
|
|
75
98
|
|
|
76
99
|
# Update task_id from response
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
oagi/__init__.py,sha256=m-Z121YCIwQOPXpTC8kd_UIJizcX8QuHyrSSguQ0KE0,2187
|
|
2
|
-
oagi/async_client.py,sha256=
|
|
2
|
+
oagi/async_client.py,sha256=JN2PAhM5pRTzjKxScQm-Fb_mfsEUwyXgFDJ_5w5kQv8,8916
|
|
3
3
|
oagi/async_pyautogui_action_handler.py,sha256=F-lKyePCONWI03WnSxpX_QwxONbvnfdQu51wTod6mdw,1614
|
|
4
4
|
oagi/async_screenshot_maker.py,sha256=pI-dbLcYOzcO1ffgTmozAdbYJQNBPKA7hmqj1RxEmIY,1688
|
|
5
|
-
oagi/async_short_task.py,sha256=
|
|
5
|
+
oagi/async_short_task.py,sha256=7WM89H4V7xaPjuQQlzjA5Q7JOoJLhZw-DotJPNm8uAA,2517
|
|
6
6
|
oagi/async_single_step.py,sha256=QawXO4GyfMz6O9jV8QBC1vKxFuS9vjKQxxJ1nwgHBzI,2838
|
|
7
|
-
oagi/async_task.py,sha256=
|
|
7
|
+
oagi/async_task.py,sha256=z6q1OUjvbnXB5mTimAkM5kTFmixJA6zmWLPujx8vMHc,5013
|
|
8
8
|
oagi/exceptions.py,sha256=VMwVS8ouE9nHhBpN3AZMYt5_U2kGcihWaTnBhoQLquo,1662
|
|
9
9
|
oagi/logging.py,sha256=CWe89mA5MKTipIvfrqSYkv2CAFNBSwHMDQMDkG_g64g,1350
|
|
10
10
|
oagi/pil_image.py,sha256=Zp7YNwyE_AT25ZEFsWKbzMxbO8JOQsJ1Espph5ye8k8,3804
|
|
11
11
|
oagi/pyautogui_action_handler.py,sha256=8IFbU4p907L4b3TV3Eeh0-c-pYL2lYw-_qf1r8TtPTw,9811
|
|
12
12
|
oagi/screenshot_maker.py,sha256=sVuW7jn-K4FmLhmYI-akdNI-UVcTeBzh9P1_qJhoq1s,1282
|
|
13
|
-
oagi/short_task.py,sha256=
|
|
13
|
+
oagi/short_task.py,sha256=prrtUExDbiwabFqm6lOvKfFhLjQwANyWe2z7-xT995w,2323
|
|
14
14
|
oagi/single_step.py,sha256=djhGOHzA5Y3-9_ity9QiJr_ObZZ04blSmNZsLXXXfkg,2939
|
|
15
|
-
oagi/sync_client.py,sha256=
|
|
16
|
-
oagi/task.py,sha256=
|
|
15
|
+
oagi/sync_client.py,sha256=rgLjsZ2TnFidq5UcZddN83WNQ0HpfBlVihzG1j3XY28,9856
|
|
16
|
+
oagi/task.py,sha256=yHM8QpevP8RitnFXGgyJttGRXB8mtFPSDB33E0MSIrg,4869
|
|
17
17
|
oagi/types/__init__.py,sha256=YXxL-30f92qAf9U6LZuVCtKFG-Pi3xahKedaNxyrxFE,766
|
|
18
18
|
oagi/types/action_handler.py,sha256=NH8E-m5qpGqWcXzTSWfF7W0Xdp8SkzJsbhCmQ0B96cg,1075
|
|
19
19
|
oagi/types/async_action_handler.py,sha256=k1AaqSkFcXlxwW8sn-w0WFHGsIqHFLbcOPrkknmSVug,1116
|
|
@@ -24,7 +24,7 @@ oagi/types/models/__init__.py,sha256=bVzzGxb6lVxAQyJpy0Z1QknSe-xC3g4OIDr7t-p_3Ys
|
|
|
24
24
|
oagi/types/models/action.py,sha256=hh6mRRSSWgrW4jpZo71zGMCOcZpV5_COu4148uG6G48,967
|
|
25
25
|
oagi/types/models/image_config.py,sha256=tl6abVg_-IAPLwpaWprgknXu7wRWriMg-AEVyUX73v0,1567
|
|
26
26
|
oagi/types/models/step.py,sha256=RSI4H_2rrUBq_xyCoWKaq7JHdJWNobtQppaKC1l0aWU,471
|
|
27
|
-
oagi-0.
|
|
28
|
-
oagi-0.
|
|
29
|
-
oagi-0.
|
|
30
|
-
oagi-0.
|
|
27
|
+
oagi-0.5.0.dist-info/METADATA,sha256=MQHpJB8UgoliDCNk55ce0klXvkQHVpiw9AmCylAY_jQ,4799
|
|
28
|
+
oagi-0.5.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
29
|
+
oagi-0.5.0.dist-info/licenses/LICENSE,sha256=sy5DLA2M29jFT4UfWsuBF9BAr3FnRkYtnAu6oDZiIf8,1075
|
|
30
|
+
oagi-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|