vincentmin commited on
Commit
4760881
·
1 Parent(s): 6e36ec1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -53,6 +53,8 @@ def get_data(lookback_days: float, user_query: str):
53
  query = f"cat:hep-th AND submittedDate:[{min_date.strftime('%Y%m%d')} TO {max_date.strftime('%Y%m%d')}]"
54
  loader = ArxivLoader(query=query, load_max_docs=LOAD_MAX_DOCS)
55
  docs = [process_document(doc) for doc in loader.load()]
 
 
56
  db = Chroma.from_documents(docs, embeddings)
57
  retriever = db.as_retriever()
58
  relevant_docs = retriever.get_relevant_documents(user_query)
 
53
  query = f"cat:hep-th AND submittedDate:[{min_date.strftime('%Y%m%d')} TO {max_date.strftime('%Y%m%d')}]"
54
  loader = ArxivLoader(query=query, load_max_docs=LOAD_MAX_DOCS)
55
  docs = [process_document(doc) for doc in loader.load()]
56
+ if len(docs) == 0:
57
+ return "Found no documents. Consider increasing the value for 'Articles from this many days in the past will be searched through.'."
58
  db = Chroma.from_documents(docs, embeddings)
59
  retriever = db.as_retriever()
60
  relevant_docs = retriever.get_relevant_documents(user_query)