ver Jan31stv4

evaluating som on calc
This commit is contained in:
David Chang
2024-01-31 16:22:26 +08:00
parent 29f2f3eaf8
commit 8a62d96fd3
2 changed files with 71 additions and 9 deletions

View File

@@ -135,6 +135,8 @@ def main(example_class, example_id):
# example["snapshot"] = "exp_setup4"
example["snapshot"] = "Snapshot 30"
logger.info("TASK: %s/%s", example_class, example_id)
api_key = os.environ.get("OPENAI_API_KEY")
agent = GPT4v_Agent(api_key=api_key, model=gpt4_model, max_tokens=1000, instruction=example['instruction'],
action_space=action_space, exp="som")
@@ -158,23 +160,44 @@ if __name__ == '__main__':
, "43c2d64c-bab5-4dcb-a30c-b888321c319a"
, "7688b85f-87a4-4e4a-b2f8-f3d6c3f29b82"
, "ec4e3f68-9ea4-4c18-a5c9-69f89d1178b3"
, "a462a795-fdc7-4b23-b689-e8b6df786b78"
, "f9be0997-4b7c-45c5-b05c-4612b44a6118"
, "ae039631-2b12-4637-84f6-c67d51511be3"
, "e2eb4bf1-aa93-4192-b55d-03e2fb6dfd15"
, "28cc3b7e-b194-4bc9-8353-d04c0f4d56d2"
, "5ea617a3-0e86-4ba6-aab2-dac9aa2e8d57"
, "e0df059f-28a6-4169-924f-b9623e7184cc"
, "ddc75b62-7311-4af8-bfb3-859558542b36"
, "5c433d22-ed9a-4e31-91f5-54cf3e8acd63"
, "b6781586-6346-41cd-935a-a6b1487918fc"
, "b3d4a89c-53f2-4d6b-8b6a-541fb5d205fa"
, "3ce045a0-877b-42aa-8d2c-b4a863336ab8"
, "fe41f596-a71b-4c2f-9b2f-9dcd40b568c3"
, "a4d98375-215b-4a4d-aee9-3d4370fccc41"
, "765d2b74-88a7-4d50-bf51-34e4106fd24a"
, "13584542-872b-42d8-b299-866967b5c3ef"
, "23393935-50c7-4a86-aeea-2b78fd089c5c"
# 15, ^ os, v calc
, "eb03d19a-b88d-4de4-8a64-ca0ac66f426b"
, "0bf05a7d-b28b-44d2-955a-50b41e24012a"
, "7a4e4bc8-922c-4c84-865c-25ba34136be1"
, "a9f325aa-8c05-4e4f-8341-9e4358565f4f"
, "ecb0df7a-4e8d-4a03-b162-053391d3afaf"
, "7efeb4b1-3d19-4762-b163-63328d66303b"
, "4e6fcf72-daf3-439f-a232-c434ce416af6"
, "6054afcb-5bab-4702-90a0-b259b5d3217c"
, "abed40dc-063f-4598-8ba5-9fe749c0615d"
, "01b269ae-2111-4a07-81fd-3fcd711993b0"
, "8b1ce5f2-59d2-4dcc-b0b0-666a714b9a14"
, "0cecd4f3-74de-457b-ba94-29ad6b5dafb6"
, "4188d3a4-077d-46b7-9c86-23e1a036f6c1"
, "51b11269-2ca8-4b2a-9163-f21758420e78"
, "7e429b8d-a3f0-4ed0-9b58-08957d00b127"
, "347ef137-7eeb-4c80-a3bb-0951f26a8aff"
, "6e99a1ad-07d2-4b66-a1ce-ece6d99c20a5"
, "3aaa4e37-dc91-482e-99af-132a612d40f3"
, "37608790-6147-45d0-9f20-1137bb35703d"
, "f9584479-3d0d-4c79-affa-9ad7afdd8850"
, "d681960f-7bc3-4286-9913-a8812ba3261a"
, "21df9241-f8d7-4509-b7f1-37e501a823f7"
, "1334ca3e-f9e3-4db8-9ca7-b4c653be7d17"
, "357ef137-7eeb-4c80-a3bb-0951f26a8aff"
, "aa3a8974-2e85-438b-b29e-a64df44deb4b"
, "a01fbce3-2793-461f-ab86-43680ccbae25"
, "4f07fbe9-70de-4927-a4d5-bb28bc12c52c"
]
for example_id in xx_list:
main("os", example_id)
for example_id in xx_list[16:]:
main("libreoffice_calc", example_id)

39
test_connection.py Normal file
View File

@@ -0,0 +1,39 @@
#import openai
#import yaml
#from typing import Dict
import os
import requests
# with open("openaiconfig.yaml") as f:
# config: Dict[str, str] = yaml.load(f, Loader=yaml.Loader)
# openai.api_key = config["api_key"]
#with open("llmcases/debug-20230420@191814.log.api_version.-1") as f:
#prompt = f.read()
#prompt = "Hello, "
prompt = [ { "role": "user"
, "content": "Hello,"
}
]
api_key = os.environ.get("OPENAI_API_KEY")
payload = { "model": "gpt-4-vision-preview"
, "messages": prompt
, "max_tokens": 100
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
response = requests.post(
"https://api.openai.com/v1/chat/completions",
headers=headers,
json=payload
)
#completion = openai.Completion.create( model="gpt-4-vision-preview"
#, prompt=prompt
#, request_timeout=20.
#)
print(response.json())