Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -201,7 +201,8 @@ def get_file_path(file):
|
|
| 201 |
else:
|
| 202 |
return None
|
| 203 |
|
| 204 |
-
# Original functionalities (Tabs 1-4) functions
|
|
|
|
| 205 |
def rag_llama_qa(query):
|
| 206 |
output = RetrievalQA.from_chain_type(
|
| 207 |
llm=llm_local,
|
|
@@ -214,9 +215,12 @@ def rag_llama_qa(query):
|
|
| 214 |
idx = lower_text.find("answer:")
|
| 215 |
return output[idx + len("answer:"):].strip() if idx != -1 else output
|
| 216 |
|
|
|
|
| 217 |
def rag_gpt4_qa(query):
|
| 218 |
return qa_gpt.run(query)
|
| 219 |
|
|
|
|
|
|
|
| 220 |
def upload_and_chat(file, query):
|
| 221 |
file_path = get_file_path(file)
|
| 222 |
if file_path is None:
|
|
@@ -262,6 +266,7 @@ Refine the summary based on the new content below. Add or update information onl
|
|
| 262 |
"""
|
| 263 |
)
|
| 264 |
|
|
|
|
| 265 |
def document_summarize(file):
|
| 266 |
file_path = get_file_path(file)
|
| 267 |
if file_path is None:
|
|
@@ -990,6 +995,7 @@ crew = Crew(
|
|
| 990 |
llm=crew_llm
|
| 991 |
)
|
| 992 |
|
|
|
|
| 993 |
def multi_agent_chat_advanced(query: str, file=None) -> str:
|
| 994 |
global session_retriever, session_qa_chain, csv_dataframe
|
| 995 |
|
|
|
|
| 201 |
else:
|
| 202 |
return None
|
| 203 |
|
| 204 |
+
# Original functionalities (Tabs 1-4) functions
|
| 205 |
+
@traceable(name="Biden LLaMA QA")
|
| 206 |
def rag_llama_qa(query):
|
| 207 |
output = RetrievalQA.from_chain_type(
|
| 208 |
llm=llm_local,
|
|
|
|
| 215 |
idx = lower_text.find("answer:")
|
| 216 |
return output[idx + len("answer:"):].strip() if idx != -1 else output
|
| 217 |
|
| 218 |
+
@traceable(name="GPT-4 Document QA")
|
| 219 |
def rag_gpt4_qa(query):
|
| 220 |
return qa_gpt.run(query)
|
| 221 |
|
| 222 |
+
|
| 223 |
+
@traceable(name="Upload Document QA")
|
| 224 |
def upload_and_chat(file, query):
|
| 225 |
file_path = get_file_path(file)
|
| 226 |
if file_path is None:
|
|
|
|
| 266 |
"""
|
| 267 |
)
|
| 268 |
|
| 269 |
+
@traceable(name="Document Summarise")
|
| 270 |
def document_summarize(file):
|
| 271 |
file_path = get_file_path(file)
|
| 272 |
if file_path is None:
|
|
|
|
| 995 |
llm=crew_llm
|
| 996 |
)
|
| 997 |
|
| 998 |
+
@traceable(name="Multi-Agent Chat")
|
| 999 |
def multi_agent_chat_advanced(query: str, file=None) -> str:
|
| 1000 |
global session_retriever, session_qa_chain, csv_dataframe
|
| 1001 |
|