Spaces:
Runtime error
Runtime error
app/services/guardrails.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import json
|
| 2 |
from fastapi import HTTPException
|
| 3 |
from langchain_core.prompts import ChatPromptTemplate
|
|
@@ -88,5 +92,4 @@ def check_output_guardrail(solution: str | None) -> (bool, str):
|
|
| 88 |
return (False, "AI refused to answer the question.")
|
| 89 |
|
| 90 |
print("--- Guardrail: Output OK ---")
|
| 91 |
-
return (True, solution)
|
| 92 |
-
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
os.environ["DSPY_CACHE_DIR"] = "/tmp/.dspy_cache"
|
| 3 |
+
|
| 4 |
+
# --- ALL OTHER IMPORTS MUST BE BELOW THIS FIX ---
|
| 5 |
import json
|
| 6 |
from fastapi import HTTPException
|
| 7 |
from langchain_core.prompts import ChatPromptTemplate
|
|
|
|
| 92 |
return (False, "AI refused to answer the question.")
|
| 93 |
|
| 94 |
print("--- Guardrail: Output OK ---")
|
| 95 |
+
return (True, solution)
|
|
|