MikeMann commited on
Commit
0338b1c
·
1 Parent(s): e28c0cb

Removed Tokenizer from RemoteRag

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -316,9 +316,9 @@ class BSIChatbot:
316
  Question: {question}""",
317
  },
318
  ]
319
- RAG_PROMPT_TEMPLATE = self.llmtokenizer.apply_chat_template(
320
- prompt_in_chat_format, tokenize=False, add_generation_prompt=True
321
- )
322
  retrieved_chunks = self.retrieveSimiliarEmbedding(query)
323
  retrieved_chunks_text = []
324
  #TODO Irgendwas stimmt hier mit den Listen nicht
@@ -351,7 +351,7 @@ class BSIChatbot:
351
  context = "\nExtracted documents:\n"
352
  context += "".join([doc for i, doc in enumerate(retrieved_chunks_text)])
353
  #Alles außer letzte Useranfrage
354
- final_prompt = RAG_PROMPT_TEMPLATE.format(
355
  question=query, context=context, history=history[:-1]
356
  )
357
 
@@ -529,9 +529,9 @@ if __name__ == '__main__':
529
 
530
  def gradiobot(history: list):
531
  start = time.time()
532
- print(f"ragQuery hist -1:{history[-1].get('content')}")
533
- print(f"ragQuery hist 0:{history[0].get('content')}")
534
- print(f"fullHistory: {history}" )
535
  bot_response = bot.ragPromptRemote(history[-1].get('content'), reranking, history)
536
  history.append({"role": "assistant", "content": ""})
537
 
 
316
  Question: {question}""",
317
  },
318
  ]
319
+ #RAG_PROMPT_TEMPLATE = self.llmtokenizer.apply_chat_template(
320
+ # prompt_in_chat_format, tokenize=False, add_generation_prompt=True
321
+ #)
322
  retrieved_chunks = self.retrieveSimiliarEmbedding(query)
323
  retrieved_chunks_text = []
324
  #TODO Irgendwas stimmt hier mit den Listen nicht
 
351
  context = "\nExtracted documents:\n"
352
  context += "".join([doc for i, doc in enumerate(retrieved_chunks_text)])
353
  #Alles außer letzte Useranfrage
354
+ final_prompt = prompt_in_chat_format.format(
355
  question=query, context=context, history=history[:-1]
356
  )
357
 
 
529
 
530
  def gradiobot(history: list):
531
  start = time.time()
532
+ print(f"DBG: ragQuery hist -1:{history[-1].get('content')}")
533
+ print(f"DBG: ragQuery hist 0:{history[0].get('content')}")
534
+ print(f"DBG: fullHistory: {history}" )
535
  bot_response = bot.ragPromptRemote(history[-1].get('content'), reranking, history)
536
  history.append({"role": "assistant", "content": ""})
537