alexkueck commited on
Commit
9156bad
1 Parent(s): 9f5a0e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -53,6 +53,7 @@ RAG_CHAIN_PROMPT = PromptTemplate(input_variables = ["context", "question"],
53
  template = rag_template)
54
 
55
  #Pfad, wo Docs abgelegt werden können - lokal, also hier im HF Space (sonst auf eigenem Rechner)
 
56
  CHROMA_DIR = "/data/chroma"
57
  YOUTUBE_DIR = "/data/youtube"
58
 
@@ -62,7 +63,7 @@ YOUTUBE_URL_1 = "https://www.youtube.com/watch?v=--khbXchTeE"
62
  YOUTUBE_URL_2 = "https://www.youtube.com/watch?v=hdhZwyf24mE"
63
  YOUTUBE_URL_3 = "https://www.youtube.com/watch?v=vw-KWfKwvTQ"
64
 
65
- MODEL_NAME = "gpt-4"
66
 
67
  def document_loading_splitting():
68
  # Document loading
@@ -96,9 +97,14 @@ def document_storage_mongodb(splits):
96
  collection = MONGODB_COLLECTION,
97
  index_name = MONGODB_INDEX_NAME)
98
 
99
- def document_retrieval_chroma(llm, prompt):
100
- db = Chroma(embedding_function = OpenAIEmbeddings(),
101
- persist_directory = CHROMA_DIR)
 
 
 
 
 
102
  return db
103
 
104
  def document_retrieval_mongodb(llm, prompt):
 
53
  template = rag_template)
54
 
55
  #Pfad, wo Docs abgelegt werden können - lokal, also hier im HF Space (sonst auf eigenem Rechner)
56
+ PATH_WORK = "."
57
  CHROMA_DIR = "/data/chroma"
58
  YOUTUBE_DIR = "/data/youtube"
59
 
 
63
  YOUTUBE_URL_2 = "https://www.youtube.com/watch?v=hdhZwyf24mE"
64
  YOUTUBE_URL_3 = "https://www.youtube.com/watch?v=vw-KWfKwvTQ"
65
 
66
+ MODEL_NAME = "gpt-3.5-turbo-16k"
67
 
68
  def document_loading_splitting():
69
  # Document loading
 
97
  collection = MONGODB_COLLECTION,
98
  index_name = MONGODB_INDEX_NAME)
99
 
100
+ def document_retrieval_chroma(llm, prompt):
101
+ embeddings = OpenAIEmbeddings()
102
+ #Alternative Embedding - für Vektorstore, um Ähnlichkeitsvektoren zu erzeugen
103
+ #embeddings = HuggingFaceInstructEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2", model_kwargs={"device": "cpu"})
104
+ db = Chroma(embedding_function = embeddings,
105
+ #persist_directory = CHROMA_DIR)
106
+ persist_directory = path_work + '/chroma',
107
+
108
  return db
109
 
110
  def document_retrieval_mongodb(llm, prompt):