computer-use-ootb-internal 0.0.109__py3-none-any.whl → 0.0.109.post2__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.
- computer_use_ootb_internal/app_teachmode.py +0 -2
- computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +4 -3
- computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +7 -0
- computer_use_ootb_internal/computer_use_demo/tools/computer.py +14 -13
- computer_use_ootb_internal/run_teachmode_ootb_args.py +2 -3
- {computer_use_ootb_internal-0.0.109.dist-info → computer_use_ootb_internal-0.0.109.post2.dist-info}/METADATA +1 -1
- {computer_use_ootb_internal-0.0.109.dist-info → computer_use_ootb_internal-0.0.109.post2.dist-info}/RECORD +9 -11
- computer_use_ootb_internal/computer_use_demo/gui_agent/vlm_utils/__init__.py +0 -0
- computer_use_ootb_internal/computer_use_demo/gui_agent/vlm_utils/run_vlm.py +0 -46
- {computer_use_ootb_internal-0.0.109.dist-info → computer_use_ootb_internal-0.0.109.post2.dist-info}/WHEEL +0 -0
- {computer_use_ootb_internal-0.0.109.dist-info → computer_use_ootb_internal-0.0.109.post2.dist-info}/entry_points.txt +0 -0
@@ -5,14 +5,12 @@ from datetime import datetime
|
|
5
5
|
import threading
|
6
6
|
import requests
|
7
7
|
import platform # Add platform import
|
8
|
-
import subprocess # Add subprocess import
|
9
8
|
import pyautogui # Add pyautogui import
|
10
9
|
import webbrowser # Add webbrowser import
|
11
10
|
import os # Import os for path joining
|
12
11
|
from fastapi import FastAPI, Request
|
13
12
|
from fastapi.responses import JSONResponse
|
14
13
|
from fastapi.middleware.cors import CORSMiddleware
|
15
|
-
from screeninfo import get_monitors
|
16
14
|
from computer_use_ootb_internal.computer_use_demo.tools.computer import get_screen_details
|
17
15
|
from computer_use_ootb_internal.run_teachmode_ootb_args import simple_teachmode_sampling_loop
|
18
16
|
|
@@ -92,11 +92,12 @@ class TeachmodeExecutor:
|
|
92
92
|
|
93
93
|
if isinstance(tool_result, ToolResult):
|
94
94
|
print(f"[teachmode_executor] tool_result: {tool_result}")
|
95
|
-
tool_result_message = {"role": "assistant", "content": tool_result
|
95
|
+
tool_result_message = {"role": "assistant", "content": tool_result.output, "type": "action", "action_type": tool_result.base_type}
|
96
96
|
yield tool_result_message
|
97
97
|
|
98
98
|
elif isinstance(tool_result, ToolError):
|
99
|
-
|
99
|
+
print(f"[teachmode_executor] tool_error: {tool_result}")
|
100
|
+
tool_result_message = {"role": "assistant", "content": tool_result.output, "type": "error"}
|
100
101
|
yield tool_result_message
|
101
102
|
|
102
103
|
return tool_result_message
|
@@ -134,7 +135,7 @@ class TeachmodeExecutor:
|
|
134
135
|
x, y = action_item["position"]
|
135
136
|
action_item["position"] = (int(x), int(y))
|
136
137
|
refined_output.append({"action": "mouse_move", "text": None, "coordinate": tuple(action_item["position"])})
|
137
|
-
refined_output.append({"action": "left_click", "text": None, "coordinate":
|
138
|
+
refined_output.append({"action": "left_click", "text": None, "coordinate": tuple(action_item["position"])})
|
138
139
|
|
139
140
|
elif action_item["action"] == "INPUT": # 2. input -> type
|
140
141
|
if "text" in action_item:
|
@@ -4,6 +4,13 @@ import datetime
|
|
4
4
|
import numpy as np
|
5
5
|
import cv2
|
6
6
|
|
7
|
+
def get_screen_resize_factor():
|
8
|
+
# import ctypes
|
9
|
+
# scaleFactor = ctypes.windll.shcore.GetScaleFactorForDevice(0) / 100
|
10
|
+
# scaleFactor = str(scaleFactor) + "x"
|
11
|
+
# return scaleFactor
|
12
|
+
return "1.0x"
|
13
|
+
|
7
14
|
|
8
15
|
def multivalue_image(img, mode='None', thresholds=None, interval_values=None, save=True, cache_folder=None):
|
9
16
|
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
@@ -293,36 +293,37 @@ class ComputerTool(BaseAnthropicTool):
|
|
293
293
|
):
|
294
294
|
if text is not None:
|
295
295
|
raise ToolError(output=f"text is not accepted for {action}", base_type="error")
|
296
|
+
# if coordinate is not None:
|
297
|
+
# raise ToolError(output=f"coordinate is not accepted for {action}", base_type="error")
|
298
|
+
|
296
299
|
if coordinate is not None:
|
297
|
-
|
300
|
+
x, y = coordinate
|
301
|
+
else:
|
302
|
+
x, y = pyautogui.position()
|
298
303
|
|
299
304
|
if action == "left_click":
|
300
|
-
x, y = pyautogui.position()
|
301
305
|
show_click(x, y)
|
302
|
-
pyautogui.click()
|
306
|
+
pyautogui.click(x=x, y=y)
|
303
307
|
return ToolResult(output="Left click", base_type="click")
|
304
308
|
elif action == "right_click":
|
305
|
-
x, y = pyautogui.position()
|
306
309
|
show_click(x, y)
|
307
|
-
pyautogui.rightClick()
|
310
|
+
pyautogui.rightClick(x=x, y=y)
|
308
311
|
return ToolResult(output="Right click", base_type="click")
|
309
312
|
elif action == "middle_click":
|
310
|
-
x, y = pyautogui.position()
|
311
313
|
show_click(x, y)
|
312
|
-
pyautogui.middleClick()
|
314
|
+
pyautogui.middleClick(x=x, y=y)
|
313
315
|
return ToolResult(output="Middle click", base_type="click")
|
314
316
|
elif action == "double_click":
|
315
|
-
x, y = pyautogui.position()
|
316
317
|
show_click(x, y)
|
317
|
-
pyautogui.doubleClick()
|
318
|
+
pyautogui.doubleClick(x=x, y=y)
|
318
319
|
return ToolResult(output="Double click", base_type="click")
|
319
320
|
elif action == "left_press":
|
320
|
-
x, y = pyautogui.position()
|
321
321
|
show_click(x, y)
|
322
|
-
pyautogui.mouseDown()
|
322
|
+
pyautogui.mouseDown(x=x, y=y)
|
323
323
|
time.sleep(1)
|
324
|
-
pyautogui.mouseUp()
|
324
|
+
pyautogui.mouseUp(x=x, y=y)
|
325
325
|
return ToolResult(output="Left press", base_type="click")
|
326
|
+
|
326
327
|
elif action == "scroll_down":
|
327
328
|
pyautogui.scroll(-200) # Adjust scroll amount as needed
|
328
329
|
return ToolResult(output="Scrolled down", base_type="scroll")
|
@@ -391,7 +392,7 @@ class ComputerTool(BaseAnthropicTool):
|
|
391
392
|
x1 = coordinate[0]+self.offset_x
|
392
393
|
y1 = coordinate[1]+self.offset_y
|
393
394
|
|
394
|
-
show_move_to(x0, y0, x1, y1
|
395
|
+
show_move_to(x0, y0, x1, y1)
|
395
396
|
self.marbot_auto_gui.moveTo(x=x1, y=y1)
|
396
397
|
|
397
398
|
return ToolResult(output=f"Mouse move", base_type="move")
|
@@ -7,9 +7,8 @@ import datetime
|
|
7
7
|
from datetime import datetime, timedelta, timezone
|
8
8
|
|
9
9
|
from computer_use_ootb_internal.computer_use_demo.executor.teachmode_executor import TeachmodeExecutor
|
10
|
-
from computer_use_ootb_internal.computer_use_demo.gui_agent.
|
11
|
-
from computer_use_ootb_internal.computer_use_demo.gui_agent.
|
12
|
-
from computer_use_ootb_internal.computer_use_demo.gui_agent.gui_parser.simple_parser.icon_detection.icon_detection import get_screen_resize_factor
|
10
|
+
from computer_use_ootb_internal.computer_use_demo.gui_agent.llm_utils.llm_utils import is_image_path
|
11
|
+
from computer_use_ootb_internal.computer_use_demo.gui_agent.gui_parser.simple_parser.utils import get_screen_resize_factor
|
13
12
|
from computer_use_ootb_internal.computer_use_demo.tools.aws_request import send_request_to_server
|
14
13
|
from computer_use_ootb_internal.computer_use_demo.gui_agent.gui_parser.uia_tools.screenshot_service import get_screenshot_external_cmd
|
15
14
|
utc_plus_8 = timezone(timedelta(hours=8))
|
@@ -1,16 +1,16 @@
|
|
1
1
|
computer_use_ootb_internal/README.md,sha256=FxpW95lyub2iX73ZDfK6ML7SdEKg060H5I6Grub7li4,31
|
2
|
-
computer_use_ootb_internal/app_teachmode.py,sha256=
|
2
|
+
computer_use_ootb_internal/app_teachmode.py,sha256=Yb5LtyaW4agGsfTmVvnIAkERXILkg3KkUZf7yI1dW-g,19253
|
3
3
|
computer_use_ootb_internal/app_teachmode_gradio.py,sha256=cmFpBrkdlZxOQADWveVdIaaNqaBD8IVs-xNLJogU7F8,7909
|
4
4
|
computer_use_ootb_internal/dependency_check.py,sha256=y8RMEP6RXQzTgU1MS_1piBLtz4J-Hfn9RjUZg59dyvo,1333
|
5
5
|
computer_use_ootb_internal/requirements-lite.txt,sha256=5DAHomz4A_P2BmTIXNkNqkHbnIF0AyZ4_1XAlb1LaYs,290
|
6
|
-
computer_use_ootb_internal/run_teachmode_ootb_args.py,sha256=
|
6
|
+
computer_use_ootb_internal/run_teachmode_ootb_args.py,sha256=7Dj0iY4GG7P03tRKYJ2x9Yvt-PE-b7uyjCAed3SaF3Y,7086
|
7
7
|
computer_use_ootb_internal/computer_use_demo/animation/click_animation.py,sha256=tP1gsayFy-CKk10UlrE9RlexwlHWiHQUe5Ogg4vQvSg,3234
|
8
8
|
computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif,sha256=4LfwsfFQnREXrNRs32aJU2jO65JXianJoL_8q7-8elg,30966
|
9
9
|
computer_use_ootb_internal/computer_use_demo/animation/test_animation.py,sha256=SOJz2yffXTkjuAHqk0IZLcMriR0KQYTo7W1b8wGyRGY,1222
|
10
|
-
computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py,sha256=
|
10
|
+
computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py,sha256=TBp_rXSAuHFBmZYyyIFca404c4v5LG1ZVbNaQpuvtzQ,16656
|
11
11
|
computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py,sha256=h2CNeuACklxVpJC65QR8_6AvSybEZLmeO45hY_-lLBs,61
|
12
12
|
computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py,sha256=CxFJbsSb68ERKH7-C4RaaZy7FIhhzrzGx5qQJ4C37cA,13907
|
13
|
-
computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py,sha256=
|
13
|
+
computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py,sha256=OOVxy4Qlbk5q-X9kXFXqt6AmuOMl6FWWqtH269DvJJA,10005
|
14
14
|
computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_cli.py,sha256=hrUBH3aeUe9t4EDsMhaUZLPpNLKeEaG4ZvikrFy-bOU,1313
|
16
16
|
computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_service.py,sha256=fJ8G4_-ZLGsHLdLgHCNgjVM1osbfz21L2w8QrcvnuhA,2738
|
@@ -18,20 +18,18 @@ computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py,sh
|
|
18
18
|
computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py,sha256=zWAHa37fhIWCYpIEvQsIe5prfBJQ9yZFQwAi_dm8baE,4158
|
19
19
|
computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py,sha256=SBnWMhwZoCFji9-ii7VSfPYAhDKUWvlJgJzw9-Ei3-g,7750
|
20
20
|
computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py,sha256=fxC-7lg8TLAi9f69zs5y5Pwga8Y5mY7Yfc5NNZNRJgM,1558
|
21
|
-
computer_use_ootb_internal/computer_use_demo/gui_agent/vlm_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
-
computer_use_ootb_internal/computer_use_demo/gui_agent/vlm_utils/run_vlm.py,sha256=9IaX15dhFFOALr0vcsI-EtEU4pDLfdzlmwCy3HRbISA,1441
|
23
21
|
computer_use_ootb_internal/computer_use_demo/tools/__init__.py,sha256=Pj8_5L4_PPQK298X4NV3KMbP-84t-bM0pbjEeb5_SJQ,343
|
24
22
|
computer_use_ootb_internal/computer_use_demo/tools/aws_request.py,sha256=12UVzeA2PmpZhpy2Pt5Vh48-_q1e8ZjVQux6r3pbAcw,2629
|
25
23
|
computer_use_ootb_internal/computer_use_demo/tools/base.py,sha256=4HHSxDg6GsCoraamWor75ZnoR7tAcRarMv4MzvqMWGU,2099
|
26
24
|
computer_use_ootb_internal/computer_use_demo/tools/bash.py,sha256=rHetQ80_v-TTi-1oxIA7ncFEwJxFTh8FJCErIoZbGeY,4236
|
27
25
|
computer_use_ootb_internal/computer_use_demo/tools/collection.py,sha256=8RzHLobL44_Jjt8ltXS6I8XJlEAQOfc75dmnDUaHE-8,922
|
28
26
|
computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py,sha256=cvlmnhAImDTwoRRwhT5au7mNFhfAD7ZfeoDEVdVzDKw,892
|
29
|
-
computer_use_ootb_internal/computer_use_demo/tools/computer.py,sha256=
|
27
|
+
computer_use_ootb_internal/computer_use_demo/tools/computer.py,sha256=lm3bzh-ZzeFGAqrgQGkDr6SnvoB9d4NvVo8D1PNOoAk,26745
|
30
28
|
computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py,sha256=zZuWz9ArfP3Zss-afnscrPkgCtB5UWbCy7HwAOvO2bo,5970
|
31
29
|
computer_use_ootb_internal/computer_use_demo/tools/edit.py,sha256=b0PwUitxckHCQqFP3ZwlthWdqNkn7WETeTHeB6-o98c,11486
|
32
30
|
computer_use_ootb_internal/computer_use_demo/tools/run.py,sha256=xhXdnBK1di9muaO44CEirL9hpGy3NmKbjfMpyeVmn8Y,1595
|
33
31
|
computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py,sha256=L8qfvtUkPPQGt92N-2Zfw5ZTDBzLsDps39uMnX3_uSA,6857
|
34
|
-
computer_use_ootb_internal-0.0.109.dist-info/METADATA,sha256=
|
35
|
-
computer_use_ootb_internal-0.0.109.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
36
|
-
computer_use_ootb_internal-0.0.109.dist-info/entry_points.txt,sha256=-AbmawU7IRQuDZihgVMVDrFoY4E6rnXYOUB-5vSeBKs,93
|
37
|
-
computer_use_ootb_internal-0.0.109.dist-info/RECORD,,
|
32
|
+
computer_use_ootb_internal-0.0.109.post2.dist-info/METADATA,sha256=jTj_Um-WzpFJjLXIQ_iK6veWsvkwPcuvJ5p4GTC0vCA,916
|
33
|
+
computer_use_ootb_internal-0.0.109.post2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
34
|
+
computer_use_ootb_internal-0.0.109.post2.dist-info/entry_points.txt,sha256=-AbmawU7IRQuDZihgVMVDrFoY4E6rnXYOUB-5vSeBKs,93
|
35
|
+
computer_use_ootb_internal-0.0.109.post2.dist-info/RECORD,,
|
File without changes
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import base64
|
2
|
-
import logging
|
3
|
-
|
4
|
-
|
5
|
-
def run_vlm(messages, system, vlm="gpt-4o-mini", max_tokens=512, temperature=0, stop=None):
|
6
|
-
log_prompt(messages)
|
7
|
-
|
8
|
-
# turn string prompt into list
|
9
|
-
if isinstance(messages, str):
|
10
|
-
messages = [messages]
|
11
|
-
elif isinstance(messages, list):
|
12
|
-
pass
|
13
|
-
else:
|
14
|
-
raise ValueError(f"Invalid prompt type: {type(messages)}")
|
15
|
-
|
16
|
-
if vlm.startswith("gpt"): # gpt series
|
17
|
-
from .oai import run_oai_interleaved
|
18
|
-
response, token_usage = run_oai_interleaved(
|
19
|
-
messages=messages,
|
20
|
-
system=system,
|
21
|
-
llm=llm,
|
22
|
-
max_tokens=max_tokens,
|
23
|
-
temperature=temperature
|
24
|
-
)
|
25
|
-
elif vlm.startswith("gemini"): # gemini series
|
26
|
-
from .gemini import run_gemini_interleaved
|
27
|
-
|
28
|
-
response, token_usage = run_gemini_interleaved(
|
29
|
-
messages=messages,
|
30
|
-
system=system,
|
31
|
-
vlm=vlm,
|
32
|
-
max_tokens=max_tokens,
|
33
|
-
temperature=temperature
|
34
|
-
)
|
35
|
-
else:
|
36
|
-
raise ValueError(f"Invalid llm: {llm}")
|
37
|
-
logging.info(
|
38
|
-
f"========Output for {vlm}=======\n{response}\n============================")
|
39
|
-
return response
|
40
|
-
|
41
|
-
def log_prompt(prompt):
|
42
|
-
prompt_display = [prompt] if isinstance(prompt, str) else prompt
|
43
|
-
prompt_display = "\n\n".join(prompt_display)
|
44
|
-
logging.info(
|
45
|
-
f"========Prompt=======\n{prompt_display}\n============================")
|
46
|
-
|
File without changes
|
File without changes
|