Railway / modules /link_answer.py
NeerajRavi's picture
Upload 37 files
6b3769c verified
raw
history blame contribute delete
482 Bytes
# Link only module
from helpers.live_sources import retrieve_live_sources
from helpers.live_sources import retrieve_live_sources
def run(query, num_of_links):
sources = retrieve_live_sources(query, top_k=num_of_links)
if not sources:
return []
return [
{
"url": s["url"],
"authority": s.get("authority"),
"similarity": s.get("similarity")
}
for s in sources
if s.get("url")
]