Author: Editorial Team
-
Using Promises in JavaScript with .then()
Why We Need .then() Let’s start with a simple question: Once a promise is resolved, how do we access its value? You might think we can simply do something like: But that does not work. Why? Because: So how do we get the result? By using .then() Creating a Simple Promise Let’s start with a…
-
Understanding Promises in JavaScript
In this section, we are going to explore Promises in JavaScript — one of the most important concepts for handling asynchronous operations in a clean and readable way. Promises were introduced to solve many of the problems caused by callbacks, especially callback hell. Before we see how promises work in practice, we must clearly understand…
-
Handling Errors in Asynchronous Code
In this section, we are going to understand how errors are handled in asynchronous JavaScript code. So far, we have seen how callbacks work and how asynchronous execution is handled using the event loop. Now we’ll focus on what happens when something goes wrong inside an asynchronous operation and why traditional try…catch does not work…
-
Understanding Callbacks in JavaScript
What Is a Callback? A callback is simply a function that is passed as an argument to another function, and then invoked (called) inside that function. This concept is possible because functions in JavaScript are first-class citizens. This means: Because of this flexibility, JavaScript heavily relies on callbacks to control execution flow. Why Callbacks Exist…
-
How Asynchronous JavaScript Code Is Executed Behind the Scenes
When we write JavaScript code, it may look simple and linear on the surface, but a lot is happening behind the scenes. Every browser and runtime environment uses a JavaScript engine to execute code, and understanding how this engine works gives you a much deeper insight into asynchronous behavior, callbacks, and performance issues. Almost every…
-
Introduction to Linear Algebra for Machine Learning and Data Science
When you start learning machine learning or data science, you quickly realize that the core difficulty is not writing code, but representing and manipulating data that has many dimensions. A single data point is rarely just one number. It is usually a collection of related values: features, measurements, signals, or attributes. Linear algebra is the…
-
Vector Stores, Retrievers, and RAG in LangChain
Large Language Models do not “know” your data. If you want a model to answer questions based on external knowledge—documents, PDFs, websites, or internal data—you need a mechanism to retrieve relevant information and feed it to the model at inference time. This is where vector stores and retrievers come into play. 1. What Is a…
-
Managing Conversation History in LangChain Chatbots
In the previous tutorials, we built a chatbot that could remember conversational context using message history, session IDs, and prompt templates. At that stage, the chatbot worked correctly, but there was an important problem left unsolved. As conversations grow longer, the list of messages sent to the language model grows without bound. Every language model…
-
Using Prompt Templates with Chat History in LangChain Chatbots
In the previous tutorial, we learned how to build a chatbot that can remember conversational context using message history and session IDs. At that stage, we were directly passing lists of messages—human messages, AI messages, and system messages—into the language model. While that approach works, it is not how real-world chatbot systems are typically designed.…
-
How Chat History Is Maintained in a LangChain Chatbot
When building a chatbot with LangChain, it is easy to assume that the language model itself remembers previous conversations. In reality, this is not true. A language model is stateless; it does not retain any information between calls. What makes a chatbot appear conversational is the careful handling of chat history at the application level.…
