bstraehle commited on
Commit
84fed2d
·
1 Parent(s): d5db815

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -125,6 +125,8 @@ def invoke(openai_api_key, rag_option, prompt):
125
  raise gr.Error("Retrieval Augmented Generation is required.")
126
  if (prompt == ""):
127
  raise gr.Error("Prompt is required.")
 
 
128
  try:
129
  llm = ChatOpenAI(model_name = config.model,
130
  openai_api_key = openai_api_key,
@@ -132,13 +134,11 @@ def invoke(openai_api_key, rag_option, prompt):
132
  if (rag_option == "Chroma"):
133
  #splits = document_loading_splitting()
134
  #document_storage_chroma(splits)
135
- config.rag_option = "Chroma"
136
  db = document_retrieval_chroma(llm, prompt)
137
  result = rag_chain(llm, prompt, db)
138
  elif (rag_option == "MongoDB"):
139
  #splits = document_loading_splitting()
140
  #document_storage_mongodb(splits)
141
- config.rag_option = "MongoDB"
142
  db = document_retrieval_mongodb(llm, prompt)
143
  result = rag_chain(llm, prompt, db)
144
  else:
 
125
  raise gr.Error("Retrieval Augmented Generation is required.")
126
  if (prompt == ""):
127
  raise gr.Error("Prompt is required.")
128
+ config.rag_option = rag_option
129
+ config.update(allow_val_change = True)
130
  try:
131
  llm = ChatOpenAI(model_name = config.model,
132
  openai_api_key = openai_api_key,
 
134
  if (rag_option == "Chroma"):
135
  #splits = document_loading_splitting()
136
  #document_storage_chroma(splits)
 
137
  db = document_retrieval_chroma(llm, prompt)
138
  result = rag_chain(llm, prompt, db)
139
  elif (rag_option == "MongoDB"):
140
  #splits = document_loading_splitting()
141
  #document_storage_mongodb(splits)
 
142
  db = document_retrieval_mongodb(llm, prompt)
143
  result = rag_chain(llm, prompt, db)
144
  else: