Skip to content

Instantly share code, notes, and snippets.

@ndurner
Created March 13, 2025 05:00
Show Gist options
  • Select an option

  • Save ndurner/36f2b309db493c72ab305fdbfb12ac58 to your computer and use it in GitHub Desktop.

Select an option

Save ndurner/36f2b309db493c72ab305fdbfb12ac58 to your computer and use it in GitHub Desktop.
OpenAI Computer Use: Bing OpenAI news
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