You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function attempts to handle various types of actions such as:
814
-
815
-
- Clicking and dragging the mouse.
816
-
- Clicking (left, right, middle buttons).
817
-
- Double-clicking.
818
-
- Scrolling.
819
-
- Key presses (including combinations).
820
-
- Typing text.
813
+
This function attempts to handle various types of actions. We need to translate between the commands that the `computer-use-preview` will generate and the Playwright library which will execute the actions. For more information refer to the reference documentation for `ComputerAction`.
In order for the model to be able to see what it's interacting with the model needs a way to capture screenshots. For this code we're using Playwright to capture the screenshots and we're limiting the view to just the content in the browser window. The screenshot won't include the url bar or other aspects of the browser GUI. If you need the model to see outside the main browser window you could augment the model by creating your own screenshot function.
827
+
In order for the model to be able to see what it's interacting with the model needs a way to capture screenshots. For this code we're using Playwright to capture the screenshots and we're limiting the view to just the content in the browser window. The screenshot won't include the url bar or other aspects of the browser GUI. If you need the model to see outside the main browser window you could augment the model by creating your own screenshot function.
This function captures the current browser state as an image and returns it as a base64-encoded string, ready to be sent to the model. We'll constantly do this in a loop after each step allowing the model to see if the command it tried to execute was successful or not, which then allows it to adjust based on the contents of the screenshot.
845
+
This function captures the current browser state as an image and returns it as a base64-encoded string, ready to be sent to the model. We'll constantly do this in a loop after each step allowing the model to see if the command it tried to execute was successful or not, which then allows it to adjust based on the contents of the screenshot. We could let the model decide if it needs to take a screenshot, but for simplicity we will force a screenshot to be taken for each iteration.
843
846
844
847
### Model response processing
845
848
@@ -1005,7 +1008,7 @@ In this section we have added code that:
1005
1008
- Handles potential safety checks requiring user confirmation.
1006
1009
- Executes the requested action.
1007
1010
- Captures a new screenshot.
1008
-
- Sends the updated state back to the model.
1011
+
- Sends the updated state back to the model and defines the [`ComputerTool`](azure/ai-services/openai/reference-preview#computertool).
0 commit comments