File size: 709 Bytes
2d521fd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import random
import logging
from app.models.intent_models import IntentSimulation
logger = logging.getLogger(__name__)
# Note: This endpoint is deprecated. Use /v1/intents/evaluate instead.
def simulate_intent(intent: IntentSimulation) -> dict:
logger.warning("Deprecated endpoint /simulate_intent used. Please migrate to /v1/intents/evaluate.")
# For backward compatibility, we still use random risk.
risk_score = random.uniform(0, 1)
if risk_score < 0.2:
recommendation = "safe_to_execute"
elif risk_score < 0.6:
recommendation = "requires_approval"
else:
recommendation = "blocked"
return {"risk_score": risk_score, "recommendation": recommendation}
|