<?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 Sagar Sonwane on Medium]]></title>
        <description><![CDATA[Stories by Sagar Sonwane on Medium]]></description>
        <link>https://medium.com/@sagarsonwane230797?source=rss-152a7a26f299------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OjErmw8C8s7MCd24</url>
            <title>Stories by Sagar Sonwane on Medium</title>
            <link>https://medium.com/@sagarsonwane230797?source=rss-152a7a26f299------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 12:59:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sagarsonwane230797/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[Build deterministic AI Agents]]></title>
            <link>https://sagarsonwane230797.medium.com/build-deterministic-ai-agents-343967af426d?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/343967af426d</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agentic-ai-architecture]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Sat, 21 Mar 2026 09:58:13 GMT</pubDate>
            <atom:updated>2026-04-05T16:55:43.859Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AogxODmmAMNBeyAYtF614g.png" /></figure><p>Gotcha.</p><p>You probably clicked this blog with one of two reactions in mind.</p><p><strong>The first:</strong> “Great. I want to learn how to build deterministic AI agents.”<br><strong>The second: </strong>“There is no such thing as deterministic AI when an LLM is involved.”</p><p>If you came with the first thought, good. We are going to talk about how to build systems that behave that way in practice. And if you came with the second thought, also good. You are not wrong.</p><p>A calculator is deterministic. A sorting algorithm is deterministic. A rules engine is deterministic.</p><p><strong>An LLM-based agent is not.</strong></p><p>If you ask the same model the same thing twice, you may get slightly different wording, a different chain of reasoning, or even a different decision. That is not a bug in the usual sense. It is the nature of the system.</p><p>So if by deterministic you mean “the model always produces the exact same output for the exact same input,” then no, AI agents are not deterministic.</p><p>And I agree with that.</p><p>But when engineers build software, they still want the system to be reliable, accurate, and predictable. AI agents should be held to that same standard.</p><p>With AI systems, the language can be fuzzy. The outcome cannot be.</p><p>So the real goal is not to make the model itself deterministic.</p><p>The real goal is to build a system where the model has very limited room to go wrong.</p><p>That means:<br> - business rules live in code<br> - The model is used for classification and routing<br> - actions are limited to a small allowed set<br> - Every critical path is validated and tested</p><p>In short:</p><p><strong>You don’t make agents deterministic. You constrain them.</strong></p><h3>A Simple Example: A Refund Support Agent</h3><p>Let’s use a beginner-friendly example.</p><p>Imagine you are building a support agent for an online store. A user sends a message like:</p><blockquote><strong><em>“My package arrived three days late. Can I get a refund?”</em></strong></blockquote><p>At first, it is tempting to build the whole thing inside one prompt:</p><blockquote><strong><em>Read the message, decide whether the customer deserves a refund, calculate the amount, and issue it.</em></strong></blockquote><p>That sounds smart, but it is a bad production design.</p><h4>Why?</h4><p>Because you are asking a probabilistic model to do the part that should be policy.</p><p>Refund decisions usually depend on rules like:<br> - was the delivery actually late?<br> - was the item refundable?<br> - is the request inside the refund window?<br> - has a refund already been issued?<br> - is this a full refund, partial refund, or no refund?</p><p>Those are not prompt problems.</p><p>Those are business rules.</p><h3>The Wrong Way</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhvttqL4KSYVqpuHBUoEog.jpeg" /></figure><p>In the wrong design, the agent does everything:</p><ol><li>Read the message</li><li>Infer the policy</li><li>Decide eligibility</li><li>Decide the amount</li><li>Call the refund API</li></ol><p>This makes the model responsible for both understanding and enforcement.</p><p>That is exactly where systems become unreliable.</p><h3>The Better Way</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kdpiwn5nzMbCnEp9JUHsSw.jpeg" /></figure><p>In the better design, the LLM handles the fuzzy part and the software handles the critical part.</p><p>The agent only extracts structured information from the user’s message:</p><ul><li>intent: refund_request</li><li>issue_type: late_delivery</li><li>order_id: 12345</li></ul><p>Then your application code takes over:<br> 1. fetch the order<br> 2. check the policy rules<br> 3. decide whether a refund is allowed<br> 4. return one allowed action</p><p>The model does not decide policy.</p><p>The model helps the system understand the request.</p><p>The system decides what is allowed.</p><h3>The Core Design Pattern</h3><p>This pattern works well in far more than support bots.</p><p>The same idea shows up in analytics agents, finance workflows, scheduling assistants, HR systems, and internal tooling:</p><ul><li>let the model interpret</li><li>let code validate</li><li>let workflows enforce</li></ul><p>That is the difference between a demo and a reliable product.</p><h3>Step 1: Put Rules in Code, Not Prompts</h3><p>If your refund policy matters, it should not live only inside a prompt.</p><p><strong>A prompt like:</strong></p><blockquote><em>“Only give refunds if the package was late and the request is within 7 days”</em></blockquote><p>is helpful context, but it is not enforcement.</p><p>Enforcement means actual code:</p><pre>def refund_policy_engine(order, issue_type):<br>    if order.already_refunded:<br>        return {&quot;allowed&quot;: False, &quot;reason&quot;: &quot;already_refunded&quot;}<br><br>    if order.order_type == &quot;digital&quot;:<br>        return {&quot;allowed&quot;: False, &quot;reason&quot;: &quot;digital_items_not_refundable&quot;}<br><br>    if issue_type == &quot;late_delivery&quot; and order.delivery_delay_days &gt;= 2:<br>        if order.days_since_delivery &lt;= 7:<br>            return {&quot;allowed&quot;: True, &quot;amount&quot;: order.total_amount}<br><br>    return {&quot;allowed&quot;: False, &quot;reason&quot;: &quot;not_eligible&quot;}</pre><p>Now the logic is explicit, reviewable, testable, and stable.</p><p>The LLM can still help identify the issue type, but it cannot invent a refund policy.</p><h3>Step 2: Use the Agent for Routing, Not Final Decisions</h3><p>For most beginner agents, the model should behave more like a classifier than a fully autonomous actor.</p><p><strong>A good question for the model is:</strong></p><blockquote><em>What kind of request is this, and what information is missing?</em></blockquote><p><strong>Bad questions are:</strong></p><ul><li>Should this customer get a refund?</li><li>How much money should I send back?</li><li>Should I override the policy?</li></ul><p>Those are system decisions.</p><p>A safer model output looks like this:</p><pre>{<br>  &quot;intent&quot;: &quot;refund_request&quot;,<br>  &quot;issue_type&quot;: &quot;late_delivery&quot;,<br>  &quot;order_id&quot;: &quot;12345&quot;,<br>  &quot;confidence&quot;: 0.91<br>}</pre><p>That output is useful because it routes the workflow without directly triggering a risky action.</p><h3>Step 3: Constrain Actions with an Allowed Set</h3><p>One of the easiest ways to make an agent safer is to give it a tiny action space.</p><p>Instead of letting it do anything, only allow actions like:</p><ul><li>ask_for_order_id</li><li>check_order_status</li><li>offer_refund</li><li>escalate_to_human</li></ul><p>That means even if the model behaves unexpectedly, it still cannot escape the rails you defined.</p><p>For example:</p><pre>ALLOWED_ACTIONS = {<br>    &quot;ask_for_order_id&quot;,<br>    &quot;check_order_status&quot;,<br>    &quot;offer_refund&quot;,<br>    &quot;escalate_to_human&quot;,<br>}<br><br><br>def execute_action(action, payload):<br>    if action not in ALLOWED_ACTIONS:<br>        raise ValueError(&quot;Action not allowed&quot;)<br><br>    return {&quot;action&quot;: action, &quot;payload&quot;: payload}</pre><p>This is a simple idea, but it matters a lot.</p><p>If an action is not allowed by the system, the agent simply cannot take it.</p><h3>Step 4: Validate Before Anything Critical Happens</h3><p>Even after classification, you should still validate inputs before doing the real thing.</p><p>For example:</p><ul><li>if there is no order_id, ask for it</li><li>if the order does not exist, stop</li><li>if the order is already refunded, stop</li><li>if the action payload is malformed, reject it</li></ul><p>So the full flow becomes:</p><ol><li>user sends message</li><li>model extracts structured fields</li><li>code validates required data</li><li>policy engine decides eligibility</li><li>system returns one safe action</li></ol><p>This is much more predictable than asking the model to improvise the entire workflow.</p><h3>Step 5: Test It Like Software</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rjKkM2VZ6dNCQlqHmZVQHQ.jpeg" /></figure><p>This is where many teams stop too early. They test the agent by chatting with it a few times.</p><p>That is not enough.</p><p>You should test it the same way you test the rest of your product.</p><p><strong>A few simple cases:</strong></p><ul><li>late delivery within 7 days -&gt; refund allowed</li><li>digital product -&gt; refund denied</li><li>already refunded order -&gt; refund denied</li><li>missing order ID -&gt; ask for order ID</li><li>confusing angry message -&gt; still route safely</li></ul><p><strong>Example:</strong></p><pre>def test_late_delivery_refund_allowed():<br>    order = Order(<br>        order_type=&quot;physical&quot;,<br>        already_refunded=False,<br>        delivery_delay_days=3,<br>        days_since_delivery=2,<br>        total_amount=120,<br>    )<br><br>    result = refund_policy_engine(order, &quot;late_delivery&quot;)<br><br>    assert result[&quot;allowed&quot;] is True<br>    assert result[&quot;amount&quot;] == 120<br><br><br>def test_digital_order_not_refundable():<br>    order = Order(<br>        order_type=&quot;digital&quot;,<br>        already_refunded=False,<br>        delivery_delay_days=0,<br>        days_since_delivery=1,<br>        total_amount=120,<br>    )<br><br>    result = refund_policy_engine(order, &quot;late_delivery&quot;)<br><br>    assert result[&quot;allowed&quot;] is False<br>    assert result[&quot;reason&quot;] == &quot;digital_items_not_refundable&quot;</pre><p>Notice what is happening here:<br> - We are not testing whether the model “feels smart.”<br> - We are testing whether the system behaves correctly.</p><p>That is the shift that makes agents reliable.</p><h3>A Simple End-to-End Version</h3><p>Here is the whole pattern in one small example:</p><pre>def handle_refund_request(user_message):<br>    classification = llm_classify(user_message)<br>    # Example output:<br>    # {<br>    #   &quot;intent&quot;: &quot;refund_request&quot;,<br>    #   &quot;issue_type&quot;: &quot;late_delivery&quot;,<br>    #   &quot;order_id&quot;: &quot;12345&quot;<br>    # }<br><br>    if classification[&quot;intent&quot;] != &quot;refund_request&quot;:<br>        return {&quot;action&quot;: &quot;escalate_to_human&quot;}<br><br>    if not classification.get(&quot;order_id&quot;):<br>        return {&quot;action&quot;: &quot;ask_for_order_id&quot;}<br><br>    order = get_order(classification[&quot;order_id&quot;])<br>    if order is None:<br>        return {&quot;action&quot;: &quot;escalate_to_human&quot;, &quot;reason&quot;: &quot;order_not_found&quot;}<br><br>    decision = refund_policy_engine(order, classification[&quot;issue_type&quot;])<br><br>    if decision[&quot;allowed&quot;]:<br>        return {<br>            &quot;action&quot;: &quot;offer_refund&quot;,<br>            &quot;amount&quot;: decision[&quot;amount&quot;],<br>        }<br><br>    return {<br>        &quot;action&quot;: &quot;escalate_to_human&quot;,<br>        &quot;reason&quot;: decision[&quot;reason&quot;],<br>    }</pre><p>This is still an AI agent.</p><p>But it is a constrained one.</p><p>And that is why it is more reliable.</p><h3>A Good Mental Model for Beginners</h3><p>Think of an LLM as a junior teammate.</p><p>It is useful for:</p><ul><li>understanding messy language</li><li>extracting structure</li><li>classifying requests</li><li>choosing between a few known paths</li></ul><p>It is not the part you should trust with final business enforcement.</p><p>That part should live in code.</p><p>So a good beginner rule is:</p><p><strong>Use AI for interpretation. Use software for control.</strong></p><h3>What “Reliable” Usually Means in Practice</h3><p>When people say they want a “deterministic agent,” they usually mean one of these:</p><ul><li>it should not take unsafe actions</li><li>it should follow policy every time</li><li>it should handle edge cases predictably</li><li>it should fail safely</li></ul><p>You do not get that by writing a bigger prompt.</p><p>You get that by designing a narrower system.</p><h3>Final Takeaway</h3><p>The most useful beginner lesson is this:</p><ul><li>Do not build an agent that decides everything.</li><li>Build an agent that does one fuzzy job well, inside a deterministic system.</li></ul><p>If you remember just one line, let it be this:</p><p><strong>Reliable agents are not usually autonomous decision-makers. They are constrained routers inside well-defined software.</strong></p><p>That is how you make AI systems predictable enough to trust in real products.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=343967af426d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building AI Agents with LangChain & Tool Calling]]></title>
            <link>https://sagarsonwane230797.medium.com/building-ai-agents-with-langchain-tool-calling-4486a9ddac9f?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/4486a9ddac9f</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 09:58:14 GMT</pubDate>
            <atom:updated>2026-04-05T17:22:47.474Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4MisJikih_eG_1Wcbc8gw.png" /></figure><p>In the previous blog, we built a RAG pipeline that retrieves and answers questions from documents.</p><p>But what if your AI needs to:</p><ul><li>Fetch live data from APIs</li><li>Trigger workflows</li><li>Query databases</li><li>Perform actions instead of just answering</li></ul><p>This is where <strong>AI Agents + Tool Calling</strong> come in.</p><h3>From RAG to Agents</h3><p>RAG is: <strong><em>“Find relevant information → Generate answer”</em></strong></p><p>Agents are: <strong><em>“Understand goal → Decide action → Use tools → Iterate → Produce result”</em></strong></p><p>The key shift:</p><p><strong>LLM is no longer just answering — it is deciding</strong></p><h3>What Exactly is an AI Agent?</h3><p>Before jumping into implementation, it’s important to understand what we really mean by an <em>AI Agent</em>.</p><p>An AI agent is not just a chatbot.</p><p>It is a system where:</p><ul><li>A <strong>language model acts as the reasoning engine</strong></li><li>External <strong>tools provide capabilities</strong></li><li>And a loop enables <strong>decision → action → observation</strong></li></ul><p>In simple terms:</p><blockquote><em>An agent is an LLM that doesn’t just respond — it </em><strong><em>decides and acts</em></strong></blockquote><p>Unlike traditional LLM applications that generate a single response, agents operate in <strong>multi-step workflows</strong> where they can:</p><ul><li>Break down problems</li><li>Choose tools dynamically</li><li>Execute actions</li><li>Iterate until the goal is achieved</li></ul><h3>⚙️ What is Tool Calling?</h3><p>Tool calling allows an LLM to:</p><ol><li>See available tools</li><li>Decide which tool to use</li><li>Generate arguments</li><li>Call the tool</li><li>Use the result to continue reasoning</li></ol><p>In LangChain, this is abstracted cleanly.</p><h4>Why Tool Calling is the Core of Agents</h4><p>Tool calling is what transforms an LLM from:<br> — a <strong>text generator</strong><br> into<br> — a <strong>system that can interact with the real world</strong></p><p>Without tools, an LLM is limited to:</p><ul><li>Its training data</li><li>Static reasoning</li></ul><p>With tools, it can:</p><ul><li>Query live APIs</li><li>Access databases</li><li>Trigger workflows</li><li>Perform computations</li></ul><p>Technically, tool calling works by:</p><ol><li>Providing the LLM with a list of tools (functions)</li><li>Describing what each tool does (via docstrings)</li><li>Letting the model decide when and how to call them</li></ol><p>Modern LLMs can even return:</p><ul><li>Structured tool calls</li><li>Arguments for execution</li><li>Instead of plain text responses</li></ul><p>This is why tool descriptions are <strong>extremely critical</strong> — they act as the interface between reasoning and execution.</p><h3>Real-World Example</h3><p>Let’s build a simple agent:</p><h4>Use Case: DevOps Assistant</h4><p>User asks: <em>“Check if my service is down and restart it if needed”</em></p><p>This requires:</p><ul><li>Checking service status (API/tool)</li><li>Restarting service (another tool)</li></ul><p>Not something an LLM can <em>hallucinate</em> — it must act.</p><h3>🏗️ Architecture</h3><pre>User Query →<br>Agent →<br>   decides →<br>      Tool A (check status)<br>      Tool B (restart service)<br>→ Final response</pre><h4>🧰 Step 1: Define Tools</h4><p>In LangChain, tools are just Python functions.</p><pre>from langchain.tools import tool<br><br>@tool<br>def check_service(service_name: str) -&gt; str:<br>    &quot;&quot;&quot;Check if a service is running&quot;&quot;&quot;<br>    # mock logic<br>    return &quot;down&quot;<br><br>@tool<br>def restart_service(service_name: str) -&gt; str:<br>    &quot;&quot;&quot;Restart a service&quot;&quot;&quot;<br>    return f&quot;{service_name} restarted successfully&quot;</pre><h4>🧠 Step 2: Initialize LLM</h4><pre>from langchain.chat_models import ChatOpenAI<br><br>llm = ChatOpenAI(model=&quot;gpt-4&quot;)</pre><h4>🔗 Step 3: Create Agent</h4><pre>from langchain.agents import initialize_agent<br><br>tools = [check_service, restart_service]<br><br>agent = initialize_agent(<br>    tools,<br>    llm,<br>    agent=&quot;zero-shot-react-description&quot;,<br>    verbose=True<br>)</pre><h4>💬 Step 4: Run the Agent</h4><pre>response = agent.run(<br>    &quot;Check if nginx is running and restart if it is down&quot;<br>)<br><br>print(response)</pre><h3>The Agent Execution Loop (Important Concept)</h3><p>Most agent systems follow a loop like this:</p><pre>User Input →<br>Reason →<br>Select Tool →<br>Execute Tool →<br>Observe Result →<br>Repeat (if needed) →<br>Final Answer</pre><p>This is often referred to as a <strong>reasoning + action loop</strong>.</p><p>Why this matters:</p><ul><li>The agent is not solving everything in one step</li><li>It is <strong>iteratively improving its understanding</strong></li><li>Each tool call becomes new context</li></ul><p>This loop is what enables:</p><ul><li>Multi-step workflows</li><li>Conditional execution</li><li>Real-world automation</li></ul><h3>🔍 What Happens Internally</h3><ol><li>LLM reads tool descriptions</li><li>Breaks down the problem</li><li>Calls check_service(&quot;nginx&quot;)</li><li>Gets result → &quot;down&quot;</li><li>Decides next step</li><li>Calls restart_service(&quot;nginx&quot;)</li><li>Returns final answer</li></ol><h3>How Does the LLM Decide Which Tool to Use?</h3><p>This is one of the most misunderstood parts.</p><p><strong>The LLM does NOT:</strong></p><ul><li>“know” tools like a program</li><li>follow strict rules (unless enforced)</li></ul><p><strong>Instead, it uses:</strong></p><ul><li>Natural language understanding</li><li>Tool descriptions</li><li>Prompt context</li></ul><p>To make a probabilistic decision.</p><p>For example:</p><p>If the user says: <strong><em>“restart nginx if it’s down”</em></strong></p><p>The model internally reasons like:</p><ul><li>I need to check status → tool available? yes</li><li>If down → restart → tool available? yes</li></ul><p>This reasoning is guided by:</p><ul><li>Prompt structure</li><li>Tool naming</li><li>Examples (if provided)</li></ul><p>Which means:</p><p>👉 <strong>Better descriptions = better decisions</strong></p><h3>Making This Deterministic (Important for Engineers)</h3><p>This is where most people get it wrong.</p><h4>Naive Thinking:</h4><p>“LLM will figure it out”</p><h4>Correct Approach:</h4><p>You <em>guide the decision boundaries</em></p><h3>Control Levers:</h3><h4>1. Tool Descriptions</h4><p>Bad: “restart service”<br>Good: “Restart a service only if it is confirmed to be down”</p><h4>2. System Prompt</h4><pre>agent = initialize_agent(<br>    tools,<br>    llm,<br>    agent=&quot;zero-shot-react-description&quot;,<br>    agent_kwargs={<br>        &quot;system_message&quot;: &quot;Always check service status before restarting&quot;<br>    }<br>)</pre><h4>3. Limit Tool Access</h4><p>Only expose what’s necessary. Too many tools can lead to llm picking the incorrect tool for the job.</p><h4>4. Add Guardrails</h4><ul><li>Validation layers</li><li>Rate limits</li><li>Confirmation steps</li></ul><h3>Key Takeaways</h3><ul><li>Tool calling turns LLMs into <strong>decision engines</strong></li><li>Agents are powerful but <strong>less deterministic than RAG</strong></li><li>Control comes from:<br>- prompts<br>- tool definitions<br>- constraints</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4486a9ddac9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Your First RAG Pipeline with LangChain]]></title>
            <link>https://sagarsonwane230797.medium.com/building-your-first-rag-pipeline-with-langchain-0e63c54214f2?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e63c54214f2</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[rags]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Sun, 25 Jan 2026 09:59:07 GMT</pubDate>
            <atom:updated>2026-04-05T17:12:58.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XDZd3rukwbmnzJxYdMqw-A.png" /></figure><p>Retrieval-Augmented Generation (RAG) is one of the most practical ways to build reliable AI systems today.</p><p>Instead of relying purely on a model’s internal knowledge, RAG lets you:</p><ul><li>Inject your own data</li><li>Keep responses grounded</li><li>Reduce hallucinations</li><li>Build deterministic-ish AI systems</li></ul><p>In this blog, we’ll build a <strong>simple end-to-end RAG pipeline</strong>:</p><ul><li>Upload a document</li><li>Chunk it</li><li>Generate embeddings</li><li>Store in a vector database</li><li>Query it via a chat interface</li></ul><h3>🧠 What is RAG (Conceptually)?</h3><p>Retrieval-Augmented Generation (RAG) works in two phases:</p><ul><li><strong>Ingestion phase (offline)</strong><br> Document → Chunk → Embed → Store in vector DB</li><li><strong>Retrieval phase (runtime)</strong><br> Query → Embed → Search → Retrieve → Generate response</li></ul><p>This separation is important because it makes the system:</p><ul><li>scalable</li><li>reusable</li><li>efficient</li></ul><p>Instead of sending entire documents to the LLM every time, we only fetch the <strong>most relevant pieces</strong>, which keeps responses fast and cost-effective.</p><h3>🚀 What We’re Building</h3><p>A minimal system like this:</p><pre>User uploads document → <br>Text is chunked → <br>Embeddings generated → <br>Stored in Vector DB →<br><br>User asks question →<br>Relevant chunks retrieved →<br>LLM generates grounded answer</pre><h3>Tech Stack</h3><ul><li>LangChain → orchestration layer</li><li>FAISS → vector storage (local)</li><li>OpenAI embeddings + LLM (or any alternative)</li><li>Python</li></ul><h3>⚙️ Step 1: Install Dependencies</h3><pre>pip install langchain openai faiss-cpu tiktoken</pre><h3>📄 Step 2: Load and Read Document</h3><p>Let’s assume a simple .txt file.</p><pre>from langchain.document_loaders import TextLoader<br><br>loader = TextLoader(&quot;sample.txt&quot;)<br>documents = loader.load()</pre><h3>✂️ Step 3: Chunk the Document</h3><h4>What is Chunking and Why It Matters?</h4><p>Chunking is simply breaking large documents into smaller pieces (chunks).</p><p>But this is not just preprocessing — it directly impacts answer quality.</p><p>Why?<br> - LLMs have <strong>context limits<br> - </strong>Large documents cannot be processed at once<br> - Retrieval works better on <strong>focused, smaller units</strong></p><p>Each chunk becomes:<br> - independently searchable<br> - individually embeddable<br> - easier to retrieve</p><p>Poor chunking leads to:<br> - irrelevant results<br> - incomplete answers<br> - hallucinations</p><p>A key insight:</p><ul><li>Too large → noisy context</li><li>Too small → loss of meaning</li></ul><p>Chunking is actually the <strong>foundation of your entire RAG pipeline</strong>, because everything downstream depends on it.</p><p><strong>Why chunking matters:</strong></p><ul><li>LLMs have context limits</li><li>Smaller chunks improve retrieval precision</li></ul><pre>from langchain.text_splitter import RecursiveCharacterTextSplitter<br><br>text_splitter = RecursiveCharacterTextSplitter(<br>    chunk_size=500,<br>    chunk_overlap=50<br>)<br><br>docs = text_splitter.split_documents(documents)</pre><p><strong>Rule of thumb</strong>:</p><ul><li>Smaller chunks → better precision</li><li>Larger chunks → better context</li></ul><h3>🔢 Step 4: Generate Embeddings</h3><h4>What are Embeddings?</h4><p>Embeddings convert text into numbers — specifically, vectors.</p><p>Think of it like this:</p><pre>&quot;dog&quot; → [0.12, -0.98, 0.44, ...]<br>&quot;puppy&quot; → [0.10, -0.95, 0.40, ...]</pre><p>These vectors capture <strong>semantic meaning</strong>, not just keywords.</p><p>So:</p><ul><li>“dog” and “puppy” → close in vector space</li><li>“dog” and “car” → far apart</li></ul><p>This is what enables <strong>semantic search</strong>, instead of keyword matching.</p><p>In a RAG pipeline:</p><ul><li>Each chunk → converted into an embedding</li><li>Query → also converted into an embedding</li><li>Similarity → used to find relevant content</li></ul><p>Embeddings are the reason RAG feels “intelligent” rather than just “search-based.”</p><pre>from langchain.embeddings import OpenAIEmbeddings<br><br>embeddings = OpenAIEmbeddings()</pre><h3>🧱 Step 5: Store in Vector DB</h3><h4>What is a Vector Database?</h4><p>A vector database stores embeddings and allows <strong>similarity search</strong>.</p><p>Unlike traditional databases:<br> - SQL → exact match<br> - Vector DB → semantic similarity</p><p>When you store embeddings:<br> - Each chunk = one vector<br> - Stored along with metadata (source, page, etc.)</p><p>At query time:</p><ol><li>Convert query → embedding</li><li>Search nearest vectors</li><li>Return top-k similar chunks</li></ol><p>This is usually done using <strong>approximate nearest neighbor (ANN)</strong> algorithms for speed.</p><p>That’s why vector DBs can:</p><ul><li>search millions of chunks</li><li>return results in milliseconds</li></ul><p>They are the <strong>retrieval engine</strong> of your RAG system.</p><p><strong>We’ll use FAISS for simplicity.</strong></p><pre>from langchain.vectorstores import FAISS<br><br>vectorstore = FAISS.from_documents(docs, embeddings)</pre><h3>🔍 Step 6: Retrieval</h3><h4>How Retrieval Actually Works</h4><p>Retrieval is where everything comes together.<br> - Query → embedding<br> - Compared with stored embeddings<br> - Top-K similar chunks selected</p><p>This “top-k” is critical:<br> - Low k → might miss context<br> - High k → introduces noise</p><p>The retrieved chunks are then:<br> - passed into the LLM<br> - used as context for answer generation</p><p>This step is what makes RAG:<br> - grounded<br> - context-aware<br> - reliable</p><p><strong>Convert vector DB into a retriever:</strong></p><pre>retriever = vectorstore.as_retriever(search_kwargs={&quot;k&quot;: 3})</pre><p><strong>This fetches top 3 relevant chunks.</strong></p><h3>💬 Step 7: Build the Chat Interface</h3><p>Now we connect retrieval + LLM.</p><h4>Why Not Just Use an LLM Directly?</h4><p>Without RAG:<br> - LLM relies only on training data<br> - Can hallucinate<br> - Cannot access private data</p><p>With RAG:<br> - Answers are grounded in your data<br> - No retraining needed<br> - Easily updatable knowledge</p><p>This is why most real-world AI systems today use RAG instead of raw LLM calls.</p><pre>from langchain.chains import RetrievalQA<br>from langchain.chat_models import ChatOpenAI<br><br>llm = ChatOpenAI(model=&quot;gpt-4&quot;)<br><br>qa_chain = RetrievalQA.from_chain_type(<br>    llm=llm,<br>    retriever=retriever<br>)</pre><h3>🧪 Step 8: Ask Questions</h3><pre>query = &quot;What is this document about?&quot;<br>response = qa_chain.run(query)<br><br>print(response)</pre><h3>What’s Actually Happening</h3><p>When you ask a question:</p><ol><li>Query → converted to embedding</li><li>Vector DB → finds similar chunks</li><li>Retrieved chunks → sent to LLM</li><li>LLM → generates grounded answer</li></ol><h3>Common Mistakes (Important)</h3><h4>1. Treating RAG as “plug and play”</h4><p>RAG quality depends heavily on:</p><ul><li>Chunking strategy</li><li>Embedding model</li><li>Retrieval tuning</li></ul><h4>2. Ignoring chunk overlap</h4><p>Without overlap:</p><ul><li>Context breaks</li><li>Answers become incomplete</li></ul><h4>3. Not controlling retrieval size (k)</h4><p>Too small → misses info<br> Too large → noisy context</p><h4>4. No evaluation</h4><p>Always test:</p><ul><li>Correctness</li><li>Context relevance</li><li>Hallucination rate</li></ul><h3>Improvements You Can Add</h3><ul><li>Metadata filtering (source, page number)</li><li>Hybrid search (keyword + vector)</li><li>Better vector DB:<br>- Pinecone<br>- Weaviate<br>- Qdrant</li><li>Streaming responses</li><li>Chat memory</li></ul><h3>Key Takeaways</h3><ul><li>RAG is <strong>not just retrieval + LLM</strong></li><li>Quality comes from:<br>- chunking<br>- retrieval tuning<br>- prompt design</li><li>Start simple → iterate based on evaluation</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e63c54214f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Go Faster With Less: Eliminating Hidden Allocations in Go]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sagarsonwane230797.medium.com/go-faster-with-less-eliminating-hidden-allocations-in-go-d28ac1604e5f?source=rss-152a7a26f299------2"><img src="https://cdn-images-1.medium.com/max/2384/1*Z1N62LEhrNmEjIdsNfj7KA.png" width="2384"></a></p><p class="medium-feed-snippet">Go is often praised for its simplicity and performance. But there&#x2019;s a hidden cost that many developers overlook: heap allocations. Every&#x2026;</p><p class="medium-feed-link"><a href="https://sagarsonwane230797.medium.com/go-faster-with-less-eliminating-hidden-allocations-in-go-d28ac1604e5f?source=rss-152a7a26f299------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sagarsonwane230797.medium.com/go-faster-with-less-eliminating-hidden-allocations-in-go-d28ac1604e5f?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/d28ac1604e5f</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[performance-optimization]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[memory-management]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Tue, 30 Sep 2025 15:49:44 GMT</pubDate>
            <atom:updated>2025-09-30T17:28:03.015Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[mTLS: The Security Layer You Didn’t Know You Needed]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sagarsonwane230797.medium.com/mtls-the-security-layer-you-didnt-know-you-needed-aa591a0ffb32?source=rss-152a7a26f299------2"><img src="https://cdn-images-1.medium.com/max/2386/0*VsNahjuBBLSDX0pN.png" width="2386"></a></p><p class="medium-feed-snippet">A hands-on guide to securing client-server communication with mutual TLS.</p><p class="medium-feed-link"><a href="https://sagarsonwane230797.medium.com/mtls-the-security-layer-you-didnt-know-you-needed-aa591a0ffb32?source=rss-152a7a26f299------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sagarsonwane230797.medium.com/mtls-the-security-layer-you-didnt-know-you-needed-aa591a0ffb32?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa591a0ffb32</guid>
            <category><![CDATA[mtls-authentication]]></category>
            <category><![CDATA[end-to-end-encryption]]></category>
            <category><![CDATA[tls]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[encryption]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Sat, 30 Aug 2025 15:17:55 GMT</pubDate>
            <atom:updated>2025-08-31T08:20:34.905Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Why Context Keys Must Be Typed in Go]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sagarsonwane230797.medium.com/why-context-keys-must-be-typed-in-go-833e71d8a4fb?source=rss-152a7a26f299------2"><img src="https://cdn-images-1.medium.com/max/1024/1*9atd8YzXqND9_302ph776A.png" width="1024"></a></p><p class="medium-feed-snippet">A few days ago, a colleague approached me with a puzzling issue. She was writing unit tests for a function that relied on values stored in&#x2026;</p><p class="medium-feed-link"><a href="https://sagarsonwane230797.medium.com/why-context-keys-must-be-typed-in-go-833e71d8a4fb?source=rss-152a7a26f299------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sagarsonwane230797.medium.com/why-context-keys-must-be-typed-in-go-833e71d8a4fb?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/833e71d8a4fb</guid>
            <category><![CDATA[context]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Thu, 31 Jul 2025 08:17:05 GMT</pubDate>
            <atom:updated>2025-08-18T10:09:23.963Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Save Memory in Go with the Empty Struct]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sagarsonwane230797.medium.com/save-memory-in-go-with-the-empty-struct-e2fe1e0f0ba6?source=rss-152a7a26f299------2"><img src="https://cdn-images-1.medium.com/max/1536/1*AeYnimzWVSd6N0ufYP_8Nw.png" width="1536"></a></p><p class="medium-feed-snippet">Go is known for its simplicity and performance, but there are small idioms that can have a surprisingly big impact&#x200A;&#x2014;&#x200A;especially when it&#x2026;</p><p class="medium-feed-link"><a href="https://sagarsonwane230797.medium.com/save-memory-in-go-with-the-empty-struct-e2fe1e0f0ba6?source=rss-152a7a26f299------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sagarsonwane230797.medium.com/save-memory-in-go-with-the-empty-struct-e2fe1e0f0ba6?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2fe1e0f0ba6</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Sun, 29 Jun 2025 23:32:19 GMT</pubDate>
            <atom:updated>2025-06-29T23:32:19.334Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding Polymorphism in Go]]></title>
            <link>https://sagarsonwane230797.medium.com/understanding-polymorphism-in-go-d704944e9816?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/d704944e9816</guid>
            <category><![CDATA[polymorphism]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[oop]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Tue, 07 Sep 2021 18:37:49 GMT</pubDate>
            <atom:updated>2021-09-07T18:40:49.373Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BruAhzl61NYiVz83ZvEcEg.jpeg" /></figure><p>Go being a programming language that is very easy to learn, performant, and suitable for highly scalable distributed applications, it is certainly attracting a lot of crowd towards itself.</p><p>Being developed to overcome the shortcomings of other languages, Go is designed differently from many other languages. Go has a mixed flavor of different programming languages. Even though Go is not an OOP language, the authors of Golang have made it possible to implement useful and less complex OOP patterns in golang as well.</p><p>Polymorphism is one of the basic principles of Object-Oriented Programming.</p><p>Since this is a blog on understanding <strong>Polymorphism in Go</strong>, I will explain the remaining principles of OOP. I’ll attach the links to the blogs at the bottom.</p><h3><strong>What is Polymorphism?</strong></h3><p><strong><em>Polymorphism means that a piece of code changes its behavior depending on the concrete data it’s operating on</em>.</strong> This was said by Tom Kurtz, who is the inventor of BASIC and this is the definition that perfectly fits in the case of Go.</p><p><strong>Other Definitions :</strong></p><p>Polymorphism means “<strong>Same name many forms”</strong>.</p><p>Polymorphism is considered one of the important features of Object-Oriented Programming. Polymorphism allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations.</p><p><strong>Characteristics of Polymorphism :</strong></p><ol><li>The functionality of a method behaves differently in different scenarios.</li><li>The behavior of a method depends on the data provided.</li><li>It allows the same name method with different types.</li><li>Polymorphism supports implicit type conversion.</li></ol><h3>How it is different in Go?</h3><h4><strong>When talking in terms of programming languages like Java :</strong></h4><p>Like any other Object Oriented Programming language, Polymorphism in Java can be implemented in 2 ways :</p><p><strong>1. Runtime Polymorphism: </strong>It is a process in which a function call to the overridden method is resolved at Runtime. This type of polymorphism is achieved by Method Overriding.</p><p><strong><em>Method overriding</em>:</strong> Occurs when a derived class has a definition for one of the member functions of the base class. That base function is said to be overridden.</p><p>2. <strong>Compile time Polymorphism: </strong>In this type of polymorphism, the compiler is able to know which exact functions will be executed for a particular cal. It is also known as static polymorphism. This type of polymorphism is achieved by function overloading or operator overloading.</p><p><strong><em>Method Overloading:</em></strong> When there are multiple functions with same name but different parameters then these functions are said to be <strong>overloaded</strong>. Functions can be overloaded by a <strong>change in the number of arguments</strong> or/and a <strong>change in the type of arguments</strong>.</p><h4><strong>When talking in terms of Go programming language :</strong></h4><p>When I mentioned earlier that the authors made it possible to implement OOP concepts which would not increase the complexity of the language, I was referring to polymorphism there.</p><blockquote><strong><em>Compile-time polymorphism is not possible in Golang. It only has Runtime Polymorphism.</em></strong></blockquote><p><strong>Method Overloading</strong> in golang results in error. Look at the example below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e290725ee9b8f36e04cee78beda2b48/href">https://medium.com/media/7e290725ee9b8f36e04cee78beda2b48/href</a></iframe><pre>#Output from above program</pre><pre>./method_overloading.go:11:6: Area redeclared in this block<br> previous declaration at ./method_overloading.go:6:36</pre><p>Though there are some workarounds to implement <strong>method overloading in golang using variadic function and empty interface, </strong>I think there is a reason why the authors did not provide the functionality. So for now we are not going to discuss it.</p><p>Still, if you are too curious to control yourself from googling, <a href="https://golangbyexample.com/function-method-overloading-golang/"><strong>click here</strong></a> to find the alternate way to implement method overloading.</p><p><strong>Operator Overloading</strong> is also not supported in Golang. The reason for this is stated in faq of go - <a href="https://golang.org/doc/faq#overloading">https://golang.org/doc/faq#overloading</a></p><blockquote>Method dispatch is simplified if it doesn’t need to do type matching as well. Experience with other languages told us that having a variety of methods with the same name but different signatures was occasionally useful but that it could also be confusing and fragile in practice. Matching only by name and requiring consistency in the types was a major simplifying decision in Go’s type system.<br>Regarding operator overloading, it seems more a convenience than an absolute requirement. Again, things are simpler without it.</blockquote><h4><strong>Runtime Polymorphism in Go :</strong></h4><p>In Runtime Polymorphism, the method is resolved at runtime.<br>In Golang, runtime polymorphism is implemented using<strong> Interfaces.</strong></p><p>Interfaces in golang are quite different from other languages like Java where a class has to explicitly state that it implements an interface using the <strong>implements</strong> keyword.<br> <strong>Go interfaces are implemented implicitly if a type provides the definition for all the methods declared in the interface.</strong></p><p>A variable of an interface type can contain value of any type which implements the interface. This is the property that helps in achieving polymorphism in the Go language</p><p><strong>Objects of different types are treated in a consistent way, as long as they stick to a single interface, which is the essence of polymorphism.</strong></p><h3>Let’s look at an example :</h3><p>We will not be looking at any typical examples today. Let’s see how golang itself uses the interfaces and how we can achieve polymorphic behavior from one of its own packages.</p><p>Everyone must have used the <strong>errors</strong> package from golang.<br>And must have also used the <strong>Error </strong>method to display the in <strong>string format</strong>.</p><p>Let’s see the contents of <a href="https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/errors/errors.go"><strong>errors.go</strong></a> file in golang <strong>errors</strong> package.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/326ca16fd0a5355282a89d81370cb1c7/href">https://medium.com/media/326ca16fd0a5355282a89d81370cb1c7/href</a></iframe><p>The errors.go file simply has 3 things.<br>1.<strong> errorString </strong>type, which consists of a string typed field that would hold the error message.<br>2. <strong>Error</strong> method, which returns the error message string.<br>3. <strong>New </strong>function, has return type <strong>error interface.</strong></p><pre>// The error built-in interface type is the conventional interface // for representing an error condition, with the nil value //representing no error.</pre><pre>type error interface {<br>    Error() string<br>}</pre><p>Above is the declaration of error interface in go’s <a href="https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/builtin/builtin.go;l=259"><strong>builtin package</strong></a>.</p><p>Now, as you can see in a <strong>New function in errors.go file</strong>, it is returning <strong>errorString</strong> object. It was able to do so because, <strong>errorString </strong>object provides <strong>Error </strong>method definition, which makes it implicitly implement the <strong>error </strong>interface.</p><p>Let’s see how we generally use the error package to generate errors.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5acdc865d3b5efd13d9a2be0e93fcec3/href">https://medium.com/media/5acdc865d3b5efd13d9a2be0e93fcec3/href</a></iframe><pre>#output of above code<br>it&#39;s an error</pre><p>Pretty simple, right!<br>Now if I don&#39;t want to use the same way to display errors. I want to use my own way of displaying errors. Let’s try it then.</p><p>We will look at how we can implement the same behavior in our code and see how we can define our own customized error message by defining our own <strong>Error</strong> method. And at the end how polymorphism is achieved in this particular case.</p><h4><strong>Let’s understand the example below</strong></h4><p>The code has an interface type <strong>error. </strong>The interface<strong> </strong>contains a method <strong>Error</strong>.</p><p>In the code below, we have used 2 types for structuring error messages. 1.<strong>errorString</strong> with a field s of type string for the error message.<br>2.<strong>MyError </strong>with field ErrorSeverity &amp; ErrorMessage, which will hold the severity of the error and error message.</p><p>Both these types have respective <strong>Error</strong> methods in order to return error messages in different ways.</p><p>We have another function in the program, <strong>printError.<br></strong>This function takes the input argument of the type <strong>error interface </strong>and calls the <strong>Error</strong> method on the passed argument resulting error message.</p><p>Based on the concrete type of the error interface, different <strong><em>Error()</em></strong> methods will be called. So, we achieved polymorphism in the <strong><em>printError()</em></strong> function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a22250aba3330098610400790ba5f74e/href">https://medium.com/media/a22250aba3330098610400790ba5f74e/href</a></iframe><pre>#output of above code</pre><pre>Default Error function called from errors package</pre><pre>Error_Severity: FATAL    Error_Message: Customized Error Function called from current package with error severity</pre><p>If you add another concrete type in this program that implements <strong>error interface</strong> this <strong><em>Error()</em></strong> function will print a customized error message without any change due to polymorphism.</p><blockquote>The very first definition which we saw above, fits perfectly here.</blockquote><blockquote><strong><em>Polymorphism means that a piece of code changes its behavior depending on the concrete data it’s operating on</em>.</strong></blockquote><h4>Conclusion :</h4><p>When working on Go, it is very important to have a good understanding of how interfaces work and how we can leverage the power of interfaces to get things done. Hope this blog helped you by providing a clear understanding of how polymorphic behavior can be achieved using interfaces.</p><p>Thank You!</p><p><strong>Encapsulation</strong>: <a href="https://sagarsonwane230797.medium.com/understanding-encapsulation-in-go-ac575813c3ad">https://sagarsonwane230797.medium.com/understanding-encapsulation-in-go-ac575813c3ad</a></p><h4><strong>References :</strong></h4><p><a href="https://www.geeksforgeeks.org/polymorphism-in-java/">Polymorphism in Java - GeeksforGeeks</a></p><p><strong>github-repo:</strong> <a href="https://github.com/sagar23sj/Go-OOP/tree/main/Encapsulation">https://github.com/sagar23sj/Go-OOP/tree/main/</a>Polymorphism</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d704944e9816" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Encapsulation in Go]]></title>
            <link>https://sagarsonwane230797.medium.com/understanding-encapsulation-in-go-ac575813c3ad?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac575813c3ad</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[encapsulation]]></category>
            <category><![CDATA[data-hiding]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Mon, 30 Aug 2021 12:52:42 GMT</pubDate>
            <atom:updated>2021-09-16T08:01:37.512Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ak_aQv5ZTI6rjMdEgAxNdQ.jpeg" /></figure><p>Since C++ is the very first programming language i learnt followed by java and ruby, I often find myself looking to implement OOP patterns in every other language. So now as I have started using Go, the first thing I look for is how to implement OOP patterns.</p><p>Go is a Post-OOP Programming language that borrows its structure (packages, types, functions) from the Algol/Pascal/Modula language family. Even though it is not OOP and more of a Procedural language, the authors of Golang have made it possible to implement useful and less complex OOP patterns in golang as well.</p><p>Since this is a blog on understanding <strong>encapsulation</strong>, we will look at the rest of the OOP principles in some other blogs.</p><h3><strong>What is Encapsulation?</strong></h3><p>Encapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code and the data it manipulates. Another way to think about encapsulation is, it is a protective shield that prevents the data from being accessed by the code outside this shield.</p><h3><strong>How it is different in Go?</strong></h3><p><strong>When talking in terms of programming languages like Java :</strong></p><ul><li>Technically in encapsulation, the variables or data of a class is hidden from any other class and can be accessed only through any member function of its own class in which it is declared.</li><li>In encapsulation, the data in a class is hidden from other classes using the data hiding concept which is achieved by making the members or methods of a class private. Access modifiers like <strong>public</strong>, <strong>private</strong> &amp; <strong>protected</strong> are used to restrict access.</li><li>Encapsulation can be achieved by Declaring all the variables in the class as private and writing public methods in the class to set and get the values of variables</li></ul><p><strong>When talking in terms of Go programming languages :</strong></p><p>Go being different from classical OOP languages, it doesn’t have a concept of classes, objects &amp; access modifiers in it, instead it has a concept of package.<br>Go achieves encapsulation by <strong>Exported and Unexported Identifiers</strong>.</p><p>I remember, when I started learning golang I asked a friend this question, <br><strong>Why are we declaring type, function, or variables with first letter Uppercase sometimes and Lowercase sometimes?</strong></p><p>He answered, whenever we Capitalize the first letter of an identifier, it is accessible to any piece of code that wants to use it i.e <strong>identifier is public</strong> and when the first letter of an identifier is Lowercase, it is only accessible to the package it is declared within i.e <strong>identifier is private</strong>.</p><p>Right term to use here is <strong>Exported &amp; Unexported Identifiers. <br></strong>First letter Capitalized or Exported i.e accessible outside package and <br>First letter Lowercase or Unexported i.e accessible within package only.</p><p>While programming in Java or Cpp, I used to get confused many times in public, private &amp; protected but in Golang it is pretty simple to understand how the concept of data hiding works by exporting/unexporting identifiers.</p><p>One more thing to understand here is, <strong>when we say identifier is inaccessible outside the package it just means it is inaccessible directly</strong>. We can still access the identifier indirectly outside the package. We will see this later in the blog.</p><p><strong>P.S.</strong> - Identifiers are names given to different entities such as constants, variables, structures, functions, etc.</p><h3>Let’s look at some code</h3><p><strong>Following is a simple example of an exported type in Go</strong></p><p>Here, in the package counter, we have defined a named <strong>type Count</strong>, which is a type alias for primitive type int. Since the first letter of our new type Count is Capitalized, that means it is exported and can be accessed by other packages.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2de8f58382d152cdd7eba72a776f461a/href">https://medium.com/media/2de8f58382d152cdd7eba72a776f461a/href</a></iframe><p>The program above is in main package and is accessing the Count type in main.go <br>Since the Count type is exported, the program runs without any error.</p><pre># Output of the above code</pre><pre>Value of the Counter :  100</pre><p><strong>Now, let’s take a look at what happens when we try to use the unexported identifier in a different package.</strong></p><p>Here, in package counter, we have defined a named <strong>type</strong> <strong>internalCounter</strong>, which is a type alias for primitive type int. Since the first letter of our new type internalCounter is Lowercase, that means it is unexported and cannot be accessed by other packages.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd1131c05fe2dfb34622d1730f292c3f/href">https://medium.com/media/fd1131c05fe2dfb34622d1730f292c3f/href</a></iframe><p>The program above is in main package and is accessing the internalCounter type in main.go <br>Since internalCounter type is unexported, the program will throw the following error when we try to run it.</p><pre>./main.go:19:19: cannot refer to unexported name counter.internalCounter<br>./main.go:19:19: undefined: counter.internalCounter</pre><p>Like we discussed above, Unexported identifiers cannot be accessed by other packages which led to the error in our 2nd program.</p><p><strong>Now, as i mentioned above there is an indirect way to access these kind of identifiers. We can write Exported method/functions which will act as getter and setter for the unexported type.</strong></p><p>Here, we have added one Exported method NewInternalCounter which created and returns value of internalCounter type.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0fa8b445b4fc9312c43cbb36b57772c2/href">https://medium.com/media/0fa8b445b4fc9312c43cbb36b57772c2/href</a></iframe><p>The program above is in main package and is accessing the internalCounter type now indirectly by NewInternalCounter function in main.go <br>Since the NewInternalCounter type is exported, the program will run without any error.</p><pre># output of the above code<br>Value of the Internal Count :  10</pre><p><strong>Now, let us look at how Exporting/Unexporting can be useful when working with struct types.</strong></p><p>Exporting/Unexporting works similar in case of structs. If a member field or method name starts with Uppercase letter then that member is exported and can be accessed by other packages. If a member field or method name starts with Lowercase letter then that member is unexported and can only be accessed within that package.</p><h3>Let’s look at some code</h3><p>Below you can see an exported struct type Employee with both exported and unexported fields.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dacbd3b8a92fe21cdad1d9003b890acc/href">https://medium.com/media/dacbd3b8a92fe21cdad1d9003b890acc/href</a></iframe><p>The program above is in main package and is accessing the Employee type in main.go. Here, even though the Employee type is exported but one of its field <strong>salary </strong>is unexported, the program will throw the following error when we try to run it.</p><pre>./main.go:36:3: cannot refer to unexported field &#39;salary&#39; in struct literal of type employee.Employee</pre><p>Now in order to make our code work, we will make add one method on the Employee struct <strong>SetSalary </strong>which will do the work of setting the value of unexported field salary.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/78a17855ae67c058b03432365d0350b3/href">https://medium.com/media/78a17855ae67c058b03432365d0350b3/href</a></iframe><p>In the main.go file, we have just called the <strong>SetSalary method</strong> on the <strong>emp</strong> object to set the unexported field salary. This program will work without any errors.</p><pre># output of above code<br>Employee Details : {James 33 1.111111e+06}</pre><p><strong>Now let’s look at in case of struct embedding.</strong></p><p>In this new example, we have used 2 exported types Animal is embedded and Dog is embedee. Now all the fields of Animal are now also a part of Dog, which means Dog type has now 3 exported fields.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e074e5e894dd2ca542076643f2beb801/href">https://medium.com/media/e074e5e894dd2ca542076643f2beb801/href</a></iframe><p>In main.go, we have created an object of exported Dog type. When the program is run, it will give the following output.</p><pre>#output of above code<br>Details of Dog : {Animal:{Name:Bruno} NoOfLegs:4}</pre><p>Now, let’s make a change and make the animal type unexported by making the first letter of the type definition lowercase. The Exported type Dog has now a field animal unexported. Here, we keep the fields of the animal type exported.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a70cb33a4652e49a5ae9b46915f5c350/href">https://medium.com/media/a70cb33a4652e49a5ae9b46915f5c350/href</a></iframe><p>When we run the above main.go program, it will result in the following error since we are trying to set an unexported field.</p><pre>./main.go:59:3: cannot refer to unexported field &#39;animal&#39; in struct literal of type animal.Dog<br>./main.go:59:13: cannot refer to unexported name animal.animal</pre><p><strong>But there is a catch here. We can make this work by doing just one simple thing i.e by initializing the exported fields from the unexported embedded type outside of the composite literal.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/255611a74eb8d56f7a67a07b42a006e8/href">https://medium.com/media/255611a74eb8d56f7a67a07b42a006e8/href</a></iframe><p>The exported fields that were embedded into the Dog type from the animal type are accessible, even though they came from an unexported type. The exported fields keep their exported status when the type is embedded.<br>This is the reason, our program was able to run eithout errors.</p><pre>#output of above code<br>Details of Dog : {animal:{Name:Maggie} NoOfLegs:4}</pre><p>While reading this blog, you can also look at <strong>time.Time type</strong> in the standard library in order to understand how its internals uses the concept of data accessibility.</p><h3>Conclusion :</h3><p>When working on Go, it is very important to have a good understanding of how to hide and provide access to data from packages. Hope this blog helped you by providing a clear understanding of exported &amp; unexported identifiers.</p><p>Thank You!</p><p>Read about another principle of Object-Oriented Programming :<strong><br>Understanding Polymorphism in Go</strong> : <a href="https://sagarsonwane230797.medium.com/understanding-polymorphism-in-go-d704944e9816">https://sagarsonwane230797.medium.com/understanding-polymorphism-in-go-d704944e9816</a></p><p><strong>References : <br></strong><a href="https://www.geeksforgeeks.org/encapsulation-in-java/">https://www.geeksforgeeks.org/encapsulation-in-java/</a><br><strong>github-repo:</strong> <a href="https://github.com/sagar23sj/Go-OOP/tree/main/Encapsulation">https://github.com/sagar23sj/Go-OOP/tree/main/Encapsulation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac575813c3ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate Slack Notification With Github-Actions]]></title>
            <link>https://sagarsonwane230797.medium.com/automate-slack-notification-with-github-actions-4675862713cc?source=rss-152a7a26f299------2</link>
            <guid isPermaLink="false">https://medium.com/p/4675862713cc</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[cicd-tools]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[slack-notification]]></category>
            <category><![CDATA[slackbot]]></category>
            <dc:creator><![CDATA[Sagar Sonwane]]></dc:creator>
            <pubDate>Sat, 26 Jun 2021 08:51:35 GMT</pubDate>
            <atom:updated>2021-06-26T09:40:03.060Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*-isfhvFYOjKSyT3VqdaaVg.png" /></figure><p>This particular blog is a continuation of a previously written blog that covered the basics of github actions and a working demo of setting up github actions for running build checks when some code is pushed or PR is raised in your github project.</p><blockquote><strong>Automate Build Checks With Github-Actions :</strong> <a href="https://sagarsonwane230797.medium.com/automate-build-checks-and-slack-notification-with-github-actions-3b7eb702dae6">https://sagarsonwane230797.medium.com/automate-build-checks-and-slack-notification-with-github-actions-3b7eb702dae6</a></blockquote><p>In this blog, we will be covering how to send a slack notification after a PR is raised which passes all the build checks.</p><h3>Setting Up Slack Notification after All check are passed on Pull Request :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4XShNF1NDtuBwe65.png" /><figcaption>slack channel with a message from bot</figcaption></figure><p><strong>The configuration below is used to get the slack notification in the above format.</strong></p><p>There are several steps you need to perform to set up slack-bot in your slack workspace to get notifications after PR is raised which passes all checks.</p><p><strong>Step 1:</strong> <strong>Create New App</strong> for our slack workspace</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IKBZB4aqAn-qN6Wg.png" /><figcaption>create new app on slack page</figcaption></figure><p>Click on <strong>Create New App.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9p0lJlFtVPB5abhv.png" /><figcaption>setting up name of the app and selecting workspace to integrate with</figcaption></figure><p>Set an <strong>App Name</strong> for your app to which I’ve set <strong>Github-Actions</strong> and Select the workspace (mine is <strong>integrations</strong>) you need to integrate your app with.<br>Then click on <strong>Create App.</strong></p><p><strong>Step 2: Assign Permissions to Slack Bot.</strong></p><p>Navigate to <strong>App Home </strong>on the left sidebar. Click on <strong>Review Scopes to Add</strong> to set permissions for our bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6FENkESlkdqlK0nb.png" /><figcaption>adding permissions to slack bot</figcaption></figure><p>Click on <strong>Add an OAuth Scope</strong> and select appropriate permissions.<br>Since our bot just needs to write on the slack channel, so I have provided only 2 permission <strong>channels:join</strong> and <strong>chat:write</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/0*Bbi4VvRMx4SzNbXe.png" /><figcaption>selecting permissions for bot</figcaption></figure><p><strong>Step 3: Install our Bot to the Workspace</strong></p><p>Now, navigate to <strong>OAuth &amp; Permissions </strong>and Click on <strong>Install to Workspace</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fr4iKcUNPZ2Hvqx5.png" /><figcaption>install slack app on workspace</figcaption></figure><p>Click on <strong>Allow</strong> when redirected to the authorization page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BwO8T4GZENwW0tMj.png" /><figcaption>bot asking permission to access slack workspace</figcaption></figure><p>Now, our slack bot is ready to operate on the workspace we have integrated it with. You will be redirected to the OAuth &amp; Permissions page again where you can see now a <strong>Bot User OAuth Token</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uAdjJeUJ8MoAdQbT.png" /><figcaption>generated bot user OAuth token</figcaption></figure><p>Copy this Token and Save this in your <a href="https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository"><strong>github repository secrets</strong></a>. Go to <strong>Settings -&gt; Secrets </strong>&amp; save the token under the name <strong>SLACK_BOT_TOKEN.<br></strong>We will be using this in gihtub workflow file.</p><p><strong>Step 4: Invite Bot to Channel</strong></p><p>We will now invite Slack Bot to the channel we need to get the notifications.<br>I have created a separate channel <strong>“demo-project_pull-requests” </strong>and send this message on channel <strong>/invite @bot-name.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tzVRsMvrd7FWmRX4.png" /><figcaption>inviting bot to channel where we want to get notifications</figcaption></figure><p>With this, we have finished setting up a slack bot for getting the notifications.</p><p><strong>Step 5: Setup Job in Github Actions Workflow</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kxHj_BmvUuZOjvYi.png" /><figcaption>setting up job for sending slack notification</figcaption></figure><p>The above job uses a pre-existing Github Action i.e <a href="https://github.com/marketplace/actions/post-slack-message"><strong>Post Slack Messages</strong></a><strong>.<br></strong>I have embedded the <strong>build-workflow.yml</strong> file at the end for you to fully see the contents.</p><p>Here, <strong>notify</strong> job is linked to the <strong>build</strong> job i.e if the build job successfully runs then only notify job will be trigerred.</p><blockquote><strong>Note:</strong> <strong><em>needs</em></strong> tag identifies any jobs that must complete successfully before this job will run. It can be a string or an array of strings. If a job fails, all jobs that need it are skipped unless the jobs use a conditional expression that causes the job to continue.</blockquote><p>Two important fields to focus on in image above:<br>1. <strong>env.SLACK_BOT_TOKEN: </strong>It will be used to communicate with slack.<br>2. <strong>with.args: </strong>It is used to configure payload to the slack API. It includes 2 main things.</p><p><strong>a]</strong> <strong>channel </strong>holds the value of your slack <strong>Channel ID.<br></strong>In the image below in the URL bar, you can see the last value(underlined) that is the <strong>Channel ID.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c_tALDo9bQ7Ck5SY.png" /><figcaption>example image of received slack message from bot</figcaption></figure><p>We will go ahead and store the Channel ID in github secrets in our project repository under the name <strong>SLACK_PR_CHANNEL_ID.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fB1v5LLi5dP-rQUy.png" /><figcaption>github page with repository secrets</figcaption></figure><p>In the above image you can see we have set 2 secrets which are :<br>1. <strong>SLACK_BOT_TOKEN: </strong>bot token used to communicate with slack.<br>2. <strong>SLACK_PR_CHANNEL_ID</strong>: Channel ID to our slack channel where notifications will be sent.</p><p><strong>b]</strong> <strong>blocks</strong> is our actual message to the slack channel. In <strong>with.args, </strong>the value of <strong>blocks</strong> is stringified and escaped.</p><p>Generally, the payload looks like in the image below.</p><pre>{<br>   &quot;<strong>channel</strong>&quot;:&quot;${{ secrets.SLACK_PR_CHANNEL_ID }}&quot;,<br>   &quot;<strong>blocks</strong>&quot;:[<br>      {<br>         &quot;type&quot;:&quot;section&quot;,<br>         &quot;text&quot;:{<br>            &quot;type&quot;:&quot;mrkdwn&quot;,<br>            &quot;text&quot;:&quot;*Pull Request:* ${{ github.event.pull_request.title }}&quot;<br>         }<br>      },<br>      {<br>         &quot;type&quot;:&quot;section&quot;,<br>         &quot;text&quot;:{<br>            &quot;type&quot;:&quot;mrkdwn&quot;,<br>            &quot;text&quot;:&quot;*Contributor :* ${{ github.event.pull_request.user.login }} *Request State:* ${{ github.event.pull_request.state }}&quot;<br>         }<br>      },<br>      {<br>         &quot;type&quot;:&quot;section&quot;,<br>         &quot;text&quot;:{<br>            &quot;type&quot;:&quot;mrkdwn&quot;,<br>            &quot;text&quot;:&quot;&lt;${{ github.event.pull_request.html_url }}|View Pull Request&gt;&quot;<br>         }<br>      }<br>   ]<br>}</pre><p><strong>Success ( slack notification sent ) :</strong> <a href="https://github.com/sagar23sj/github-workflow-demo/actions/runs/921996014">https://github.com/sagar23sj/github-workflow-demo/actions/runs/921996014</a></p><h3><strong>Alternate setup for slack notification:</strong></h3><p><strong><em>Note:</em></strong><em> Choose the configuration based on the format you choose to send the slack message. If you think the format which we just saw above is good enough for you, then you can skip this part.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/0*YJ07UmDAsVzDGAK-.png" /><figcaption>An alternative format of the slack message</figcaption></figure><p><strong>The configuration below is used to get a slack notification in the above format.</strong></p><p>For this you need to do 2 things :</p><p><strong>1.</strong> Create Incoming Webhook URL on slack. <a href="https://api.slack.com/messaging/webhooks#getting_started"><strong>Incoming webhooks</strong></a> are a simple way to post messages from external sources into Slack. You will get the below page at the end where you will find the Webhook URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/0*tsDs5tSwhI9zB6FR.jpeg" /><figcaption>slack page with created webhook url</figcaption></figure><p><strong>2.</strong> Save the Slack Webhook URL in your <a href="https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository"><strong>github secrets</strong></a><strong>. Settings-&gt;Secrets </strong>under the name <strong>SLACK_WEBHOOK_URL.</strong></p><p><strong>3. </strong>Setup Job in Github Actions Workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hH3CdoMnxqZHSwUK.png" /><figcaption>setting up a job for slack notification in an alternative format</figcaption></figure><p>The above job uses a pre-existing Github Action i.e <a href="https://github.com/marketplace/actions/action-slack"><strong>action-slack</strong></a><strong>.<br></strong>I have embedded the <strong>build-workflow.yml</strong> file below for you to fully see the contents. You can replace the existing configuration for <strong>notify </strong>job with the above configuration to get a slack message in the alternative format.</p><h3>Github action workflow file</h3><p>This workflow file contains a build checks job(<strong>build</strong>) following the slack notification job(<strong>notify</strong>).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db8b4b37918cf8ea972833e3f4c4217b/href">https://medium.com/media/db8b4b37918cf8ea972833e3f4c4217b/href</a></iframe><p>You can find Part-1 of this blog which covers<strong> Automate Build Checks With Github-Actions</strong>, at the link below<strong>.<br></strong><a href="https://sagarsonwane230797.medium.com/automate-build-checks-and-slack-notification-with-github-actions-3b7eb702dae6"><strong><em>https://sagarsonwane230797.medium.com/automate-build-checks-and-slack-notification-with-github-actions-3b7eb702dae6</em></strong></a></p><p><strong>Conclusion: </strong>In the end, I just hope this helped you with setting up Github Actions and automate slack notification for your project.</p><p>Thank You for reading this blog.</p><p><strong>References :</strong></p><blockquote><strong><em>Demo-Application-Repo </em></strong><em>: </em><a href="https://github.com/sagar23sj/github-workflow-demo"><em>https://github.com/sagar23sj/github-workflow-demo</em></a><strong><em><br>Github-Actions : </em></strong><a href="https://docs.github.com/en/actions"><em>https://docs.github.com/en/actions</em></a><em><br></em><strong><em>Slack-Notification :<br>primary </em></strong><em>— </em><a href="https://github.com/marketplace/actions/post-slack-message"><em>https://github.com/marketplace/actions/post-slack-message</em></a><em><br></em><strong><em>alternative </em></strong><em>— h</em><a href="https://github.com/marketplace/actions/action-slack"><em>ttps://github.com/marketplace/actions/action-slack</em></a><em><br></em><strong><em>slack-bot setup</em></strong><em> — </em><a href="https://spacejelly.dev/posts/how-to-use-github-actions-to-automate-tests-and-slack-notifications/"><em>https://spacejelly.dev/posts/how-to-use-github-actions-to-automate-tests-and-slack-notifications/</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4675862713cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>