File size: 2,228 Bytes
9378914
6161c48
 
 
9378914
 
6161c48
 
 
 
 
 
 
 
 
 
 
9378914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6161c48
 
 
51e6285
6161c48
 
 
 
 
 
 
 
9378914
6161c48
 
 
9378914
6161c48
 
 
 
 
 
 
 
 
9378914
6161c48
 
 
51e6285
6161c48
 
 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import streamlit
import logging


st.markdown("<h1 style='text-align: center; color: #666666;'>Vector Database RAG Proof of Concept</h1>", unsafe_allow_html=True)
st.markdown("<h6 style='text-align: center; color: #666666;'>V1</h6>", unsafe_allow_html=True)

logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)



######################################################################
# MAINLINE
#
logger.info("#### MAINLINE ENTERED.")



systemTextArea = st.empty()
userTextArea = st.empty()
ragPromptTextArea = st.empty()
responseTextArea = st.empty()
selectRag = st.checkbox("Enable Query With RAG", \
                        value=False, \
                        key="selectRag", \
                        help=None, \
                        on_change=None, \
                        args=None, \
                        kwargs=None, \
                        *, \
                        disabled=False, \
                        label_visibility="visible" \
                       )
submitButton = st.button(label, \
                         key=None, \
                         help=None, \
                         on_click=None, \
                         args=None, \
                         kwargs=None, \
                         *, type="secondary", \
                         disabled=False, \
                         use_container_width=False \
                        )


# Display UI
logger.debug("### Before displaying UI: ")
display(systemTextArea)
display(userTextArea)
display(ragPromptTextArea)
display(responseTextArea)
display(selectRag)
display(submitButton)

def runLLM(prompt):
    result = ""
    return(result)

def setPrompt(pprompt,ragFlag):
    userPrompt = ""
    return userPrompt


def on_submitButton_clicked(b):
    with output_widget:
        clear_output(wait=True)
        ragPromptTextArea.value = ""
        responseTextArea.value = ""
        log.debug(f"### selectRag: {selectRag.value}")
        prompt = setPrompt(userTextArea.value,selectRag.value)user
        log.debug("### prompt: " + prompt)
        runLLM(prompt)

logger.info("\n### Before calling submitButton.on_click().")
submitButton.on_click(on_submitButton_clicked)
display(output_widget)