File size: 692 Bytes
2217335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import logging
import warnings

from dotenv import load_dotenv


from rag import RAG

USER_INPUT = 100


def setup():
    load_dotenv()
    warnings.filterwarnings("ignore")

    logging.addLevelName(USER_INPUT, "USER_INPUT")
    logging.basicConfig(format="[%(levelname)s]: %(message)s", level=logging.INFO)


def interactive(model: RAG):
    logging.info("Write `exit` when you want to stop the model.")
    print()

    query = ""
    while query.lower() != "exit":
        logging.log(USER_INPUT, "Write the query or `exit`:")
        query = input()

        if query.lower() == "exit":
            break

        response = model.get_response(query)
        print(response, end="\n\n")