Spaces:
Running
Running
import os | |
import pandas as pd | |
from get_keywords import get_keywords | |
from get_articles import save_solr_articles_full | |
from rerank import langchain_rerank_answer, langchain_with_sources, crossencoder_rerank_answer, \ | |
crossencoder_rerank_sentencewise, crossencoder_rerank_sentencewise_articles, no_rerank | |
#from feed_to_llm import feed_articles_to_gpt_with_links | |
from feed_to_llm_v2 import feed_articles_to_gpt_with_links | |
def get_response(question, rerank_type="crossencoder", llm_type="chat"): | |
csv_path = save_solr_articles_full(question, keyword_type="rake") | |
reranked_out = crossencoder_rerank_answer(csv_path, question) | |
return feed_articles_to_gpt_with_links(reranked_out, question) | |
# save_path = save_solr_articles_full(question) | |
# information = crossencoder_rerank_answer(save_path, question) | |
# response, links, titles = feed_articles_to_gpt_with_links(information, question) | |
# | |
# return response, links, titles | |
if __name__ == "__main__": | |
question = "How is United States fighting against tobacco addiction?" | |
rerank_type = "crossencoder" | |
llm_type = "chat" | |
response, links, titles, domains = get_response(question, rerank_type, llm_type) | |
print(response) | |
print(links) | |
print(titles) | |
print(domains) |