alexkueck commited on
Commit
9479f46
1 Parent(s): e776b9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -202,7 +202,7 @@ def document_retrieval_chroma(llm, prompt):
202
  #etwas weniger rechenaufwendig:
203
  #embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2", model_kwargs={"device": "cpu"}, encode_kwargs={'normalize_embeddings': False})
204
 
205
- #ChromaDb für OpenAI embedinngs
206
  db = Chroma(embedding_function = embeddings, persist_directory = PATH_WORK + CHROMA_DIR)
207
  return db
208
 
@@ -247,7 +247,8 @@ def generate_prompt_with_history(text, history, max_length=2048):
247
  for x in history[::-1]:
248
  history_text = x + history_text
249
  flag = True
250
-
 
251
  if flag:
252
  return prompt+history_text
253
  else:
@@ -336,7 +337,9 @@ def invoke (prompt, history, rag_option, model_option, openai_api_key, temperat
336
  db = document_retrieval_mongodb(llm, history_text_und_prompt)
337
  result = rag_chain(llm, history_text_und_prompt, db)
338
  else:
 
339
  result = llm_chain(llm, history_text_und_prompt)
 
340
 
341
  except Exception as e:
342
  raise gr.Error(e)
 
202
  #etwas weniger rechenaufwendig:
203
  #embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2", model_kwargs={"device": "cpu"}, encode_kwargs={'normalize_embeddings': False})
204
 
205
+ #ChromaDb um die embedings zu speichern
206
  db = Chroma(embedding_function = embeddings, persist_directory = PATH_WORK + CHROMA_DIR)
207
  return db
208
 
 
247
  for x in history[::-1]:
248
  history_text = x + history_text
249
  flag = True
250
+ print ("Prompt: ..........................")
251
+ print(prompt+history_text)
252
  if flag:
253
  return prompt+history_text
254
  else:
 
337
  db = document_retrieval_mongodb(llm, history_text_und_prompt)
338
  result = rag_chain(llm, history_text_und_prompt, db)
339
  else:
340
+ print("LLM aufrufen via HF: ...........")
341
  result = llm_chain(llm, history_text_und_prompt)
342
+ print(result)
343
 
344
  except Exception as e:
345
  raise gr.Error(e)