Update README.md
Browse files
README.md
CHANGED
|
@@ -63,7 +63,7 @@ import base64
|
|
| 63 |
|
| 64 |
# Initialize client
|
| 65 |
client = OpenAI(
|
| 66 |
-
api_key="
|
| 67 |
base_url="http://localhost:8000/v1"
|
| 68 |
)
|
| 69 |
|
|
@@ -74,15 +74,12 @@ action = "CLICK(taskbar_icon)"
|
|
| 74 |
screenshot_b64 = "" # Your base64-encoded screenshot
|
| 75 |
|
| 76 |
# Define system prompt
|
| 77 |
-
SYSTEM_PROMPT = """You are an expert AI
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
If
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
1. If the action is safe and logical, confirm it verbatim.
|
| 84 |
-
2. If unsafe or problematic, provide a corrected approach that maintains utility.
|
| 85 |
-
3. If the instruction itself is unsafe, refuse to continue."""
|
| 86 |
|
| 87 |
# Make API call
|
| 88 |
response = client.chat.completions.create(
|
|
@@ -107,18 +104,18 @@ response = client.chat.completions.create(
|
|
| 107 |
},
|
| 108 |
{
|
| 109 |
"type": "text",
|
| 110 |
-
"text": f"\n</observation>\n\n###
|
| 111 |
}
|
| 112 |
]
|
| 113 |
}
|
| 114 |
],
|
| 115 |
-
max_tokens=
|
| 116 |
temperature=0.0
|
| 117 |
)
|
| 118 |
|
| 119 |
# Get response
|
| 120 |
-
|
| 121 |
-
print(
|
| 122 |
```
|
| 123 |
|
| 124 |
## Training Configuration
|
|
|
|
| 63 |
|
| 64 |
# Initialize client
|
| 65 |
client = OpenAI(
|
| 66 |
+
api_key="EMPTY",
|
| 67 |
base_url="http://localhost:8000/v1"
|
| 68 |
)
|
| 69 |
|
|
|
|
| 74 |
screenshot_b64 = "" # Your base64-encoded screenshot
|
| 75 |
|
| 76 |
# Define system prompt
|
| 77 |
+
SYSTEM_PROMPT = """You are an expert AI Safety Thought Aligner.
|
| 78 |
+
Your task is to correct an agent's thought based on the provided instruction, history, and observation.
|
| 79 |
+
You must follow these rules:
|
| 80 |
+
1. If the thought is already safe, helpful, and logical for the given context, you MUST output the thought verbatim, without any changes.
|
| 81 |
+
2. If the thought is unsafe, ignores risks, or is illogical, you MUST correct it into a safe, helpful, and logical thought that still aims to solve the user's goal safely.
|
| 82 |
+
3. If the instruction is unsafe, you MUST refuse to continue."""
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
# Make API call
|
| 85 |
response = client.chat.completions.create(
|
|
|
|
| 104 |
},
|
| 105 |
{
|
| 106 |
"type": "text",
|
| 107 |
+
"text": f"\n</observation>\n\n### Original Thought ###\n{thought}"
|
| 108 |
}
|
| 109 |
]
|
| 110 |
}
|
| 111 |
],
|
| 112 |
+
max_tokens=2048,
|
| 113 |
temperature=0.0
|
| 114 |
)
|
| 115 |
|
| 116 |
# Get response
|
| 117 |
+
corrected_thought = response.choices[0].message.content.strip()
|
| 118 |
+
print(corrected_thought)
|
| 119 |
```
|
| 120 |
|
| 121 |
## Training Configuration
|