Spaces:
Running
Running
MVPilgrim
commited on
Commit
·
6a93b6a
1
Parent(s):
a21c53e
debug
Browse files
app.py
CHANGED
@@ -512,27 +512,38 @@ try:
|
|
512 |
st.session_state.ragpTA = ragPrompt
|
513 |
userPrompt = pprompt + "\n" + ragPrompt
|
514 |
prompt = userPrompt
|
515 |
-
userPrompt = "<prompt>" \
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
|
|
|
|
|
|
|
|
|
|
525 |
|
526 |
else:
|
527 |
userPrompt = pprompt
|
528 |
|
529 |
-
fullPrompt = [
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
logger.debug(f"### userPrompt: {userPrompt}")
|
537 |
logger.info("setPrompt exited.")
|
538 |
return fullPrompt
|
@@ -544,8 +555,10 @@ try:
|
|
544 |
def prettyPrint(text):
|
545 |
try:
|
546 |
logger.info("### prettyPrint entered.")
|
|
|
|
|
547 |
outstr = io.StringIO()
|
548 |
-
pprint.pprint(object=text,stream=outstr,indent=1,width=
|
549 |
prettyText = outstr.getvalue()
|
550 |
logger.info("### prettyPrint exited.")
|
551 |
return prettyText
|
|
|
512 |
st.session_state.ragpTA = ragPrompt
|
513 |
userPrompt = pprompt + "\n" + ragPrompt
|
514 |
prompt = userPrompt
|
515 |
+
#userPrompt = "<prompt>" \
|
516 |
+
# + "Answer the following question or carry out the following instruction and also supplement " \
|
517 |
+
# + "the LLM processing of the question or instruction using the retrieved information from the knowledge base. " \
|
518 |
+
# + "Question or Instruction: " \
|
519 |
+
# + pprompt + 7" " \
|
520 |
+
# + "Retrieve the relevant information from the knowledge base: " \
|
521 |
+
# + "<knowledge_base>" \
|
522 |
+
# + ragPrompt \
|
523 |
+
# + "</knowledge_base>" \
|
524 |
+
# + "</prompt>"
|
525 |
+
|
526 |
+
userPrompt = pprompt + " " \
|
527 |
+
+ "Also, combine the following information with information in the LLM itself. " \
|
528 |
+
+ "Use the combined information to generate the response. " \
|
529 |
+
+ ragPrompt + " "
|
530 |
|
531 |
else:
|
532 |
userPrompt = pprompt
|
533 |
|
534 |
+
#fullPrompt = [
|
535 |
+
# {"role": "system", "content": st.session_state.sysTA},
|
536 |
+
# {
|
537 |
+
# "role": "user",
|
538 |
+
# "content": userPrompt
|
539 |
+
# }
|
540 |
+
#]
|
541 |
+
|
542 |
+
fullPrompt = {
|
543 |
+
"prompt": userPrompt,
|
544 |
+
"system_prompt": st.session_state.sysTA
|
545 |
+
}
|
546 |
+
|
547 |
logger.debug(f"### userPrompt: {userPrompt}")
|
548 |
logger.info("setPrompt exited.")
|
549 |
return fullPrompt
|
|
|
555 |
def prettyPrint(text):
|
556 |
try:
|
557 |
logger.info("### prettyPrint entered.")
|
558 |
+
logger.info(f"### text: {text}")
|
559 |
+
text = text.replace("\\n", "\n")
|
560 |
outstr = io.StringIO()
|
561 |
+
pprint.pprint(object=text,stream=outstr,indent=1,width=60)
|
562 |
prettyText = outstr.getvalue()
|
563 |
logger.info("### prettyPrint exited.")
|
564 |
return prettyText
|