Created
March 13, 2025 05:00
-
-
Save ndurner/36f2b309db493c72ab305fdbfb12ac58 to your computer and use it in GitHub Desktop.
OpenAI Computer Use: Bing OpenAI news
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from openai import OpenAI | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| client = OpenAI() | |
| screenshot_base64 = "iVBOR..." | |
| response = client.responses.create( | |
| model="computer-use-preview", | |
| tools=[{ | |
| "type": "computer_use_preview", | |
| "display_width": 1024, | |
| "display_height": 768, | |
| "environment": "browser" # other possible values: "mac", "windows", "ubuntu" | |
| }], | |
| input=[ | |
| { | |
| "role": "user", | |
| "content": [ | |
| { | |
| "type": "input_text", | |
| "text": "Check the latest OpenAI news on bing.com." | |
| }, | |
| { | |
| "type": "input_image", | |
| "image_url": f"data:image/png;base64,{screenshot_base64}" | |
| } | |
| ] | |
| } | |
| ], | |
| reasoning={ | |
| "generate_summary": "concise", | |
| }, | |
| truncation="auto" | |
| ) | |
| print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment