Spaces:
Sleeping
Sleeping
Create utils.py
Browse files
utils.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
|
| 3 |
+
with open("tools.jsonl", "r", encoding="utf-8") as f:
|
| 4 |
+
tools = [json.loads(line) for line in f]
|
| 5 |
+
|
| 6 |
+
# Load policy data (you'll need to load these from your files)
|
| 7 |
+
with open("info.md", "r", encoding="utf-8") as f:
|
| 8 |
+
pilatopia_complete_info = f.read()
|
| 9 |
+
|
| 10 |
+
with open("saudi_consumer_protection.md", "r", encoding="utf-8") as f:
|
| 11 |
+
saudi_consumer_protection = f.read()
|
| 12 |
+
|
| 13 |
+
verify_tool_check_prompt = """
|
| 14 |
+
- Does the tool call match the user’s actual request?
|
| 15 |
+
- Are all required parameters present and valid?
|
| 16 |
+
- Is the tool appropriate based on the user's context (e.g., not booking Recovery for a pregnant user)?
|
| 17 |
+
- If the tool modifies membership, does it comply with the rules (e.g., cancel within 48 hours, postpone between 2 weeks and 2 months)?
|
| 18 |
+
- If the user is under 18 or over 68, was the action permitted by policy?
|
| 19 |
+
- Did the agent reference the result of the tool call in their response if needed?
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
|