MVPilgrim commited on
Commit
baa95e2
·
1 Parent(s): 01e614b
Files changed (1) hide show
  1. app.py +27 -15
app.py CHANGED
@@ -400,12 +400,13 @@ try:
400
  wpCollection = st.session_state.wpCollection
401
  for chunk in enumerate(semChunks.objects):
402
  logger.info(f"#### chunk: {chunk}")
403
- ragData = ragData + "\n" + chunk[1].properties['chunk']
404
  webpage_uuid = chunk[1].properties['references']['webpage']
405
  logger.info(f"webpage_uuid: {webpage_uuid}")
406
  wpFromChunk = wpCollection.query.fetch_object_by_id(webpage_uuid)
407
  logger.info(f"### wpFromChunk title: {wpFromChunk.properties['title']}")
408
  #collection = client.collections.get("Chunks")
 
409
  logger.info("#### getRagData() exited.")
410
  return ragData
411
 
@@ -493,24 +494,35 @@ try:
493
  st.session_state.ragpTA = ragPrompt
494
  userPrompt = pprompt + "\n" + ragPrompt
495
  prompt = userPrompt
496
- userPrompt = "This prompt is divided into two main sections. " \
497
- "The first section starts with 'MAINPROMPT:' which is the actual question or instruction of the prompt. " \
498
- + "The second section of the prompt starts with 'ADDITIONALCONTEXT:'. It contains additional information to evaluate along with " \
499
- + "information within from the large language model itself. " \
500
- + "Use it to clarify and supplement the prompt, but otherwise make sure to process the prompt in the standard manner. " \
501
- + "MAINPROMPT: " + pprompt + " " \
502
- + "ADDITIONALCONTEXT: " + ragPrompt
 
 
 
 
 
 
 
 
 
 
503
  else:
504
  #userPrompt = st.session_state.sysTA + " " + pprompt
505
  userPrompt = pprompt
506
  #prompt = f""" <s> [INST] <<SYS>> {systemTextArea.value} </SYS>> Q: {userPrompt} A: [/INST]"""
507
- fullPrompt = [
508
- {"role": "system", "content": st.session_state.sysTA},
509
- {
510
- "role": "user",
511
- "content": userPrompt
512
- }
513
- ]
 
514
  logger.info(f"### userPrompt: {userPrompt}")
515
  logger.info("setPrompt exited.")
516
  return fullPrompt
 
400
  wpCollection = st.session_state.wpCollection
401
  for chunk in enumerate(semChunks.objects):
402
  logger.info(f"#### chunk: {chunk}")
403
+ ragData = ragData + chunk[1].properties['chunk'] + "\n"
404
  webpage_uuid = chunk[1].properties['references']['webpage']
405
  logger.info(f"webpage_uuid: {webpage_uuid}")
406
  wpFromChunk = wpCollection.query.fetch_object_by_id(webpage_uuid)
407
  logger.info(f"### wpFromChunk title: {wpFromChunk.properties['title']}")
408
  #collection = client.collections.get("Chunks")
409
+ logger.info("#### ragData: {ragData}")
410
  logger.info("#### getRagData() exited.")
411
  return ragData
412
 
 
494
  st.session_state.ragpTA = ragPrompt
495
  userPrompt = pprompt + "\n" + ragPrompt
496
  prompt = userPrompt
497
+ #userPrompt = "This prompt is divided into two main sections. " \
498
+ # "The first section starts with 'MAINPROMPT:' which is the actual question or instruction of the prompt. " \
499
+ # + "The second section of the prompt starts with 'ADDITIONALCONTEXT:'. It contains additional information to evaluate along with " \
500
+ # + "information within from the large language model itself. " \
501
+ # + "Use it to clarify and supplement the prompt, but otherwise make sure to process the prompt in the standard manner. " \
502
+ # + "MAINPROMPT: " + pprompt + " " \
503
+ # + "ADDITIONALCONTEXT: " + ragPrompt
504
+ userPrompt = "<prompt>" \
505
+ + "Answer the following question or carry out the following instruction and supplement " \
506
+ + "the LLM processing of the question or instruction using the retrieved information from the knowledge base. " \
507
+ + "Question or Instruction: " + pprompt + "\n" \
508
+ + "Retrieve the relevant information from the knowledge base: "
509
+ + "<knowledge_base>" \
510
+ + ragPrompt \
511
+ + "</knowledge_base>" \
512
+ + "</prompt>"
513
+
514
  else:
515
  #userPrompt = st.session_state.sysTA + " " + pprompt
516
  userPrompt = pprompt
517
  #prompt = f""" <s> [INST] <<SYS>> {systemTextArea.value} </SYS>> Q: {userPrompt} A: [/INST]"""
518
+ #fullPrompt = [
519
+ # {"role": "system", "content": st.session_state.sysTA},
520
+ # {
521
+ # "role": "user",
522
+ # "content": userPrompt
523
+ # }
524
+ #]
525
+ fullPrompt = userPrompt
526
  logger.info(f"### userPrompt: {userPrompt}")
527
  logger.info("setPrompt exited.")
528
  return fullPrompt