Shreyas094
commited on
Commit
•
0d492ce
1
Parent(s):
8bba703
Update app.py
Browse files
app.py
CHANGED
@@ -627,19 +627,19 @@ def search_and_scrape(query, chat_history, num_results=5, max_chars=3000, time_r
|
|
627 |
"title": doc['title'],
|
628 |
"url": doc['url'],
|
629 |
"summary": doc['summary'],
|
630 |
-
"
|
631 |
} for doc in reranked_docs[:num_results]
|
632 |
],
|
633 |
"similar_documents": [
|
634 |
{
|
635 |
"title": doc['title'],
|
636 |
"url": doc['url'],
|
637 |
-
"content": doc
|
638 |
} for doc in similar_docs
|
639 |
]
|
640 |
}
|
641 |
|
642 |
-
# Step 6: LLM Summarization
|
643 |
llm_summary = llm_summarize(json.dumps(llm_input), model, temperature=llm_temperature)
|
644 |
|
645 |
return llm_summary
|
|
|
627 |
"title": doc['title'],
|
628 |
"url": doc['url'],
|
629 |
"summary": doc['summary'],
|
630 |
+
"content": doc.get('content', '') # Use get() with a default value
|
631 |
} for doc in reranked_docs[:num_results]
|
632 |
],
|
633 |
"similar_documents": [
|
634 |
{
|
635 |
"title": doc['title'],
|
636 |
"url": doc['url'],
|
637 |
+
"content": doc.get('content', '')[:500] # Use get() with a default value and limit content for brevity
|
638 |
} for doc in similar_docs
|
639 |
]
|
640 |
}
|
641 |
|
642 |
+
# Step 6: LLM Summarization
|
643 |
llm_summary = llm_summarize(json.dumps(llm_input), model, temperature=llm_temperature)
|
644 |
|
645 |
return llm_summary
|