bstraehle commited on
Commit
8d60a3f
·
1 Parent(s): f0f1035

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -132,7 +132,7 @@ def wandb_trace(prompt, completion, rag_option):
132
  },
133
  #start_time_ms=start_time_ms,
134
  #end_time_ms=end_time_ms,
135
- inputs={"prompt": prompt},
136
  outputs={"completion": completion},
137
  )
138
  trace.log("test")
@@ -155,21 +155,21 @@ def invoke(openai_api_key, rag_option, prompt):
155
  #document_storage_chroma(splits)
156
  db = document_retrieval_chroma(llm, prompt)
157
  completion = rag_chain(llm, prompt, db)
158
- completion = completion["result"]
159
  elif (rag_option == "MongoDB"):
160
  #splits = document_loading_splitting()
161
  #document_storage_mongodb(splits)
162
  db = document_retrieval_mongodb(llm, prompt)
163
  completion = rag_chain(llm, prompt, db)
164
- completion = completion["result"]
165
  else:
166
- completion = llm_chain(llm, prompt)
167
  except Exception as e:
168
  completion = e
169
  raise gr.Error(e)
170
  finally:
171
  wandb_trace(prompt, completion, rag_option)
172
- return completion
173
 
174
  description = """<strong>Overview:</strong> Context-aware multimodal reasoning application using a <strong>large language model (LLM)</strong> with
175
  <strong>retrieval augmented generation (RAG)</strong>.
 
132
  },
133
  #start_time_ms=start_time_ms,
134
  #end_time_ms=end_time_ms,
135
+ inputs={"prompt": prompt, "template": LLM_CHAIN_PROMPT},
136
  outputs={"completion": completion},
137
  )
138
  trace.log("test")
 
155
  #document_storage_chroma(splits)
156
  db = document_retrieval_chroma(llm, prompt)
157
  completion = rag_chain(llm, prompt, db)
158
+ result = completion["result"]
159
  elif (rag_option == "MongoDB"):
160
  #splits = document_loading_splitting()
161
  #document_storage_mongodb(splits)
162
  db = document_retrieval_mongodb(llm, prompt)
163
  completion = rag_chain(llm, prompt, db)
164
+ result = completion["result"]
165
  else:
166
+ result = llm_chain(llm, prompt)
167
  except Exception as e:
168
  completion = e
169
  raise gr.Error(e)
170
  finally:
171
  wandb_trace(prompt, completion, rag_option)
172
+ return result
173
 
174
  description = """<strong>Overview:</strong> Context-aware multimodal reasoning application using a <strong>large language model (LLM)</strong> with
175
  <strong>retrieval augmented generation (RAG)</strong>.