Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use llama_index to summarize information from multiple articles #753

Closed
madawei2699 opened this issue Mar 16, 2023 · 2 comments
Closed
Labels

Comments

@madawei2699
Copy link

When I use llama_index to summarize information from multiple articles, my code is like this:

def get_answer_from_llama_web(message, urls, logger):
    logger.info('=====> Use llama with chatGPT to answer!')
    combained_urls = get_urls(urls)
    logger.info(combained_urls)
    documents = get_documents_from_urls(combained_urls)
    llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo"))
    logger.info(documents)
    index = GPTSimpleVectorIndex(documents, text_qa_template=QUESTION_ANSWER_PROMPT)
    return index.query(message, llm_predictor=llm_predictor)

This code will fetch multiple articles from the URLs and use the GPTSimpleVectorIndex to summarize information. What I want is to summarize the information by article. But when given the prompt is:

For the following articles to write an article recommendation email out, my requirements.
1. write a separate summary paragraph for each article, sorting out the most valuable parts

https://mp.weixin.qq.com/s/JFbdL0oUAlZU-os6CerSog

https://mp.weixin.qq.com/s/SZsW-SlkWdQq-aAyrCikDw

https://mp.weixin.qq.com/s/Wx5q-rEwG4sROvnewGxWrw

But the answer is totally wrong which is looks nothing to do with the content of the article. My question is what index is suitable to do this work?

@iraadit
Copy link

iraadit commented Mar 16, 2023

I would also be interested.
And also by how to compare some elements between the different articles.

@Disiok Disiok added the discord label Mar 16, 2023
@Disiok
Copy link
Collaborator

Disiok commented Mar 16, 2023

Hey @madawei2699 @iraadit, if you want to summarize articles, using a GPTListIndex would be more suitable.
See https://gpt-index.readthedocs.io/en/latest/guides/use_cases.html for more details.

Going to close this since it's not an issue. Please join the discord community (https://discord.gg/dGcwcsnxhU) for better support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants