Merge branch 'feat/aws-provider-support' of https://github.com/xlang-ai/OSWorld into feat/aws-provider-support
This commit is contained in:
@@ -113,6 +113,62 @@ To configure the OAuth2.0 screen for the created GCP. Go to page [OAuth consent
|
|||||||
<img src="assets/authorization.png" width="45%" alt="Authorization">
|
<img src="assets/authorization.png" width="45%" alt="Authorization">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
## Generating `credentials.json` for Public Eval (Optional)
|
||||||
|
|
||||||
|
If you are using **Public Eval** for evaluation, you need to complete the OAuth2 authorization **locally**, and then upload the generated `credentials.json` file to your AWS Host instance.
|
||||||
|
|
||||||
|
Please follow the steps below:
|
||||||
|
|
||||||
|
1. Run the following Python script on your **local machine** (make sure you have installed `google-auth-oauthlib` and `google-auth`):
|
||||||
|
|
||||||
|
```python
|
||||||
|
from google_auth_oauthlib.flow import InstalledAppFlow
|
||||||
|
import json
|
||||||
|
|
||||||
|
SCOPES = ['https://www.googleapis.com/auth/drive']
|
||||||
|
|
||||||
|
flow = InstalledAppFlow.from_client_secrets_file(
|
||||||
|
'client_secrets.json',
|
||||||
|
scopes=SCOPES
|
||||||
|
)
|
||||||
|
|
||||||
|
credentials = flow.run_local_server(port=0)
|
||||||
|
|
||||||
|
with open('credentials.json', 'w') as f:
|
||||||
|
f.write(credentials.to_json())
|
||||||
|
|
||||||
|
print("OAuth2 credentials have been saved to credentials.json.")
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Note**: This script will open a browser window for you to log in and authorize access using the configured Google account.
|
||||||
|
|
||||||
|
After successful authorization, a `credentials.json` file will be generated on your local machine.
|
||||||
|
|
||||||
|
2. Upload this file to your AWS Host instance and place it at the following path:
|
||||||
|
|
||||||
|
```
|
||||||
|
OSWorld/evaluation_examples/settings/googledrive/credentials.json
|
||||||
|
```
|
||||||
|
|
||||||
|
After the setup, your directory structure on the AWS Host should look like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
evaluation_examples/
|
||||||
|
├── examples/
|
||||||
|
├── examples_windows/
|
||||||
|
├── settings/
|
||||||
|
├── google/
|
||||||
|
│ ├── settings.json
|
||||||
|
│ ├── settings.json.template
|
||||||
|
├── googledrive/
|
||||||
|
│ ├── client_secrets.json
|
||||||
|
│ ├── credentials.json
|
||||||
|
│ ├── settings.yml
|
||||||
|
└── thunderbird/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Potential Issues
|
## Potential Issues
|
||||||
|
|
||||||
Due to strict check by Google safety teams, even if we shut down the 2-step verification, Google still detects potential risks of your account, especially __when you frequently change the login device__. You may encounter the following issues:
|
Due to strict check by Google safety teams, even if we shut down the 2-step verification, Google still detects potential risks of your account, especially __when you frequently change the login device__. You may encounter the following issues:
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ class OpenAICUAAgent:
|
|||||||
Raises:
|
Raises:
|
||||||
requests.exceptions.RequestException: If the API request fails
|
requests.exceptions.RequestException: If the API request fails
|
||||||
"""
|
"""
|
||||||
MAX_RETRIES = 100
|
MAX_RETRIES = 200
|
||||||
retry_count = 0
|
retry_count = 0
|
||||||
while retry_count < MAX_RETRIES:
|
while retry_count < MAX_RETRIES:
|
||||||
try:
|
try:
|
||||||
@@ -338,7 +338,7 @@ class OpenAICUAAgent:
|
|||||||
logger.warning("Unknown message structure, cannot update screenshot")
|
logger.warning("Unknown message structure, cannot update screenshot")
|
||||||
|
|
||||||
retry_count += 1
|
retry_count += 1
|
||||||
time.sleep(min(30, 2 ** retry_count))
|
time.sleep(5)
|
||||||
logger.critical("Max retries exceeded for OpenAI API")
|
logger.critical("Max retries exceeded for OpenAI API")
|
||||||
raise RuntimeError("OpenAI API failed too many times")
|
raise RuntimeError("OpenAI API failed too many times")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user