Spaces:
Running
Running
Update agents.py
Browse files
agents.py
CHANGED
|
@@ -2,18 +2,10 @@ import os
|
|
| 2 |
import json
|
| 3 |
import math
|
| 4 |
import time
|
| 5 |
-
import transformers.utils
|
| 6 |
from huggingface_hub import HfApi
|
| 7 |
from smolagents import CodeAgent, tool, HfApiModel
|
| 8 |
|
| 9 |
-
# --- 1.
|
| 10 |
-
# Ensuring compatibility with older transformers versions if needed
|
| 11 |
-
if not hasattr(transformers.utils, 'is_offline_mode'):
|
| 12 |
-
transformers.utils.is_offline_mode = lambda: False
|
| 13 |
-
if not hasattr(transformers.utils, 'is_soundfile_available'): # Fixed typo in 'available'
|
| 14 |
-
transformers.utils.is_soundfile_available = lambda: False
|
| 15 |
-
|
| 16 |
-
# --- 2. THE TOOLS ---
|
| 17 |
|
| 18 |
@tool
|
| 19 |
def black_eagle_pulsating_shield(base_radius: float) -> str:
|
|
@@ -66,17 +58,15 @@ def black_eagle_vault_save(node_data: str) -> str:
|
|
| 66 |
repo_id=REPO_ID,
|
| 67 |
repo_type="dataset"
|
| 68 |
)
|
| 69 |
-
return f"SUCCESS: Node archived in Hub Vault
|
| 70 |
except Exception as e:
|
| 71 |
print(f"SENTINEL: Hub Push FAILED. Error: {str(e)}")
|
| 72 |
return f"HUB SYNC ERROR: {str(e)}"
|
| 73 |
|
| 74 |
-
# ---
|
| 75 |
token = os.getenv("HF_TOKEN")
|
| 76 |
-
# Using a robust model for code generation
|
| 77 |
model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-3B-Instruct", token=token)
|
| 78 |
|
| 79 |
-
# List of tools to pass to the agent
|
| 80 |
all_tools = [autonomous_spectrum_scrub, black_eagle_pulsating_shield, black_eagle_vault_save]
|
| 81 |
|
| 82 |
nano_patrol_agent = CodeAgent(
|
|
@@ -86,7 +76,6 @@ nano_patrol_agent = CodeAgent(
|
|
| 86 |
max_steps=10
|
| 87 |
)
|
| 88 |
|
| 89 |
-
# Set the system prompt explicitly if you want to override the default
|
| 90 |
nano_patrol_agent.system_prompt = """
|
| 91 |
YOU ARE THE XYZ SOVEREIGN SENTINEL.
|
| 92 |
Your mission:
|
|
|
|
| 2 |
import json
|
| 3 |
import math
|
| 4 |
import time
|
|
|
|
| 5 |
from huggingface_hub import HfApi
|
| 6 |
from smolagents import CodeAgent, tool, HfApiModel
|
| 7 |
|
| 8 |
+
# --- 1. THE TOOLS ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
@tool
|
| 11 |
def black_eagle_pulsating_shield(base_radius: float) -> str:
|
|
|
|
| 58 |
repo_id=REPO_ID,
|
| 59 |
repo_type="dataset"
|
| 60 |
)
|
| 61 |
+
return f"SUCCESS: Node archived in Hub Vault."
|
| 62 |
except Exception as e:
|
| 63 |
print(f"SENTINEL: Hub Push FAILED. Error: {str(e)}")
|
| 64 |
return f"HUB SYNC ERROR: {str(e)}"
|
| 65 |
|
| 66 |
+
# --- 2. THE BRAIN ---
|
| 67 |
token = os.getenv("HF_TOKEN")
|
|
|
|
| 68 |
model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-3B-Instruct", token=token)
|
| 69 |
|
|
|
|
| 70 |
all_tools = [autonomous_spectrum_scrub, black_eagle_pulsating_shield, black_eagle_vault_save]
|
| 71 |
|
| 72 |
nano_patrol_agent = CodeAgent(
|
|
|
|
| 76 |
max_steps=10
|
| 77 |
)
|
| 78 |
|
|
|
|
| 79 |
nano_patrol_agent.system_prompt = """
|
| 80 |
YOU ARE THE XYZ SOVEREIGN SENTINEL.
|
| 81 |
Your mission:
|