mirror of
https://github.com/trycua/computer.git
synced 2026-02-22 06:19:07 -06:00
Remove Cua Notebook
This commit is contained in:
@@ -1,134 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!pip install openai\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"response = requests.post(\n",
|
||||
" \"https://api.openai.com/v1/responses\",\n",
|
||||
" headers={\n",
|
||||
" \"Content-Type\": \"application/json\", \n",
|
||||
" \"Authorization\": f\"Bearer {os.environ['OPENAI_API_KEY']}\"\n",
|
||||
" },\n",
|
||||
" json={\n",
|
||||
" \"model\": \"computer-use-preview\",\n",
|
||||
" \"tools\": [{\n",
|
||||
" \"type\": \"computer_use_preview\",\n",
|
||||
" \"display_width\": 1024,\n",
|
||||
" \"display_height\": 768,\n",
|
||||
" \"environment\": \"mac\" # other possible values: \"mac\", \"windows\", \"ubuntu\"\n",
|
||||
" }],\n",
|
||||
" \"input\": [\n",
|
||||
" {\n",
|
||||
" \"role\": \"user\",\n",
|
||||
" \"content\": \"Check the latest OpenAI news on bing.com.\"\n",
|
||||
" }\n",
|
||||
" # Optional: include a screenshot of the initial state of the environment\n",
|
||||
" # {\n",
|
||||
" # type: \"input_image\", \n",
|
||||
" # image_url: f\"data:image/png;base64,{screenshot_base64}\"\n",
|
||||
" # }\n",
|
||||
" ],\n",
|
||||
" \"reasoning\": {\n",
|
||||
" \"generate_summary\": \"concise\",\n",
|
||||
" },\n",
|
||||
" \"truncation\": \"auto\"\n",
|
||||
" }\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"print(response.json())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"True\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from openai import OpenAI\n",
|
||||
"client = OpenAI() # assumes OPENAI_API_KEY is set in env\n",
|
||||
"\n",
|
||||
"def has_model_starting_with(prefix=\"computer\"):\n",
|
||||
" models = client.models.list().data\n",
|
||||
" return any(model.id.startswith(prefix) for model in models)\n",
|
||||
"\n",
|
||||
"print(has_model_starting_with())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"response = requests.post(\n",
|
||||
" \"https://api.openai.com/v1/responses\",\n",
|
||||
" headers={\n",
|
||||
" \"Content-Type\": \"application/json\",\n",
|
||||
" \"Authorization\": f\"Bearer {os.environ['OPENAI_API_KEY']}\"\n",
|
||||
" },\n",
|
||||
" json={\n",
|
||||
" \"model\": \"gpt-4o\",\n",
|
||||
" \"input\": \"Tell me a three sentence bedtime story about a unicorn.\"\n",
|
||||
" }\n",
|
||||
")\n",
|
||||
"print(response.json())"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user