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

@tool
def get_production_status() -> str:
    """
    This tool retrieves the current production status including various metrics such as operating time, unplanned stops, quality rates, availability, and performance indicators. Useful for understanding the overall production health and efficiency.
    """
    try:
        with open("data/status.json", "r") as f:
            json_string = f.read()

        data = json.loads(json_string)

        if data == {}:
            result = "'production has not started yet.'"

        elif data["opening_time"] == "0 days 00:00:00":
            result = "'Production has not started yet.'"
        else:
            result = "##### Production status:\n\n"
            result += json_string

        return result

    except Exception as e:
        print(f"Error getting production status: {e}")
        return None