Learning Library

← Back to Library

Building AI-Powered Web Applications

Key Points

  • Building an AI‑powered web app is simpler than it sounds: the UI sends a question to a library or framework, which calls an LLM provider’s API with a prompt and returns the answer.
  • In basic prompting you embed both the user’s question and short instructions (e.g., “be helpful, don’t hallucinate”) directly in the prompt sent to the model.
  • Retrieval‑augmented generation (RAG) first converts the question into an embedding, uses a vector database to fetch the top‑N relevant documents, and then includes those documents plus the question in the prompt for a more informed response.
  • RAG requires you to preload your domain data into the vector store, and you typically implement it with an open‑source library or framework rather than a raw API call.
  • A newer pattern adds an AI “agent” layer that receives the question, plans and executes tool calls (via a framework), and then reflects on the results before producing the final answer.

Full Transcript

# Building AI-Powered Web Applications **Source:** [https://www.youtube.com/watch?v=xBSMBEowLcY](https://www.youtube.com/watch?v=xBSMBEowLcY) **Duration:** 00:04:29 ## Summary - Building an AI‑powered web app is simpler than it sounds: the UI sends a question to a library or framework, which calls an LLM provider’s API with a prompt and returns the answer. - In basic prompting you embed both the user’s question and short instructions (e.g., “be helpful, don’t hallucinate”) directly in the prompt sent to the model. - Retrieval‑augmented generation (RAG) first converts the question into an embedding, uses a vector database to fetch the top‑N relevant documents, and then includes those documents plus the question in the prompt for a more informed response. - RAG requires you to preload your domain data into the vector store, and you typically implement it with an open‑source library or framework rather than a raw API call. - A newer pattern adds an AI “agent” layer that receives the question, plans and executes tool calls (via a framework), and then reflects on the results before producing the final answer. ## Sections - [00:00:00](https://www.youtube.com/watch?v=xBSMBEowLcY&t=0s) **Building AI-Powered Web Applications** - The speaker outlines a simple pipeline—user interface → library/framework → LLM API—explaining prompt construction, basic querying, and the more advanced Retrieval‑Augmented Generation approach for creating AI‑assisted web apps. - [00:03:05](https://www.youtube.com/watch?v=xBSMBEowLcY&t=185s) **Agent-Based AI Application Patterns** - The segment outlines how AI agents plan, select tools, and execute tasks—contrasting basic prompting, Retrieval‑Augmented Generation, and single/multi‑agent frameworks for building applications. ## Full Transcript
0:00A lot of web developers are using AI applications such as chat assistance or code assistance. 0:05But building an application yourself can sound like a scary task, but it's not as complex as you think. 0:11In this video, I'm going to walk you through how you 0:13get from asking a question to retrieving an answer by a large language model. 0:19There are a couple of patterns in between. 0:21So let's break down what a typical application looks like. 0:25Often it starts with a user interface and a user interface. 0:28You can ask your questions. 0:30The user interface will then connect to a library or a framework. 0:35This library or framework could be open source or it could be a cloud product. 0:40This library or framework will interact with an API and is APIs typically provided by an LLM provider. 0:49As mentioned, there are a couple of better things I'd like to highlight. 0:52Usually people start by asking a question to a large language model. 0:57This question will be put inside of a prompt. 1:02Then this prompt will be sent to the large language model. 1:06And retrieve your final answer. 1:09So in your prompt, you would put both your question, but also a set of instructions for the LLM, 1:13such as be a helpful assistant or don't hallucinate or don't offend anyone. 1:19There's also more complex, better and next to basic prompting and this is what we call RAG or retrieval augmented generation. 1:27Again, it starts with a question. 1:30This time your question won't be directly put inside a prompt, but it will be turned into an embedding. 1:37This embedding will then be used by a vector database to find relevant context. 1:42So it is vector database 1:46is right here. 1:48And with this vector database, you can retrieve relevant context. 1:51We call this top N matches. 1:55These top N matches will be put inside a prompt. 1:58And this prompt will, of course, also contain your question. 2:02What the LLM sees is your prompts, which includes both the question and the top N matches. 2:10And based on this, it's going to return your final answer. 2:16With RAG is also a stage where you upload your data into the vector database. 2:21And this is important because otherwise the vector database won't be able to retrieve early and relevant context. 2:27If you look at basic prompting, this is typically done via an API or an SDK, which could be provided by LLM provider. 2:36If we look at RAG or retrieval augmented generation, you typically do this via a library or a framework. 2:48So the final pattern and you can implement as a web developer on building your application is AI agents with AI agents. 2:55You still have a question and a final answer, 2:58but it's time you have an agent in the middle that will help you to answer the question. 3:03So we start again with a question. 3:05This time your question will be sent to the agent. 3:09There are multiple patterns to implement agents, and typically you use a framework or a library to do this. 3:15The agent will typically plan based on your question and the available tools. 3:21It will act or react based on the tool calls. 3:25And finally, it's going to reflect and see if your answer is matching the question. 3:31For the plan the next stage it needs a set of tools. 3:35And these tools could be either APIs, databases or code, for example, to crawl the web. 3:42The LLM is going to use those tools to plan and execute. 3:46And finally, providing you with your final answer. 3:50Next to a single agent. 3:51You can also have a multi agent framework. 3:54This typically involves a supervisor agents, which is going to determine 3:58which agent should be called to answer your question. 4:01So in this video we looked at three different paterns to implement AI applications. 4:05The first one was basic prompting, where you use a prompt, which includes your question and a set of instructions. 4:11The second one was RAG, Retrieval Augmented Generation, 4:14where we use a vector database to make LLMs context aware of your data. 4:18And a final one was agents, where you use an agent that will 4:21look at a set of tools and based on the tools is going to answer your question. 4:25So with this, I hope you can start building your applications today.