<?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 Deeksha on Medium]]></title>
        <description><![CDATA[Stories by Deeksha on Medium]]></description>
        <link>https://medium.com/@deekshad1502?source=rss-87cdab9b5d48------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*i3BdZg6rbUFQEBcG2szyPw.jpeg</url>
            <title>Stories by Deeksha on Medium</title>
            <link>https://medium.com/@deekshad1502?source=rss-87cdab9b5d48------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 21:39:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@deekshad1502/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[What Really Happens When You Send a Prompt to an LLM?]]></title>
            <link>https://medium.com/@deekshad1502/what-really-happens-when-you-send-a-prompt-to-an-llm-33002fcf41d5?source=rss-87cdab9b5d48------2</link>
            <guid isPermaLink="false">https://medium.com/p/33002fcf41d5</guid>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Deeksha]]></dc:creator>
            <pubDate>Mon, 21 Sep 2026 18:07:33 GMT</pubDate>
            <atom:updated>2026-10-16T18:38:37.982Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered what happens behind the scenes when you type a prompt into an LLM and receive a meaningful response within seconds? How does a machine understand your words, connect them with context, and generate a response that feels conversational?</p><p>This article explores how language evolved from simple word representations to modern Transformer-based models, and how these models generate responses one token at a time.</p><h3>1. From Bag-of-Words to Word Embeddings</h3><p>Before Transformers, one of the simplest ways to represent language numerically was <strong>Bag-of-Words</strong>.</p><p>The idea was straightforward: count which words appear in a sentence and ignore their order.</p><p>For example:</p><blockquote><em>“The cat sat on the mat.”</em></blockquote><p>The model would represent the sentence using the words it contains, but it would not understand the order in which those words appear.</p><p>Although Bag-of-Words was a useful starting point, it lost important information about language, including word order, context, and meaning.</p><figure><img alt="Bag of Words" src="https://cdn-images-1.medium.com/proxy/1*Ka2Y8E4yUXSbLCPpMNKfMw.png" /></figure><p>Later, techniques such as <strong>Word2Vec</strong> introduced a better way to represent words. Instead of representing words only as independent counts, Word2Vec learned numerical vectors based on the contexts in which words appeared. Words used in similar contexts developed similar representations.</p><p>For example:</p><ul><li>Cat and kitten would have similar representations.</li><li>Dog might also be relatively close.</li><li>Car would likely be farther away.</li></ul><p>However, these word representations were generally static.</p><p>The word <strong>“bank”</strong> would have the same initial representation in both:</p><ul><li>“I sat near the river bank.”</li><li>“I deposited money in the bank.”</li></ul><p>The representation did not change based on the surrounding sentence.</p><figure><img alt="Word Embeddings" src="https://cdn-images-1.medium.com/proxy/1*rRdvV7-Me9gzqH8HumDQqg.png" /></figure><p>Contextual embeddings existed before Transformers, but <strong>Transformers took this idea much further</strong>, making contextual representations more powerful and scalable.</p><p>In decoder-only models, the representation of a word can change depending on the words that appear before it.</p><h3>2. Step One: Tokenization</h3><p>When you enter a prompt, the model does not directly receive the text as complete sentences or words.</p><p>The first step is <strong>tokenization</strong>.</p><p>A tokenizer breaks text into smaller units called tokens. Depending on the tokenizer, these units may be:</p><ul><li>Complete words</li><li>Subwords</li><li>Individual characters</li><li>Punctuation marks</li></ul><p>For example, the word:</p><pre>unbelievable</pre><p>might be split into pieces such as:</p><pre>un + believ + able</pre><p>The exact split depends on the tokenizer being used.</p><p>Each token is then mapped to an integer called a <strong>token ID</strong>.</p><p>For example:</p><pre>&quot;hello&quot; → 4821</pre><p>The number itself has no inherent meaning. It is simply an identifier that helps the model look up the representation associated with that token.</p><p>This is also why language model APIs commonly measure usage in tokens rather than words.</p><h3>3. Step Two: Embeddings and Positional Information</h3><p>A token ID is only an integer label. The model needs a richer numerical representation to process it.</p><p>To achieve this, the model uses an <strong>embedding table</strong>.</p><p>The embedding table contains a vector for every token in the vocabulary. When the model receives a token ID, it retrieves the corresponding vector.</p><p>Instead of representing a token using one number:</p><pre>4821</pre><p>the model retrieves a vector containing hundreds or thousands of numerical values.</p><p>These values are learned during training.</p><p>Tokens that appear in similar contexts may develop similar representations. However, the representation of a token can later be modified by the Transformer layers based on the context.</p><p>There is another important problem to solve: <strong>position</strong>.</p><p>Consider these two sentences:</p><blockquote><em>“The dog eats the food.”</em></blockquote><blockquote><em>“The food eats the dog.”</em></blockquote><p>Both sentences contain similar words, but their meanings are different because the word order changes.</p><p>A model therefore needs a way to incorporate information about the position of each token in a sequence, this is known as <strong>positional information</strong></p><p>Different Transformer architectures handle this in different ways, including:</p><ul><li>Positional embeddings</li><li>Rotary positional embeddings, commonly called RoPE</li></ul><p>The model therefore needs to know two things:</p><ol><li>What each token represents.</li><li>Where each token appears in the sequence.</li></ol><h3>4. Step Three: Transformer Blocks</h3><p>After tokenization and embedding, the input passes through a stack of <strong>Transformer blocks</strong>.</p><p>Modern language models often contain dozens of these blocks, depending on their architecture and size.</p><p>A typical Transformer block includes:</p><ul><li>Self-attention</li><li>A feed-forward network</li><li>Residual connections</li><li>Normalization layers</li></ul><h3>Self-Attention</h3><p>Self-attention allows a token to incorporate information from other relevant tokens in the sequence.</p><p>It uses three learned projections:</p><ul><li>Query (Q)</li><li>Key (K)</li><li>Value (V)</li></ul><p>You can think of them as follows:</p><ul><li><strong>Query:</strong> What information is this token looking for?</li><li><strong>Key:</strong> What information does each token offer for matching?</li><li><strong>Value:</strong> What information should be passed along?</li></ul><p>The model compares queries with keys to calculate attention scores. These scores determine how much influence each available token should have. The values are then combined using these attention weights.</p><p>In a decoder-only language model, causal masking ensures that a token cannot directly attend to future tokens.</p><p>For example:</p><blockquote><em>“river bank”</em></blockquote><p>The earlier word <strong>“river”</strong> can influence the representation of <strong>“bank”</strong> because it appears before it.</p><p>Now consider:</p><blockquote><em>“bank account”</em></blockquote><p>The token <strong>“bank”</strong> cannot use information from the later token <strong>“account”</strong> at any layer because causal masking prevents access to future tokens.</p><p>However, later tokens can use earlier tokens to interpret what follows. The representation of <strong>“account”</strong> can incorporate information from <strong>“bank”</strong>, and the model can still work out the meaning as the sequence unfolds.</p><p>This restriction helps the model learn how to predict the next token using only the information available so far.</p><h3>Feed-Forward Network</h3><p>After self-attention, the representation passes through a feed-forward network. This network applies learned transformations to each token representation. It helps the model process and combine patterns learned during training.</p><p>The feed-forward network does not function like a simple database containing neatly organized facts. Instead, information is distributed across the learned parameters of the network.</p><p>Residual connections and normalization help the model train effectively and preserve useful information as representations pass through many layers.</p><p>As the input moves through the Transformer blocks, the token representations become increasingly informed by their preceding context.</p><figure><img alt="Transformer Block" src="https://cdn-images-1.medium.com/proxy/1*DFJlUTsTj680st98rhpUXw.png" /></figure><h3>5. From Hidden States to the Next Token</h3><p>After passing through the final Transformer block, each token has a contextual hidden representation that can incorporate information from the token itself and its available preceding context.</p><p>The model then uses a <strong>language model head</strong> to predict the next token.</p><p>The language model head converts the hidden representation into a list of raw scores called <strong>logits</strong>. There is one logit for every token in the model’s vocabulary.</p><p>But these raw scores are not probabilities. How does the model turn them into something we can interpret as the likelihood of different next tokens?</p><p>This is where <strong>softmax</strong> comes in.</p><p>Softmax is a mathematical function that converts the logits into probabilities. Each token receives a probability between 0 and 1, and the probabilities across the vocabulary sum to 1.</p><p>For example, after reading:</p><pre>The capital of France is</pre><p>the model would likely assign a much higher probability to <strong>Paris</strong> than to other cities.</p><p>These probabilities are illustrative. The actual distribution depends on the model and the complete context.</p><p>Once the model has calculated these probabilities, it needs to select the next token. This is handled by a process called <strong>decoding</strong>.</p><p>Depending on the decoding strategy and configuration, the model might select the token with the highest probability or sample from the probability distribution.</p><p>During generation, the hidden state at the final position is used to predict the next token. Although the model processes representations for all positions in a full forward pass, the logits from the final position are the ones needed for the next-token prediction. During training, however, the model uses the outputs from all positions to learn next-token predictions in parallel.</p><h3>6. The Key Insight: One Token at a Time</h3><p>Here is the most important concept:</p><blockquote><em>An LLM does not produce the whole response in one pass. It predicts one token at a time.</em></blockquote><p>The generation process can be represented like this:</p><pre>Prompt<br>  ↓<br>Transformer<br>  ↓<br>Predict next token<br>  ↓<br>Append token<br>  ↓<br>Transformer<br>  ↓<br>Predict next token<br>  ↓<br>Append token<br>  ↓<br>...<br>  ↓<br>Stop</pre><p>The newly generated token is appended to the existing sequence and becomes part of the context for the next prediction. This process continues until the model generates a stopping token or reaches a generation limit.</p><p>For example, a response containing 500 words may require hundreds of sequential generation steps.</p><p>This is what <strong>“autoregressive”</strong> means: each new token is predicted from everything that came before.</p><p>However, repeatedly processing the entire sequence from the beginning would be inefficient. In practice, techniques such as <strong>KV caching</strong> help make this process more efficient by reusing intermediate results from previously processed tokens rather than recomputing them at every step.</p><h3>7. KV Cache: Reusing What Is Already Computed</h3><p>During self-attention, the model calculates Query, Key, and Value representations.</p><p>For previously processed tokens, the Key and Value representations can be stored in a memory structure called the <strong>KV cache</strong>.</p><p>During the next generation step, the model does not need to recompute the Key and Value projections for every previous token.</p><p>Instead, it can:</p><ol><li>Process the newly generated token.</li><li>Calculate its new Query, Key, and Value representations.</li><li>Add the new Key and Value representations to the cache.</li><li>Use the current Query to attend to the available cached Keys.</li><li>Combine the corresponding Values using the attention weights.</li></ol><p>The KV cache reduces repeated computation and makes autoregressive generation more efficient.</p><p>However, it does not make attention completely free. As the context grows, the cache also grows, and the current query may still need to attend to a larger number of previous tokens.</p><p>The main idea is simple:</p><blockquote><em>Reuse what has already been computed instead of calculating it again.</em></blockquote><h3>8. Why This Matters</h3><p>Understanding the generation loop helps explain several important behaviors of modern language models.</p><h3>Longer Contexts Require More Resources</h3><p>As the context becomes longer, the model must manage more token representations. This can increase memory usage and computational cost.</p><p>The KV cache also grows as more tokens are processed.</p><h3>Earlier Tokens Influence Later Responses</h3><p>Every generated token becomes part of the context for the next prediction.</p><p>This means that earlier choices can influence later output. Depending on the model, prompt, and decoding strategy, this can contribute to repetition, topic drift, or other generation behaviors.</p><h3>Modern Architectures Improve Efficiency</h3><p>Techniques such as <strong>Grouped-Query Attention (GQA)</strong> reduce the number of Key and Value heads, which can lower KV cache memory requirements.</p><p><strong>Mixture-of-Experts (MoE)</strong> models use a different approach. Instead of activating every expert for every token, they route each token to a selected group of experts.</p><p>This allows the model to have a larger total parameter capacity without activating all parameters for every token.</p><p>These techniques address different aspects of model efficiency.</p><h3>Conclusion</h3><p>The same process powers AI Application, the token-by-token generation process is fundamental to many modern AI applications, including:</p><ul><li>Chatbots</li><li>Retrieval-Augmented Generation (RAG) systems</li><li>Tool-using agents</li><li>Coding assistants</li><li>AI-powered search systems</li></ul><p>Understanding how a prompt moves through tokenization, embeddings, attention, prediction, and generation helps us reason about the behavior and performance of these systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33002fcf41d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OAuth 2.0 Explained: Understanding Authorization Code Flow]]></title>
            <link>https://medium.com/@deekshad1502/oauth-2-0-explained-understanding-authorization-code-flow-88aa8d73e553?source=rss-87cdab9b5d48------2</link>
            <guid isPermaLink="false">https://medium.com/p/88aa8d73e553</guid>
            <category><![CDATA[sign-in]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[google-oauth]]></category>
            <category><![CDATA[authorization]]></category>
            <dc:creator><![CDATA[Deeksha]]></dc:creator>
            <pubDate>Mon, 26 Jan 2026 15:24:55 GMT</pubDate>
            <atom:updated>2026-01-26T15:24:55.391Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Is OAuth? (And Why Does It Exist?)</h3><p><strong>OAuth</strong> stands for <strong>Open Authorization</strong>.</p><p>OAuth is not an authentication protocol — it is an <strong>authorization</strong> protocol that allows an application to access a user’s data <strong>without ever handling the user’s credentials</strong>. While it is commonly used for login flows, its primary purpose is to grant applications limited access to user data without sharing credentials.</p><p>You use OAuth every time you click:</p><ul><li>“Sign in with Google”</li><li>“Continue with GitHub”</li><li>“Login with Facebook”</li></ul><h3>The Problem OAuth Solves</h3><p>Before OAuth, applications often:</p><ul><li>Asked users for usernames and passwords</li><li>Stored them in databases</li><li>Became a single point of failure if compromised</li></ul><p>OAuth solves this by:</p><ul><li>Letting users authenticate directly with a trusted provider</li><li>Giving applications <strong>limited, scoped access</strong> via tokens</li><li>Ensuring passwords are never shared with third-party apps</li></ul><h3>The OAuth Flow We’ll Focus On</h3><p>OAuth defines multiple flows, but most modern web applications use just one — <strong>Authorization Code Flow. </strong>This is the most secure flow for server-side applications and it is preferred when your backend can safely store secrets.</p><blockquote><strong><em>Note:</em></strong><em> For single-page applications (SPAs) or mobile apps, consider using Authorization Code Flow with PKCE (Proof Key for Code Exchange), which adds an extra security layer when client secrets cannot be safely stored.</em></blockquote><h3>OAuth 2.0 Authorization Code Flow (High-Level Idea)</h3><p>At a high level:</p><ol><li>The frontend redirects the user to the OAuth provider</li><li>The provider authenticates the user</li><li>The provider sends back a short-lived <strong>authorization code</strong></li><li>The backend exchanges that code for an <strong>access token</strong></li><li>The backend fetches user data and creates a session</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hV7wlx70x_PStnryMqmN9A.png" /><figcaption>Figure 1: The complete OAuth 2.0 Authorization Code Flow showing the interaction between user, frontend, backend, and OAuth provider</figcaption></figure><h3>Step-by-Step OAuth Authorization Code Flow</h3><p>Below is the <strong>exact execution order</strong>, matching the flowchart.</p><h3>1. User initiates OAuth login</h3><p>The user clicks a button like <strong>“Login with Google”</strong> in the frontend. This can also be Linkedin/Discord/Github/Facebook, or any OAuth provider.</p><h3>2. Frontend redirects the browser</h3><p>The frontend redirects the browser to the OAuth provider’s authorization endpoint, sending:</p><ul><li>client_id — Your application’s identifier</li><li>redirect_uri — Where to send the user after authentication</li><li>scope — What permissions you’re requesting</li><li>state — A random value for security and context</li></ul><p>At this point, your application <strong>hands over the control to the provider</strong>.</p><h3>3. OAuth provider redirects back</h3><p>After the user authenticates and grants permission, the OAuth provider redirects the browser back to your application’s callback URL with:</p><ul><li>an <strong>authorization code </strong>(short-lived, single-use)</li><li>the same <strong>state</strong> value</li></ul><h3>4. Frontend validates state and forwards the code</h3><p>The frontend:</p><ul><li>Validates the state parameter</li><li>Forwards the authorization code to the backend</li></ul><p>The frontend <strong>does not</strong> exchange the authorization code for tokens.</p><h3>5. Backend exchanges the code for tokens</h3><p>The backend sends a request to the OAuth provider’s token endpoint:</p><ul><li>Includes the authorization code</li><li>Authenticates using the <strong>client secret</strong></li></ul><p>If valid, the provider returns:</p><ul><li>an <strong>access token</strong>(used to access APIs)</li><li>optionally a <strong>refresh token</strong>(used to get new access tokens)</li></ul><p>This step must always happen on the backend where the client secret can be kept secure.</p><h3>6. Backend fetches user information</h3><p>Using the access token, the backend calls the OAuth provider’s <strong>User Info API</strong> to retrieve profile data (email, name, avatar, etc.)</p><h3>7. OAuth provider returns user profile data</h3><p>The provider returns the requested user details based on granted scopes.</p><h3>8. Backend creates an authenticated session</h3><p>The backend:</p><ul><li>Identifies or creates a user in your database</li><li>Creates an authenticated session (typically using cookies or JWTs)</li><li>Responds to the frontend.</li></ul><p>The user is now logged in.</p><h3>Frontend vs Backend Responsibilities</h3><h3>Frontend is responsible for:</h3><ul><li>Redirecting the browser to the OAuth provider</li><li>Handling the callback redirect</li><li>Validating the state parameter</li><li>Forwarding the authorization code to the backend</li></ul><h3>Backend is responsible for:</h3><ul><li>Exchanging the authorization code for tokens</li><li>Storing tokens securely (never in localStorage or frontend code)</li><li>Calling provider APIs using the access token</li><li>Creating and managing user sessions</li></ul><p>If tokens or client secrets are handled in frontend code, the implementation is insecure.</p><h3><strong>The </strong><strong>state Parameter: More Than Just Security</strong></h3><p>The state parameter is an application defined, opaque value used to protect against CSRF attacks and to preserve application context across OAuth redirects. Since OAuth providers do not reliably preserve custom query parameters, any flow specific information such as whether OAuth was initiated for login or account linking must be encoded in the state parameter and validated on callback.</p><p>In real applications, OAuth may be triggered for:</p><ul><li>Login</li><li>Connecting a provider to an existing profile</li><li>Re-authentication</li></ul><p>Implementation Pattern:</p><ul><li>Encode the flow context in state before redirection.</li><li>Validate it on callback.</li><li>Decode the context to route the user correctly based on their original intent.</li></ul><h3>Common Pitfalls to Avoid</h3><ol><li><strong>Handling tokens in the frontend</strong> — Always exchange codes on the backend</li><li><strong>Ignoring state validation</strong> — This opens you to CSRF attacks</li><li><strong>Not handling token expiration</strong> — Implement refresh token logic</li><li><strong>Storing tokens in localStorage</strong> — Use HTTP-only cookies or secure backend storage</li><li><strong>Using the same redirect_uri for multiple flows</strong> — Use state to differentiate flows instead</li></ol><h3><strong>Conclusion</strong></h3><p>OAuth 2.0 Authorization Code Flow is the industry standard for delegating access to user data without sharing credentials. By keeping sensitive operations on the backend and properly managing the state parameter, you can implement OAuth securely and maintain context throughout the entire flow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88aa8d73e553" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a zero cost AI Agent that Runs locally on your Laptop]]></title>
            <link>https://medium.com/@deekshad1502/building-a-zero-cost-ai-agent-that-runs-locally-on-your-laptop-b30f6d2b2f92?source=rss-87cdab9b5d48------2</link>
            <guid isPermaLink="false">https://medium.com/p/b30f6d2b2f92</guid>
            <category><![CDATA[llama-3]]></category>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Deeksha]]></dc:creator>
            <pubDate>Wed, 03 Dec 2025 11:07:06 GMT</pubDate>
            <atom:updated>2025-12-03T11:48:56.002Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Building a zero cost AI Agent that Runs locally in your Laptop</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DT3o5COn9g_nfzinnZLMBQ.png" /></figure><p><strong>What if I told you that you could have a personal tech agent that:</strong></p><ul><li>Never gets tired of your questions</li><li>Costs absolutely nothing to run</li><li>Works offline (yes, even on a plane)</li><li>Never judges your “silly” mistakes</li><li>Gives you instant, personalized feedback</li></ul><p><strong>And runs entirely on your laptop?</strong></p><p>That’s exactly what I built, and the best part is that you can clone it and have your own AI agent too.</p><h3>The Problem That Started It All</h3><p>Picture this: It’s 11 PM. You’re learning REST APIs. You <em>think</em> you understand REST APIs, but you’re not 100% sure. You want to test yourself, but:</p><ul><li>Your mentor friend is asleep</li><li>Stack Overflow feels too public</li><li>Paid quiz platforms want $29/month</li><li>ChatGPT feels like overkill (and you’ve hit your free limit anyway)</li></ul><p><strong>What you really want is a patient agent who asks smart questions, reads your answer carefully, points out what you got right, gently shows what you missed, and explains the correct approach.</strong></p><p>But that agent doesn’t exist at midnight on a Tuesday. <strong>Or does it?</strong></p><h3>The AI Agent That Lives in Your Machine</h3><p>Here’s where it gets interesting. Most people think AI = cloud = expensive API calls. But there’s a quiet revolution happening:</p><p><strong>Local AI models are now good enough to be genuinely useful.</strong></p><p>Using <strong>Ollama</strong>, you can download and run models like LLaMA 3.2 on your laptop. No internet required. No usage caps. No privacy concerns.</p><p>Think of it like this:</p><ul><li><strong>Old way:</strong> Your question → travels 3,000 miles to a server → processed → travels back (costs $$$)</li><li><strong>New way:</strong> Your question → processed <em>on your laptop</em> → instant answer (costs $0.00)</li></ul><p>The performance? On a decent laptop, you get responses in <strong>1–2 seconds</strong>. That’s faster than most cloud APIs once you account for network latency.</p><h3>How the Magic Happens: The Architecture</h3><h3>The Journey of a Single Question</h3><p><strong>Step 1: You Pick a Topic</strong><br>Click “REST API”</p><p><strong>Step 2: The Agent Generates a Question</strong><br>Your React frontend asks the backend: <em>“Give me a REST API question.”</em></p><p>The backend uses <strong>LangChain</strong> to craft a perfect prompt:</p><blockquote><em>“You are a tech mentor. Generate ONE clear question about REST API. Keep it under 40 words.”</em></blockquote><p>The AI agent (LLaMA 3.2, running locally) generates something like:</p><blockquote><em>“Explain the difference between PUT and PATCH requests in REST APIs. When would you use each?”</em></blockquote><p><strong>Step 3: You Answer</strong><br>You type: <em>“PUT replaces the entire resource, PATCH updates part of it.”</em></p><p><strong>Step 4: The Agent Evaluates</strong><br>Your answer goes back with another structured prompt:</p><blockquote><em>“Here’s a question and a student’s answer. Evaluate it. Return what they got RIGHT, what they MISSED, and a model answer. Format as JSON.”</em></blockquote><p>Within seconds, you get:</p><p><strong>Feedback:</strong></p><ul><li>“Good identification of the key difference”</li><li>“Consider explaining a real-world use case”</li></ul><p><strong>Model Answer:</strong></p><blockquote><em>“PUT replaces an entire resource (idempotent), while PATCH updates specific fields. Use PUT when you have complete data; use PATCH for partial updates to save bandwidth.”</em></blockquote><h3>What LangChain Does:</h3><ol><li><strong>Prompt Templates</strong></li></ol><p>Instead of:</p><pre>“Question: “ + question + “ Answer: “ + answer + “ Evaluate this…”</pre><p>You write:</p><pre>Question: {question}<br>User’s Answer: {answer}<br>Evaluate and return JSON with feedback and model_answer.</pre><p>Clean. Reusable. Maintainable.</p><p><strong>2. Model Swapping (Change One Line)</strong></p><p>Your app uses LLaMA 3.2. One day you hear about a better model. With LangChain, you change:</p><pre>llm = ChatOllama(model=&quot;llama3.2&quot;)</pre><p>to something else like:</p><pre>llm = ChatOllama(model=&quot;mistral&quot;)</pre><p>Done. Zero other changes needed. Your entire app now uses a different AI brain.</p><p><strong>3. Structured Conversations</strong>(Not Just Prompts, But Dialogues)<br>LangChain understands that talking to an AI isn’t just about sending text it’s about giving <strong>context</strong>. It manages:</p><ul><li>System messages (“You are a tech mentor”)</li><li>User messages (“Evaluate this answer”)</li><li>Assistant responses (the AI’s reply)</li></ul><p>It handles the chat format so you don’t have to think about it.</p><h4>3. JSON Parsing (Getting Consistent Outputs)</h4><p>The hardest part of working with AI? Getting it to return data in a <em>consistent format</em>. Sometimes it returns JSON. Sometimes it adds extra text. Sometimes it formats things weirdly.LangChain’s structured prompts dramatically increase the odds of getting clean, parseable JSON every time.</p><p><strong>The bottom line:</strong> LangChain is the difference between wrestling with AI and having AI work <em>for</em> you. It’s the invisible layer that makes everything feel smooth and effortless.</p><h3>Why This Approach is Genius</h3><h3>1. Zero Ongoing Costs</h3><p>Most AI apps die because of API costs, but this one would be free forever.</p><h3>2. Privacy First</h3><p>Your attempts at explaining SQL joins will never leave your laptop. No server logs and no data collection.</p><h3>3. Works Offline</h3><p>Airplane mode? Hotel WiFi down? Your agent still works perfectly.</p><h3>4. Instant Feedback Loop</h3><p>Try → Fail → Understand → Retry. In <em>seconds</em>, not days.</p><h3>5. No Judgment</h3><p>The agent doesn’t know if this is your 1st or 50th attempt and hence it results in pure learning.</p><h3>The Unexpected Joy: When the Agent Surprises You</h3><p><strong>The Creative Explainer:</strong></p><p>I asked for a SQL question. It came up with: <em>“Why would you use an index on a user’s email column?”</em> Straightforward, but tied to a real world scenario developers actually face.</p><p><strong>The Gentle Corrector:</strong><br>Consider someone answered partially wrong. Feedback started with: <em>“You correctly identified the component lifecycle…”</em> before pointing out the mistake. It acknowledged what was <em>right first</em>.</p><p><strong>The Context Understander:</strong><br>If someone wrote a technically correct but over-complicated answer. Agent’s feedback: <em>“While accurate, consider simpler explanations for clarity.”</em> It understood the <em>communication quality</em>, not just the technical accuracy.</p><h3>Getting Started: Your 10-Minute Setup</h3><h3>1. Install Ollama (2 minutes)</h3><p>Visit <a href="https://ollama.com/">ollama.com</a> → Download → Install</p><h3>2. Pull the Model (3 minutes)</h3><pre>ollama pull llama3.2</pre><h3>3. Run Backend</h3><pre>git clone https://github.com/Deeksha1502/Lets-test-your-knowledge<br>cd backend<br>pip install fastapi uvicorn langchain-community langchain-core pydantic<br>uvicorn main:app — reload — host 0.0.0.0 — port 8000</pre><h3>4. Run Frontend</h3><pre>cd frontend/quiz<br>npm install<br>npm run dev</pre><p>Visit http://localhost:5173 → Start learning!</p><h3>AI Agents as Thought Partners</h3><p>The goal isn’t to replace human guidance; it is to ensure this tool is always ready to work when you are. Rather than offering easy answers, it pushes you to think deeper, reviews your work with precision, and sets high standards. It is a collaborator in your growth, not a substitute for your effort.</p><h3>The Bigger Picture</h3><p>We’re at a turning point where:</p><ul><li>AI is powerful enough for meaningful feedback</li><li>Local models run on consumer hardware</li><li>Open-source tools build real products</li></ul><p>Anyone can now build personalised learning tools. No million-dollar budgets. No cloud infrastructure. Just a laptop and curiosity.</p><h3>Try It Now</h3><p>👉 <a href="https://github.com/Deeksha1502/Lets-test-your-knowledge"><strong>GitHub: Lets-test-your-knowledge</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b30f6d2b2f92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fixing Play Core 1.9.1 SDK 34 Compatibility Issues in Ionic/Angular Cordova-Capacitor Apps]]></title>
            <link>https://medium.com/@deekshad1502/fixing-play-core-1-9-1-sdk-34-compatibility-issues-in-ionic-angular-cordova-capacitor-apps-e2f786150c37?source=rss-87cdab9b5d48------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2f786150c37</guid>
            <category><![CDATA[sdk]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[compatibility]]></category>
            <category><![CDATA[google-play-console]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Deeksha]]></dc:creator>
            <pubDate>Tue, 30 Sep 2025 09:39:49 GMT</pubDate>
            <atom:updated>2025-09-30T09:39:49.397Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WDrqvkifOXLm6twVTB4wFg.png" /></figure><p>When targeting Android 14 (SDK 34) with an Ionic Angular app, the build was repeatedly rejected by Google Play Console due to an outdated <strong>Play Core dependency</strong>. After debugging and updating plugins, the issue was resolved and the app was successfully published for internal testing.</p><p>This post outlines the exact error, why it happened, and the steps taken to fix it.</p><h3>The Critical Error</h3><p>During upload to Google Play Console for internal testing, the following rejection appeared:</p><pre>Your bundle targets SDK 34, but uses a Play Core library that cannot be used with that version. <br>Your current com.google.android.play:core:1.9.1 library is incompatible with targetSdkVersion 34 (Android 14), <br>which introduces a backwards-incompatible change to broadcast receivers and may cause app crashes.</pre><p>This was a <strong>hard block</strong> preventing the release for internal testing on google play console.</p><h3>Understanding the Problem</h3><h4>What is the Play Core Library?</h4><p>The Play Core library integrates Google Play features like in-app updates, on-demand feature delivery, and dynamic asset delivery.</p><h4>Why is it Incompatible?</h4><p>The version com.google.android.play:core:1.9.1 is outdated and does not support Android 14 (SDK 34). Key breaking changes include:</p><ul><li>Context-registered receivers must specify export behaviour</li><li>Runtime broadcast registration requires explicit RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED</li><li>Stricter implicit broadcast restrictions</li><li>Stronger inter-app communication security</li></ul><p>Because Play Core 1.9.1 predates these changes, using it leads to crashes in the mobile app and Play Console rejections.</p><h4>The Hidden Culprit: Transitive Dependencies</h4><p>Updating the app’s direct Play Core dependency wasn’t enough. A closer look revealed that <strong>two Cordova plugins</strong> were still pulling in the deprecated library:</p><ul><li>cordova-plugin-inappupdatemanager</li><li>sb-cordova-plugin-utility</li></ul><p>The real blockers were <strong>transitive dependencies in Cordova plugins</strong>, not the app’s direct dependency.</p><h3>The Fix</h3><h4>Step 1: Updating cordova-plugin-inappupdatemanager</h4><p>In the plugin’s plugin.xml, the deprecated dependency was replaced:</p><pre>&lt;!-- Before --&gt;<br>&lt;framework src=&quot;com.google.android.play:core:1.9.1&quot; /&gt;</pre><p>with:</p><pre>&lt;!-- After --&gt;<br>&lt;framework src=&quot;com.google.android.play:app-update:2.1.0&quot; /&gt;<br>&lt;framework src=&quot;com.google.android.gms:play-services-tasks:18.0.2&quot; /&gt;</pre><h4>Step 2: Updating sb-cordova-plugin-utility</h4><p>The utility plugin was also referencing Play Core 1.9.1. The same fix was applied:</p><pre>&lt;!-- Before --&gt;<br>&lt;framework src=&quot;com.google.android.play:core:1.9.1&quot; /&gt;</pre><p>to</p><pre>&lt;!-- After --&gt;<br>&lt;framework src=&quot;com.google.android.play:app-update:2.1.0&quot; /&gt;<br>&lt;framework src=&quot;com.google.android.gms:play-services-tasks:18.0.2&quot; /&gt;</pre><p>This ensured that no plugin referenced the old library.</p><h4>Step 3: Cleaning NPM &amp; Cordova Cache in CI/CD</h4><p>Even after updating the plugins, cached artifacts sometimes reintroduced the Play Core 1.9.1 dependancy. To prevent this, the GitHub Actions workflow was updated with a cache-cleaning step:</p><pre>- name: Clean npm &amp; Cordova cache <br>  run: |<br>    npm cache clean --force<br>    rm -rf node_modules plugins platforms package-lock.json<br>    rm -rf ~/.cordova<br>    npx cordova platform remove android || true</pre><p>This forces a fresh install on every build, ensuring the updated dependencies are always used.</p><h3>TL;DR</h3><p>- Replace play-core:1.9.1 with app-update:2.1.0 <br>- Update cordova-plugin-inappupdatemanager &amp; sb-cordova-plugin-utility <br>- Clean caches in CI/CD</p><h3>Final Thoughts</h3><p>This migration highlighted how deprecated libraries can completely block releases not just cause runtime warnings. Cordova/Capacitor plugins especially need close inspection since they often embed native Android dependencies.</p><p>After applying these updates, the Play Console checks finally passed, and I was able to publish the app successfully.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2f786150c37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Progress Bar: Revolutionizing Large File Uploads on the Web]]></title>
            <link>https://medium.com/@deekshad1502/beyond-the-progress-bar-revolutionizing-large-file-uploads-on-the-web-4457000d03ec?source=rss-87cdab9b5d48------2</link>
            <guid isPermaLink="false">https://medium.com/p/4457000d03ec</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[chunk]]></category>
            <category><![CDATA[multer]]></category>
            <category><![CDATA[react-file-upload]]></category>
            <dc:creator><![CDATA[Deeksha]]></dc:creator>
            <pubDate>Sun, 29 Jun 2025 06:28:23 GMT</pubDate>
            <atom:updated>2025-06-30T15:46:34.498Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7DpZPRKdwWgpEzwFhdjCw.png" /></figure><p>In today’s data driven world, transferring large files over the internet remains a persistent challenge. We’ve all experienced the frustration of uploading a large video or document, only to have the connection fail at 99%, forcing us to start all over again. This pain point is exactly what inspired me to build a file upload solution that delivers reliability and transparency to the upload process.</p><h3>🚀 Introduction</h3><p>Traditional file uploads suffer from several fundamental limitations:</p><ol><li><strong>The All-or-Nothing Approach:</strong> If your connection drops during an upload, you typically lose all progress and must restart from the beginning.</li><li><strong>The Black Box Experience:</strong> Standard progress indicators offer little insight into what’s actually happening with your file.</li><li><strong>Timeouts and Size Limits:</strong> Most servers have request timeouts and size limitations that make uploading large files problematic.</li><li><strong>Poor Recovery Options:</strong> When failures occur, users are left frustrated without a clear way to resume their work.</li></ol><h3>💡 Solution: Chunked Uploads</h3><p>Instead of sending the entire file in one go, we break it into <strong>small, manageable pieces (chunks)</strong> and upload each chunk individually. That way, if something fails, we just retry the failed part and not the whole thing.</p><h4>But how does it work?</h4><p>Here’s a step-by-step process of what happens when a user uploads a large file using this method:</p><ol><li><strong>File Slicing:</strong> Your browser analyzes the file and divides it into standardized chunks (typically 5MB each)</li><li><strong>Session Initialization:</strong> The system creates a unique upload session to track all the chunks belonging to your file</li><li><strong>Chunk-by-Chunk Upload:</strong> Each segment of your file is uploaded individually, with its own progress tracking</li><li><strong>Real-Time Visualization:</strong> You can see exactly which chunks are pending, uploading, or completed</li><li><strong>Server-Side Assembly:</strong> Once all chunks are received, the server reconstructs your original file</li><li><strong>Automatic Cleanup:</strong> Temporary chunks are removed after successful reassembly</li></ol><p>Here is a demonstration of trying to upload a 1.2GB file, you can see the details which includes the upload speed, chunk size, chunk upload status, and the total number of chunks created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-RJVSuaXKukZPXQBBhuyRA.gif" /><figcaption>Chunk Visualization</figcaption></figure><h3>🧱 Behind the Scenes: Technical Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*oUzavH5dJtYcsYYaxRyKFQ.png" /></figure><h4><strong>Frontend (React + Vite)</strong></h4><ol><li><strong>ChunkedFileUploader.jsx</strong>: This is the main component that handles the:</li></ol><ul><li>File selection</li><li>Chunking logic</li><li>Progress tracking and visualization</li><li>Upload management (start)</li><li>File listing and deletion interface</li></ul><ol><li><strong>App.jsx</strong>: Simple wrapper component that integrates the ChunkedFileUploader</li><li><strong>index.css</strong>: Global styles, including Tailwind CSS imports</li><li><strong>main.jsx</strong>: Entry point that renders the React application</li></ol><h4>1. File Slicing + Upload Loop</h4><p>A chunk size of 5MB is used to split the large file uploaded by the user.</p><pre>const CHUNK_SIZE = 5 * 1024 * 1024; // 5MB<br>for (let i = 0; i &lt; totalChunks; i++) {<br>  const start = i * CHUNK_SIZE;<br>  const end = Math.min(start + CHUNK_SIZE, file.size);<br>  const chunk = file.slice(start, end);<br>  const formData = new FormData();<br>  formData.append(&#39;chunk&#39;, chunk);<br>  formData.append(&#39;chunkIndex&#39;, i);</pre><pre>await fetch(`${SERVER_URL}/upload/chunk/${uploadId}`, {<br>    method: &#39;POST&#39;,<br>    body: formData,<br>  });<br>}</pre><h4>2. Chunk Progress Tracking</h4><p>A super simplified version to show conceptually how each chunk is tracked:</p><pre>setChunkProgress(prev =&gt; {<br>  const updated = [...prev];<br>  updated[i] = &#39;uploading&#39;; // or &#39;completed&#39;, &#39;failed&#39;<br>  return updated;<br>});</pre><h4>Backend (Node.js + Express)</h4><p>A Node.js server with Express handles the upload sessions, chunk storage, and file reassembly. Express provides the lightweight, flexible foundation needed for handling multiple concurrent uploads.</p><ol><li><strong>server.js</strong>: The main Express server that handles all API endpoints for the chunked upload system, including:</li></ol><ul><li>Upload initialization</li><li>Chunk processing</li><li>File reassembly</li><li>File management (listing and deletion)</li></ul><ol><li><strong>uploads/ directory</strong>: Where completely assembled files are stored after successful uploads</li><li><strong>chunks/ directory</strong>: Temporary storage for chunks during the upload process, organized by upload session IDs</li></ol><h4>1. Handling Chunk Uploads with Multer</h4><p><a href="https://github.com/expressjs/multer">Multer</a> is a middleware for handling multipart/form-data, which is primarily used for uploading files in Express applications. It parses incoming form data and makes uploaded files accessible via req.file (for single file uploads) or req.files (for multiple files).</p><pre>const storage = multer.diskStorage({<br>    destination: (req, file, cb) =&gt; {<br>      const uploadId = req.params.uploadId;<br>      if (!uploadId) {<br>        console.error(&#39;Error: uploadId is missing in URL parameters&#39;);<br>        return cb(new Error(&#39;Missing uploadId in URL parameters&#39;));<br>      }<br>      const chunkDir = path.join(chunksDir, uploadId);<br>      if (!fs.existsSync(chunkDir)) {<br>        fs.mkdirSync(chunkDir, { recursive: true });<br>      }<br>      cb(null, chunkDir);<br>    },<br>    filename: (req, file, cb) =&gt; {<br>      // Use a temporary name - we&#39;ll rename it after processing<br>      cb(null, &#39;temp_chunk&#39;);<br>    }<br>  });<br><br>const upload = multer({ storage });<br></pre><h4>2. Uploading Individual chunk</h4><p>This endpoint handles the upload of a <strong>single file chunk</strong> from the frontend. It’s hit every time a chunk is sliced and sent from the client. Each chunk is saved temporarily using <strong>Multer</strong>, and then renamed and moved into a dedicated folder based on the uploadId.</p><pre>app.post(&#39;/upload/chunk/:uploadId&#39;, upload.single(&#39;chunk&#39;), (req, res) =&gt; {<br>  const { uploadId } = req.params;<br>  const { chunkIndex } = req.body;<br>  const tempPath = req.file.path;<br>  const finalPath = path.join(chunksDir, uploadId, `chunk_${chunkIndex}`);<br>  fs.renameSync(tempPath, finalPath);<br>   res.json({ success: true });<br>  });</pre><h4>3. Reassembling the Chunks</h4><p>Once all individual chunks of a file have been successfully uploaded and stored, it’s time to put the puzzle back together. This step is where the backend <strong>reconstructs the original file</strong> by reading each chunk in sequence and appending it to a final output file.</p><pre>const writeStream = fs.createWriteStream(finalFilePath);<br>for (let i = 0; i &lt; session.totalChunks; i++) {<br>  const chunkPath = path.join(chunkDirPath, `chunk_${i}`);<br>  const data = fs.readFileSync(chunkPath);<br>  writeStream.write(data);<br>}<br>writeStream.end();</pre><h3>Conclusion</h3><p>Chunked file uploads bring a much needed upgrade to the traditional file upload experience — making it <strong>reliable</strong>, <strong>resumable</strong>, and <strong>transparent</strong>. By breaking large files into smaller pieces, we minimize the impact of network failures, enable detailed progress tracking, and avoid common pitfalls like timeouts or server size limits.</p><p><em>Want to see the full code? Check it out on </em><a href="https://github.com/Deeksha1502/Large-file-upload"><em>GitHub</em></a><em> 🚀</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4457000d03ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>