In this article, we will use retrieval augmented generation (RAG) with one of the most common large language models (LLMs) to see how it can improve LLM contextIn this article, we will use retrieval augmented generation (RAG) with one of the most common large language models (LLMs) to see how it can improve LLM context

Boosting LLM Responses with Retrieval Augmented Generation

In this article, we will use retrieval augmented generation (RAG) with one of the most common large language models (LLMs) to see how it can improve LLM context and response quality. Firstly, we will dive into what is retrieval augmented generation. As the name suggests in RAG, the LLM will retrieve data from external sources and use that data as input to the LLM prompt to augment the response quality.

According to AWS documentation, “Retrieval-Augmented Generation (RAG) is the process of optimizing the output of a large language model, so it references an authoritative knowledge base outside of its training data sources before generating a response” (What Is RAG? – Retrieval-Augmented Generation AI Explained, 2025). In simpler words, LLM will get more data from external sources as that will allow the LLM to increase its response quality.

Effect of context on LLM response quality

Context is the data available to the LLM when answering the user’s question. The most common context provided by a user is the chat prompt. A chat prompt encompasses the user’s current question along with any preceding prompts from the existing conversation. The size of a regular LLM prompt might be a single word to a single sentence. According to a pilot study by the municipality of Amsterdam, the median prompt length was only 10 words while the average length of user prompt was 70 words (Gornishka, 2024). We will explore the differences in the response quality as we increase the context size.

Let’s assume, for the purpose of this exercise, that we are tourists visiting a new city, such as Seattle. We will ask for a three day itinerary from a LLM using two different sized prompts. Firstly, we just ask a single one sentence question to Gemini 3:

“Please tell me what places I can visit in 3 days in Seattle”

As a response, we received suggestions for major tourist attractions like Space Needle, Chihuly Garden, Pioneer Square, MoPOP, Discovery Park etc. The LLM split these activities across three different days and it is a decent response. The current itinerary presents some structural problems. The suggestion to visit Kerry Park on day 2 is inefficient. It would be more practical to combine this with the Ballard visit on day 3, as the two locations are geographically close. The schedule for day 3 appears too ambitious and could lead to an overly pressured or hectic experience.

Now, we will try adding a bit more context to the LLM by increasing the prompt size close to 80 words. Although a 80 word prompt might sound like a fairly big question with enough context it still has room for improvement. We will pass the following prompt to Gemini 3:

“Hey, I will be travelling to Seattle in March 2026, can you provide me with examples of tourist places that I can visit? I will be in Seattle for 3 days from Saturday to Monday and I will not have a car to travel. I do not know where I will be staying but I will prefer to stay downtown. I would like to see the cherry blossoms so please include that in my 3 day itinerary.”

This is a 78 word prompt and we would consider this as a fairly detailed prompt for an average user. Due to its length, the full LLM response cannot be included in this article; however, the following are some important observations drawn from it. The LLM included locations that are close by on the same day. It included directions for traveling to the University of Washington campus for cherry blossoms via Link Light Rail Line 1 which is something our user asked for.

The LLM recommended placing the University of Washington on Sunday’s schedule to encounter lessened foot traffic across the college campus. It provided instructions for travel back from the college campus and provided directions for travel to Space Needle via the Seattle Center Monorail. It also kept the day 3 itinerary relaxed and suggested applying for a transit card. Overall, we can notice that this is a much better LLM response and the user will get to enjoy cherry blossoms.

Adding Retrieval Augmented Generation

We can further improve the LLM’s response by providing a few more key details required for a better travel itinerary. We are not providing details like our flight times, and the location of our stay. This prevents the LLM from properly taking into account the travel times needed to travel to and from the airport. Providing this important context will also prevent the LLM from overfilling the itinerary with activities on travel days.

To provide the LLM with this information we are going to create a spreadsheet that will contain information about the travel. This spreadsheet will act as the authoritative knowledge base that the LLM can then use to finally employ RAG to improve response quality. You might ask why we are using a spreadsheet and we will go over some more advanced external data sources later in the article. For the purpose of this article, a spreadsheet will be fine to showcase the improved LLM response. The spreadsheet contains flight details and hotel stay information. I will list the data from the sheets in a table below.

Flight DateSource CityDestination CityDeparture TimeArrival TimeFlight Number
3/7/2026San DiegoSeattle07:2010:36DL2530
3/10/2026SeattleSan Diego07:2010:16DL2508
Hotel NameAddressCityStateZip CodeCheck In TimeCheck Out Time
Hotel 1000, LXR Hotels & Resorts1000 1st AveSeattleWA9801416:0011:00

The data in the tables above was extracted from a possible travel itinerary after searching Expedia. The flight number and arrival times in the spreadsheet are accurate as of 12/28/2025. Along with uploading the file to Gemini 3 we also appended “Use the spreadsheet passed in to extract my travel details to plan my itinerary” to the end of the prompt.

After submitting the new prompt to the LLM, there were a few key changes that were made. Gemini first extracted the travel details for the flight and calculated the duration of the stay. It reviewed the hotel location in downtown and pointed out to the user that the hotel is in a prime Downtown location, near Pioneer Square and the Waterfront. The LLM successfully calculated the precise travel cost from Seattle airport and provided a recommendation for the appropriate light rail station.

Day 1 itinerary was updated by the LLM to account for travel time from the airport and a few locations were removed from the itinerary. It kept the cherry blossoms on Sunday as it was a requirement from the user and there was no deviation from the response of the previous prompt. Specific instructions were provided for travel from downtown Seattle to Bainbridge island. Finally, the all new Day 4 morning travel instructions were provided to get to the airport on time on Tuesday. Given the early Tuesday morning flight and the 5:00 AM start time for light rail service, the LLM suggested the user schedule an Uber or Lyft ride.

Using Retrieval Augmented Generation with common LLMs

As we can see there are some significant advantages to using Retrieval Augmented Generation with LLMs. In the example above, we used a spreadsheet to pass external relevant data but that is usually not a scalable solution. We used Gemini in this exercise to generate the itinerary. Upon doing some research it seems like there is currently not a direct integration between Gemini and Expedia.

Gemini does not currently support Expedia as an external data source; however, a third-party Expedia application is available within ChatGPT. ChatGPT refers to these third-party integrations as “apps.” Expedia app can be used to bring travel data natively to the ChatGPT context. Gemini has native support for integrating data from Google Workspace, Github, YouTube Music, and others.

The LLM you choose will have an impact on the ease of availability of external data sources but I hope with this article I was able to showcase the benefit of utilizing RAG in your LLM prompts. We were able to notice a more detailed response based on the user’s travel itinerary. RAG’s utility extends far beyond applications like travel itinerary generation, enabling users to integrate data from diverse sources to address a variety of problems.

References

What is RAG? – Retrieval-Augmented Generation AI Explained. (n.d.). AWS. Retrieved December 22, 2025, from https://aws.amazon.com/what-is/retrieval-augmented-generation/

Gornishka, I. (2024, June). Analysis of prompts from a Generative AI pilot. Openresearch Amsterdam. https://openresearch.amsterdam/en/page/109535/analysis-of-prompts-from-a-generative-ai-pilot

Market Opportunity
Large Language Model Logo
Large Language Model Price(LLM)
$0.0003163
$0.0003163$0.0003163
+2.89%
USD
Large Language Model (LLM) Live Price Chart
Disclaimer: The articles reposted on this site are sourced from public platforms and are provided for informational purposes only. They do not necessarily reflect the views of MEXC. All rights remain with the original authors. If you believe any content infringes on third-party rights, please contact service@support.mexc.com for removal. MEXC makes no guarantees regarding the accuracy, completeness, or timeliness of the content and is not responsible for any actions taken based on the information provided. The content does not constitute financial, legal, or other professional advice, nor should it be considered a recommendation or endorsement by MEXC.

You May Also Like

Coinbase verwacht versnelde crypto-adoptie in 2026 door ETF’s en stablecoins

Coinbase verwacht versnelde crypto-adoptie in 2026 door ETF’s en stablecoins

Volgens David Duong, hoofd investeringsonderzoek bij Coinbase gaan ETF’s, stablecoins, tokenisatie en regelgeving een centrale rol spelen in het nieuwe jaar. Deze
Share
Coinstats2026/01/02 02:16
a16z Outlines 17 Crypto Priorities for 2026, From Stablecoin Rails to Privacy

a16z Outlines 17 Crypto Priorities for 2026, From Stablecoin Rails to Privacy

Andreessen Horowitz’s a16z Crypto lays out 17 priorities for 2026, from stablecoin rails and RWA tokenization to AI impacts and the need for legal clarity.
Share
Blockchainreporter2026/01/02 03:00
Polygon Tops RWA Rankings With $1.1B in Tokenized Assets

Polygon Tops RWA Rankings With $1.1B in Tokenized Assets

The post Polygon Tops RWA Rankings With $1.1B in Tokenized Assets appeared on BitcoinEthereumNews.com. Key Notes A new report from Dune and RWA.xyz highlights Polygon’s role in the growing RWA sector. Polygon PoS currently holds $1.13 billion in RWA Total Value Locked (TVL) across 269 assets. The network holds a 62% market share of tokenized global bonds, driven by European money market funds. The Polygon POL $0.25 24h volatility: 1.4% Market cap: $2.64 B Vol. 24h: $106.17 M network is securing a significant position in the rapidly growing tokenization space, now holding over $1.13 billion in total value locked (TVL) from Real World Assets (RWAs). This development comes as the network continues to evolve, recently deploying its major “Rio” upgrade on the Amoy testnet to enhance future scaling capabilities. This information comes from a new joint report on the state of the RWA market published on Sept. 17 by blockchain analytics firm Dune and data platform RWA.xyz. The focus on RWAs is intensifying across the industry, coinciding with events like the ongoing Real-World Asset Summit in New York. Sandeep Nailwal, CEO of the Polygon Foundation, highlighted the findings via a post on X, noting that the TVL is spread across 269 assets and 2,900 holders on the Polygon PoS chain. The Dune and https://t.co/W6WSFlHoQF report on RWA is out and it shows that RWA is happening on Polygon. Here are a few highlights: – Leading in Global Bonds: Polygon holds 62% share of tokenized global bonds (driven by Spiko’s euro MMF and Cashlink euro issues) – Spiko U.S.… — Sandeep | CEO, Polygon Foundation (※,※) (@sandeepnailwal) September 17, 2025 Key Trends From the 2025 RWA Report The joint publication, titled “RWA REPORT 2025,” offers a comprehensive look into the tokenized asset landscape, which it states has grown 224% since the start of 2024. The report identifies several key trends driving this expansion. According to…
Share
BitcoinEthereumNews2025/09/18 00:40