<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tim Ho on Medium]]></title>
        <description><![CDATA[Stories by Tim Ho on Medium]]></description>
        <link>https://medium.com/@timho102003?source=rss-fd305a50c572------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*py-PRGX9jJVDJbRJpXvW0g.jpeg</url>
            <title>Stories by Tim Ho on Medium</title>
            <link>https://medium.com/@timho102003?source=rss-fd305a50c572------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:04:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@timho102003/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[NewsGPT(Neotice): Summarize news articles with LlamaIndex — Hackathon winning app]]></title>
            <link>https://medium.com/llamaindex-blog/newsgpt-neotice-summarize-news-articles-with-llamaindex-hackathon-winning-app-9d7c8bcf9f11?source=rss-fd305a50c572------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d7c8bcf9f11</guid>
            <dc:creator><![CDATA[Tim Ho]]></dc:creator>
            <pubDate>Fri, 27 Oct 2023 19:57:55 GMT</pubDate>
            <atom:updated>2025-10-14T06:13:02.314Z</atom:updated>
            <content:encoded><![CDATA[<h3>NewsGPT(Neotice): Summarize news articles with LlamaIndex — Hackathon winning app</h3><p>We’re excited to share with you the thought process and solution design of <a href="https://newsgpt-clickbait-buster.streamlit.app/"><strong>NewsGPT</strong></a><strong> (</strong><a href="https://www.neotice.app/"><strong>Neotice</strong></a><strong>) — Clickbait Buster</strong>, a Streamlit LLM hackathon-winning app powered by LlamaIndex, Streamlit, and Qdrant. In this article, we’ll define the problem we’re trying to solve and discuss how we approached it. Lastly, we offer a workaround to enable LlamaIndex streaming on Streamlit Chat Bot and the all the code can be found <a href="https://github.com/timho102003/NewsGPT.git">here</a>. We hope you’ll find our insights helpful and informative.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EdzdTUl-DlOVOEWbQJkWbw.png" /></figure><h3>Introduction</h3><h4><strong>Problem Statement</strong></h4><p>It’s evident that people’s habits of consuming information have changed over time. Previously, we read lengthy articles content and watched long videos, such as newspapers and YouTube videos. However, we currently prefer reading titles and consuming short-form content, such as TikTok and YouTube shorts. Although this shift has made it easier to get more information in less time, it has also led to clickbait headlines that often contain incorrect information.</p><p>When we started developing NewsGPT, our primary focus was to solve the above-stated pain points and provide a solution that 1) <strong>provides accurate information</strong> and 2) <strong>saves time for users</strong>.</p><h4>Neotice</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctpYJcTm4OVT6jaAYXTswg.png" /></figure><p>We are excited to announce that the beta version of the <a href="https://www.neotice.app/"><strong>Neotice</strong></a> app, which is the production version of NewsGPT, is now available for users to try out! We are grateful to the Streamlit Hackathon for showcasing our prototype and philosophy. With the help of this platform, we are confident that our app will revolutionize the way people consume news.</p><h4><strong>Why NewsGPT Stands Out</strong></h4><p>NewsGPT has four main components: Reliable News Sources, Tailored News Recommendations, Efficient Information Retrieval, and Time Saver.</p><p>✅ <strong>Reliable News Sources:</strong></p><ul><li>We’ve established a dynamic data pipeline designed to ingest daily news, ensuring our information is up-to-date and relevant.</li><li>Sophisticated <strong>Named-Entity Recognition, Text Embedding with OpenAI API, </strong>and <strong>asynchronous article embedding processes</strong> are incorporated. This data is systematically stored in the <a href="https://www.linkedin.com/company/qdrant/">Qdrant</a>Vector Database, promoting accuracy and efficiency.</li></ul><p>✅ <strong>Tailored News Recommendations:</strong></p><ul><li>Our system does more than just present news; it learns from you. By analyzing your reading habits, we leverage article embeddings to curate a personal news feed tailored to your interests.</li><li>A versatile <strong>search bar</strong> is always at your disposal, letting users explore any news topics that capture their interest.</li></ul><p>✅ <strong>Efficient Information Retrieval:</strong></p><ul><li>With just a single click on an article of interest, NewsGPT gets to work. It collates <strong>similar news from multiple sources (3–5)</strong> and activates a Streamlit chatbot.</li><li>Your engagement begins immediately: the first query is autonomously forwarded to our chatbot to fetch a concise news summary.</li><li>For ease of user experience, we display <strong>predefined prompts</strong> as clickable buttons. This means users can receive information without the need for manual input.</li><li>Curiosity welcomed: any questions users may have about the news article will be addressed as long as the answers are detailed within the source articles.</li></ul><p>✅ <strong>Time-Saving Reminder &amp; Category Distribution Chart:</strong></p><ul><li>To keep you informed, our sidebar displays the time saved using NewsGPT and visually represents news category distribution.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Ha5Ylm_ZP1QgrXarx4uWOg.gif" /></figure><h3>Delving Deep into Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xu29Ap1pz30Vo6OnMyi27Q.jpeg" /></figure><h4>Data Pipeline</h4><p>We start with a reliable and sustainable data pipeline to support the users to get fresh news with two powerful libraries, <strong>pygooglenews,</strong> and <strong>newspaper3k.</strong></p><pre>pip install pygooglenews --upgrade<br>pip install newspaper3k</pre><p>By utilizing <strong>Spark batch processing</strong>, we efficiently process data with <strong>NER(Named-Entity Recognition)</strong> and create embeddings via <strong>OpenAI API (Ada model)</strong>. After the preprocessing of the data, we collect the metadata, including keywords, NER results, summary, body, title, author, and so on, in the payload and push the payload with embedding to the Qdrant Vector Database.</p><p>We will skip the part on how to create embeddings with the OpenAI Ada model, as there are many existing tutorials available. To perform Named Entity Recognition, we utilize the <strong>dslim/bert-base-NER</strong> model from HuggingFace.</p><pre>from transformers import pipeline<br>from transformers import AutoTokenizer, AutoModelForTokenClassification<br>tokenizer = AutoTokenizer.from_pretrained(&quot;dslim/bert-base-NER&quot;)<br>model = AutoModelForTokenClassification.from_pretrained(&quot;dslim/bert-base-NER&quot;)<br>nlp = pipeline(&quot;ner&quot;, model=model, tokenizer=tokenizer, batch_size=batch_size)<br>ner_results = nlp(texts)</pre><h4>Personalization</h4><p>When accessing NewsGPT, we have two options: we can either create a new account or use a guest login to test the service. It should be noted, however, that using the guest login will not provide personalization. If we choose to sign up, we will be asked about our preferred news categories, which will help the service make initial recommendations during the cold start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ljOPZB6W0TebNYnYUUVWLA.jpeg" /><figcaption>Recommendation Pipeline for Personalization</figcaption></figure><p>After users sign up and log in, we query the preferences and activities from Google Firebase, if any; otherwise, use the favorite categories for recommendation cold start. If the activities and preferences are available, we will call the recommendation API hosted on AWS Lambda and generate personalized articles for the users. The activities related to the user reading history. Users can indicate their preference for articles by clicking thumbs-up or down buttons on the article page. Some of the recommendation logic can be found in the <a href="https://github.com/timho102003/NewsGPT/blob/main/utils.py#L174">code</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RN9PNhTaRpPyPNygsYVp0A.png" /></figure><p>Besides the personalized feeds, users can also choose different categories or search for specific topics using the search bar.</p><h4>Chat with Article Powered by LlamaIndex</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3CwNbw-kgKSzbtOX5TVK3w.png" /><figcaption>LlamaIndex Pipeline</figcaption></figure><p>Unlike other news aggregator apps, NewsGPT offers a unique service by providing users with a summary and discrepancy key takeaway of a topic from various news sources. This feature not only saves users time by eliminating the need to read multiple articles but also helps identify which information can be trusted by comparing discrepancies.</p><p>Under the hood, when the user clicks on the “chat with article” button, the system first uses a search API hosted on AWS Lambda to retrieve related articles from multiple sources. It then employs the <a href="https://www.llamaindex.ai/"><strong>LlamaIndex</strong></a> library to build a vector store and a query engine, which are integrated with the <strong>Streamlit</strong> chat component to form a Retrieval-Augmented Generation (<strong>RAG</strong>) application.</p><p>The retrieval mechanism of this RAG system was inspired by [1], which introduced a progressive refinement strategy through layered analysis. Drawing from this analogy, the RAG retrieval pipeline adopts a similar hierarchical approach — first performing coarse retrieval to gather broad context, then refining results through distillation-based retrieval stages to ensure precision and factual relevance. This layered retrieval mirrors the cascading design of Mr. Ho’s framework, enhancing both the accuracy and trustworthiness of responses in LLM-based RAG systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*apcvU2TdVLWjHgoGygOMeA.png" /></figure><h4>Streaming Output with LlamaIndex and Streamlit</h4><p>Thanks to the powerful library, S<a href="https://extras.streamlit.app/">treamlit-Extras</a>, which provides additional functionality not officially supported. To enhance the user experience and make it more like chatting with ChatGPT, we use the <a href="https://arnaudmiribel.github.io/streamlit-extras/extras/streaming_write/"><strong>streaming_write</strong></a> functions from the Streamlit-Extras library. Additionally, we set <strong>streaming=True</strong> for the <strong>query_engine</strong> to ensure a smoother experience. Let’s take a look at the code.</p><pre>pip install streamlit-extras</pre><p>To begin with, we set up the <strong>service_context</strong>.</p><pre>from llama_index import ServiceContext<br><br>st.session_state[&quot;service_context&quot;] = ServiceContext.from_defaults(<br>            llm=OpenAI(<br>                model=&quot;gpt-3.5-turbo&quot;,<br>                temperature=0.2,<br>                chunk_size=1024,<br>                chunk_overlap=100,<br>                system_prompt=&quot;As an expert current affairs commentator and analyst,\<br>                               your task is to summarize the articles and answer the questions from the user related to the news articles&quot;,<br>            ),<br>            chunk_size=256, <br>            chunk_overlap=20<br>        )</pre><p>Next, we create a text splitter using <strong>TokenTextSplitter</strong> and a node parser using <strong>SimpleNodeParser</strong> to parse multiple articles.</p><pre>from llama_index.text_splitter import TokenTextSplitter<br>from llama_index.node_parser import SimpleNodeParser<br><br>text_splitter = TokenTextSplitter(separator=&quot; &quot;, chunk_size=256, chunk_overlap=20)<br>#create node parser to parse nodes from document<br>node_parser = SimpleNodeParser(text_splitter=text_splitter)<br>nodes = node_parser.get_nodes_from_documents(documents)</pre><p>In the third step, we create an index using <strong>VectorStoreIndex</strong>. To enable streaming capability, ensure to set <strong>streaming=True</strong> while setting up the <strong>query_engine</strong>.</p><pre>from llama_index import VectorStoreIndex<br><br>index = VectorStoreIndex(<br>        nodes=nodes,<br>        service_context=st.session_state[&quot;service_context&quot;]<br>    )<br>st.session_state[&quot;chat_engine&quot;] = index.as_query_engine(streaming=True)</pre><p>To add streaming capability to Streamlit chat components, we took inspiration from this <a href="https://arnaudmiribel.github.io/streamlit-extras/extras/streaming_write/">code</a>. Instead of using <strong>st.write() </strong>from the regular chat implementation, we replaced it with the <strong>write</strong> function from <strong>streaming_write</strong>.</p><pre>response = st.session_state[&quot;chat_engine&quot;].query(prompt)<br>def stream_example():<br>    for word in response.response_gen:<br>        yield word<br>write(stream_example)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*OALHjBauROdpVTCC-IYUuA.gif" /><figcaption>Streaming Demo</figcaption></figure><h4>Predefined Prompts</h4><p>Three different prompts are predefined in the article chat page, allowing users to select from a drop-down menu to ask questions without typing. The prompts are 5W1H, Similar Viewpoints, and Discrepancy Viewpoints.</p><pre>prompt_content = {<br>    &quot;5W1H&quot;: &#39;Summarize the content details in the &quot;5W1H&quot; approach (Who, What, When, Where, Why, and How) in bullet points&#39;,<br>    &quot;Similar Viewpoints&quot;: &quot;Compare between the articles and provide the similar viewpoints in bullet points&quot;,<br>    &quot;Discrepency Viewpoints&quot;: &quot;Compare between the articles and provide the discrepency viewpoints in bullet points&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vu0eKcG1gwe4n9nLXgdrrw.png" /></figure><h3>What’s Next</h3><p>Huge thanks to LlamaIndex and Streamlit for generously providing a massive platform that allows more people to gain awareness of the organic news digest and save valuable time through <a href="https://newsgpt-clickbait-buster.streamlit.app/"><strong>NewsGPT</strong></a>. If you enjoyed reading the article and agree with our concept, please do not hesitate to leave a clap for the article and join <a href="https://www.neotice.app/"><strong>Neotice</strong></a>, the production app of NewsGPT, to support us. We are confident in our mission and look forward to having you on board with us. Thank you!</p><p>You can also connect us on LinkedIn:<strong> </strong><a href="http://www.linkedin.com/in/kangchi-ho"><strong>Kang-Chi Ho</strong></a><strong>, </strong><a href="https://www.linkedin.com/in/chien-an-wang-6054b9110/"><strong>Jian-An Wang</strong></a></p><p>🎉 Click Here to Join Neotice 👉 <a href="https://www.neotice.app/"><strong>Neotice</strong></a></p><p>[1] <a href="https://ieeexplore.ieee.org/abstract/document/8297179">https://ieeexplore.ieee.org/abstract/document/8297179</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d7c8bcf9f11" width="1" height="1" alt=""><hr><p><a href="https://medium.com/llamaindex-blog/newsgpt-neotice-summarize-news-articles-with-llamaindex-hackathon-winning-app-9d7c8bcf9f11">NewsGPT(Neotice): Summarize news articles with LlamaIndex — Hackathon winning app</a> was originally published in <a href="https://medium.com/llamaindex-blog">LlamaIndex Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>