File size: 839 Bytes
3d63627
 
 
 
 
 
d0d21eb
3d63627
 
 
 
 
 
 
9ec3492
08f1a87
3d63627
08f1a87
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
import json
from src.agent.utils.tooling import tool

@tool
def get_downtimes() -> str:
    """
    This tool provide the production downtimes which is useful for understanding production issues and causes. Data contains information about downtimes including their description, duration and causes.
    """
    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 or data == "[]":
            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