Spaces:
Sleeping
Sleeping
File size: 772 Bytes
3d63627 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import json
from src.agent.utils.tooling import tool
@tool
def get_downtimes() -> str:
"""
This tool retrieves the production downtimes including :
- Timestamps of downtimes starts and endings,
- Event, Error Code and Error Description
"""
try:
with open("data/downtimes.json", "r") as f:
json_string = f.read()
data = json.loads(json_string)
if data is None or len(data) == 0:
result = "No downtimes recorded yet. Please check the production status or wait for downtimes to occur."
else:
result = "## Downtimes:\n\n"
result += json_string
return result
except Exception as e:
print(f"Error getting production status: {e}")
return None |