File size: 2,245 Bytes
e458941
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from pprint import pprint
from llm.llm import VirtualNurseLLM

class NurseCLI:
    def __init__(self, nurse_llm: VirtualNurseLLM):
        self.nurse_llm = nurse_llm
        self.nurse_llm.debug = False

    def start(self):
        print("Welcome to the Nurse LLM CLI.")
        print("Type your question, or enter 'history' to see chat history")
        print("Enter 'help' for a list of available commands.")

        while True:
            user_input = input("\nYou: ")

            if user_input.lower() == 'exit':
                print("Exiting the CLI. Goodbye!")
                break
            elif user_input.lower() == 'history':
                print("\n--- Chat History ---")
                pprint(self.nurse_llm.chat_history)
            elif user_input.lower() == 'ehr':
                print("\n--- Current EHR Data ---")
                pprint(self.nurse_llm.ehr_data)
            elif user_input.lower() == 'status':
                print("\n--- Current LLM Status ---")
                pprint(self.nurse_llm.current_prompt)
            elif user_input.lower() == 'debug':
                self.nurse_llm.debug = not self.nurse_llm.debug
                print(f"Debug mode is now {'on' if self.nurse_llm.debug else 'off'}.")
            elif user_input.lower() == 'reset':
                self.nurse_llm.reset()
                print("Chat history and EHR data have been reset.")
            elif user_input.lower() == 'help':
                self.display_help()
            else:
                # Invoke the LLM with the user input and get the response
                ehr_response = self.nurse_llm.invoke(user_input)

                # Display the response from the nurse LLM
                print("\nNurse LLM:", ehr_response)

    def display_help(self):
        print("""
        --- Available Commands ---
        - 'history'   : View the chat history.
        - 'ehr'       : View the current EHR (Electronic Health Record) data.
        - 'status'    : View the current LLM status and prompt.
        - 'debug'     : Toggle the debug mode (on/off).
        - 'reset'     : Reset the chat history and EHR data.
        - 'help'      : Display this help message.
        - 'exit'      : Exit the CLI.
        """)