<?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 Islemothmani on Medium]]></title>
        <description><![CDATA[Stories by Islemothmani on Medium]]></description>
        <link>https://medium.com/@islemothmani127?source=rss-f8fa269cfb32------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WzVFFUWc3nLF5zarHBH9ng.jpeg</url>
            <title>Stories by Islemothmani on Medium</title>
            <link>https://medium.com/@islemothmani127?source=rss-f8fa269cfb32------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:23:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@islemothmani127/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[Understanding GitOps Through a Real DevOps Ticket]]></title>
            <link>https://medium.com/@islemothmani127/understanding-gitops-through-a-real-devops-ticket-ddd3ac177f77?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddd3ac177f77</guid>
            <category><![CDATA[gitops-with-argocd]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[argo-cd]]></category>
            <category><![CDATA[gitops]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 11:08:57 GMT</pubDate>
            <atom:updated>2026-07-13T11:08:57.299Z</atom:updated>
            <content:encoded><![CDATA[<p>I received what looked like a simple DevOps ticket:</p><p>“There’s an ArgoCD application called x-backend running in the cluster that nobody can see in Git.”</p><p>At first glance I understood almost none of it. What is an ArgoCD Application? Why is Git involved in deployments? Why is having an app outside Git considered dangerous?</p><p>Instead of simply completing the task, I decided to understand every concept behind it. This article is everything I learned while solving that ticket.</p><h3>1 The Problem:</h3><p>Current Situation:</p><pre>Git<br>└── No x-backend<br>Cluster<br>└── x-backend</pre><p>Problem:<br>Git and the cluster don’t match, but GitOps says Git should describe everything running inside Kubernetes.</p><p>GitOps follows one simple principle: <strong><em>Everything running in Kubernetes should be described in Git.</em></strong></p><p>Git becomes the <strong>single source of truth</strong>.If something exists only inside the cluster, several problems arise.</p><h3>2 The Technologies Behind the Ticket:</h3><p>Before solving the ticket, I needed to understand every technology involved and why it exists.</p><h4>Docker</h4><p>Imagine developing an application on your laptop. Everything works perfectly. Then you send it to another developer. Suddenly nothing works.</p><p>Maybe your machine has Python 3.12 while theirs has Python 3.10. Maybe you’re using different libraries or operating systems.</p><p>Docker solves this problem by packaging an application together with everything it needs:</p><ul><li>Operating system libraries</li><li>Runtime</li><li>Dependencies</li><li>Configuration</li><li>Application code</li></ul><p>This package is called a <strong>container image</strong>.</p><p>Now the application behaves the same everywhere. Whether it runs on your laptop, a testing server, or production, the environment remains consistent.</p><h4>Kubernetes: Managing Containers at Scale</h4><p>Docker packages applications. Kubernetes manages them.</p><p>Imagine running one container manually.</p><p>That’s easy.</p><p>Now imagine running:</p><ul><li>200 containers</li><li>Across 20 machines</li><li>Automatically replacing failed containers</li><li>Scaling traffic during busy hours</li><li>Updating applications without downtime</li></ul><p>Doing this manually would quickly become impossible.</p><p>Kubernetes automates all of it. It continuously watches your applications and asks:<em>“Is the system in the state you wanted?”</em></p><p>If not, it fixes it automatically.</p><h4>What Is a Cluster?</h4><p>A <strong>cluster</strong> is simply a group of machines working together. Instead of deploying your application to one server, Kubernetes manages many servers as one system.</p><p>The cluster contains:</p><ul><li><strong>Control Plane</strong>: the brain that makes decisions.</li><li><strong>Worker Nodes</strong>: the machines that actually run applications.</li></ul><pre>Cluster<br><br>├── Control Plane<br>│<br>├── Worker Node 1<br>│     └── Pods<br>│<br>├── Worker Node 2<br>│     └── Pods<br>│<br>└── Worker Node 3<br>      └── Pods<br></pre><h4>What Is a Pod?</h4><p>A Pod is the smallest unit Kubernetes deploys.</p><p>Usually, one Pod contains one application container.</p><pre>Pod<br><br>└── Docker Container<br><br>        └── Backend API</pre><p>If the application crashes, Kubernetes creates a new Pod automatically.</p><h4>Namespaces: Organizing the Cluster</h4><p>Imagine placing every application in one giant folder. Soon, finding anything would become chaotic. Namespaces divide a cluster into logical sections.</p><p>example:</p><pre>default<br><br>development<br><br>staging<br><br>production<br><br>monitoring</pre><h4>YAML: The Language Kubernetes Understands:</h4><p>Kubernetes is configured using YAML files. YAML is simply a human-readable way to describe infrastructure. Instead of clicking buttons in a dashboard, we write:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br><br>metadata:<br>  name: backend</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/0*R2iSTtNPU5YP5ecY.png" /></figure><h4>Helm: Reusing Kubernetes Configurations</h4><p>Writing Kubernetes YAML from scratch becomes repetitive. Helm solves this by introducing reusable templates called <strong>charts</strong>. Instead of copying hundreds of YAML lines, you define variables such as:</p><pre>image:<br>  repository: backend<br><br>replicaCount: 3</pre><p>Helm generates the final Kubernetes manifests based on these values.</p><p>It is often described as the <strong>package manager for Kubernetes</strong>, similar to how npm manages JavaScript packages.</p><h4>GitOps: Git Becomes the Source of Truth</h4><p>Traditionally, someone might deploy manually:</p><pre>Developer<br>↓<br>kubectl apply</pre><p>The problem?</p><p>Nobody knows exactly what changed. GitOps changes the workflow.</p><p>Now every infrastructure change must first be committed to Git.</p><pre>Developer<br>↓<br>Git Repository<br>↓<br>Cluster</pre><p>Git becomes the official description of the desired infrastructure.</p><p>If Git says three Pods should exist, then the cluster should also have three Pods.</p><h4>Argo CD: Keeping Kubernetes in Sync</h4><p>Git describes the desired state. But who makes sure the cluster actually matches Git?</p><p>That’s Argo CD’s job.</p><p>Argo CD constantly watches Git. If they differ, Argo CD synchronizes the cluster automatically. It also detects manual changes made directly in Kubernetes and can revert them to match Git. This ensures deployments remain consistent and predictable.</p><h4>What Is an Argo CD Application?</h4><p>An Argo CD Application tells Argo CD:</p><ul><li>Which Git repository to watch.</li><li>Which folder contains the manifests.</li><li>Which Kubernetes cluster to deploy to.</li><li>Which namespace to use.</li></ul><p>A simplified example looks like this:</p><pre>repoURL: https://github.com/company/microservice-helmcharts<br>path: applications/dev/backend<br>targetRevision: main<br><br>destination:<br>  namespace: backend-dev</pre><p>This resource is essentially the bridge between Git and Kubernetes.</p><h3>3 Understanding the Architecture:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u8PDs4LxqBjE5WfttnThcA.png" /></figure><h4>Each step has a clear responsibility:</h4><ul><li><strong>Developer</strong> writes code and infrastructure configuration.</li><li><strong>GitHub</strong> stores the application’s source code and Kubernetes manifests.</li><li><strong>Argo CD</strong> continuously watches the Git repository. When changes are detected, it compares Git with the current state of the cluster and synchronizes them if needed.</li><li><strong>Kubernetes</strong> receives the manifests and ensures the desired resources exist.</li><li><strong>Pods</strong> are created to run the actual application.</li></ul><p>This separation of responsibilities makes deployments reliable, repeatable, and easy to audit.</p><h3>4 How Argo CD Deploys an Application</h3><p>Now let’s follow a deployment from beginning to end.</p><h4>Step 1: Develop the Application</h4><p>A developer writes new code or updates an existing service.</p><h4>Step 2: Build a Docker Image</h4><p>The application is packaged into a Docker image using a Dockerfile.</p><h4>Step 3: Push the Image</h4><p>The image is uploaded to a container registry such as Docker Hub or GitHub Container Registry (GHCR).</p><h4>Step 4: Update the Kubernetes Configuration</h4><p>Instead of deploying manually, the developer updates the Kubernetes manifests or Helm values in the Git repository to reference the new image version.</p><h4>Step 5: Open a Pull Request</h4><p>The infrastructure change is reviewed by teammates before being merged. This review process helps catch mistakes early and keeps a record of why changes were made.</p><h4>Step 6: Merge the Changes</h4><p>Once approved, the Pull Request is merged into the main branch.</p><h4>Step 7: Argo CD Detects the Change</h4><p>Argo CD continuously monitors the Git repository. It notices that the manifests have changed and fetches the latest version.</p><h4>Step 8: Compare Desired and Actual State</h4><p>Argo CD compares the manifests stored in Git with the resources currently running in the Kubernetes cluster.</p><p>If they are different, the application is marked as <strong>OutOfSync</strong>.</p><h4>Step 9: Synchronization</h4><p>Argo CD applies the updated manifests to the cluster. Kubernetes performs the rollout, creating new Pods and replacing old ones if necessary.</p><h4>Step 10: The Application Is Updated</h4><p>The cluster now matches the desired state defined in Git, and Argo CD reports the application as <strong>Synced</strong> and <strong>Healthy</strong>.</p><h3>5 Understanding My Ticket</h3><p>With all of that knowledge, the original ticket suddenly became much clearer.</p><p>The problem wasn’t that the application was broken. It was that the deployment process violated GitOps principles.</p><p>The situation looked like this:</p><pre>Git Repository<br>└── No definition for x-backend<br><br>Kubernetes Cluster<br>└── x-backend is running</pre><p>This raised several questions:</p><ul><li>Who created the application?</li><li>Which configuration was used?</li><li>Can we recreate it if the cluster is rebuilt?</li><li>Has anyone manually modified it?</li><li>Is the running version still the one we expect?</li></ul><p>Without Git as the source of truth, the application became difficult to trust and maintain.</p><p>To resolve the issue, we first needed to determine whether x-backend was still required.</p><p>If it was, the application needed to be adopted into the GitOps workflow. If it was obsolete, it should be safely removed from the cluster.</p><h3>6 Solution</h3><p>Adopt the Application into GitOps</p><p>If the application was still needed, it should be brought under GitOps management.</p><p>The process would look like this:</p><pre>Create the Argo CD Application manifest<br>        ↓<br>Commit the manifest to Git<br>        ↓<br>Open a Pull Request<br>        ↓<br>Review and Merge<br>        ↓<br>Argo CD detects the new configuration<br>        ↓<br>Application is now managed through Git</pre><h3>7 Deploying a New Application with GitOps</h3><p>Understanding the theory is useful, but seeing the full workflow makes everything click.</p><p>Let’s walk through how a new application is typically deployed using GitOps.</p><h4>Step 1: Build Your Application</h4><p>Create your backend or frontend service as you normally would.</p><p>For example: backend-api</p><h4>Step 2: Containerize the Application</h4><p>Write a Dockerfile that defines how the application should be packaged into a container image.</p><h4>Step 3: Build and Push the Image</h4><p>Build the image locally and push it to a container registry such as Docker Hub or GitHub Container Registry (GHCR). This image will later be pulled by Kubernetes.</p><h4>Step 4: Create Kubernetes Manifests</h4><p>Define the resources your application needs, such as:</p><ul><li>Deployment</li><li>Service</li><li>Ingress</li><li>ConfigMap</li><li>Secret (referenced securely)</li></ul><p>These manifests describe the desired state of the application inside the cluster.</p><h4>Step 5: Create an Argo CD Application</h4><p>Create an Argo CD Application resource that tells Argo CD where to find the manifests and where to deploy them.</p><p>Key fields include:</p><ul><li>repoURL: the Git repository containing the manifests.</li><li>path: the directory within the repository where the manifests are stored.</li><li>targetRevision: the Git branch, tag, or commit to track.</li><li>project: the Argo CD AppProject that defines permissions.</li><li>destination.server: the target Kubernetes cluster.</li><li>destination.namespace: the namespace where the application will be deployed.</li><li>syncPolicy: defines whether synchronization is manual or automatic. Options like prune: true remove resources deleted from Git, while selfHeal: true restores resources if they are manually changed in the cluster.</li></ul><h4>Step 6: Add the Application to the Git Repository</h4><p>Place the new Application manifest in the appropriate directory, for example: argocd/applications/dev/</p><p>This keeps all Argo CD Applications organized by environment.</p><h4>Step 7: Update kustomization.yaml</h4><p>If the repository uses Kustomize, register the new Application by adding it to the resources section of kustomization.yaml.</p><p>Without this step, Kustomize will not include the new resource in the final manifests.</p><h4>Step 8: Open a Pull Request</h4><p>Submit your changes for review. This allows teammates to verify the configuration before anything reaches the cluster.</p><h4>Step 9: Merge the Pull Request</h4><p>Once approved, merge the changes into the main branch.</p><h4>Step 10: Let Argo CD Do the Work</h4><p>Argo CD detects the new commit, synchronizes the cluster, and deploys the application automatically.</p><p>No manual kubectl apply is required.</p><h3>8 Lessons I Learned</h3><p>This ticket taught me much more than how to use Argo CD. It changed the way I think about deployments and infrastructure.</p><p>Some of the key lessons I took away are:</p><ul><li>Git is not only a place to store application code. It can also describe and version infrastructure.</li><li>Kubernetes should not be managed manually in a production environment. Automation improves consistency and reduces human error.</li><li>Argo CD continuously enforces the desired state, making sure the cluster matches what is defined in Git.</li><li>GitOps provides traceability. Every change has an author, a review, and a history.</li><li>A deployment is only truly complete when it can be reproduced from Git without relying on undocumented manual steps.</li><li>Small YAML files may look simple, but they can control an entire deployment pipeline.</li></ul><p>Perhaps the biggest lesson was that understanding <strong>why</strong> a tool exists is often more valuable than memorizing <strong>how</strong> to use it. Docker solves environment inconsistencies. Kubernetes automates container orchestration. Git tracks changes. GitOps brings infrastructure under version control. Argo CD closes the loop by ensuring the cluster always reflects what Git describes.</p><p>Each tool builds upon the problem solved by the previous one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddd3ac177f77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I Learned This Week About Asynchronous Programming and the Python Event Loop]]></title>
            <link>https://medium.com/@islemothmani127/what-i-learned-this-week-about-asynchronous-programming-and-the-python-event-loop-5d86c5f7e5ae?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d86c5f7e5ae</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[asynchronous-programming]]></category>
            <category><![CDATA[event-loop]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Fri, 01 May 2026 22:15:54 GMT</pubDate>
            <atom:updated>2026-05-01T22:15:54.785Z</atom:updated>
            <content:encoded><![CDATA[<p>This week I focused on understanding asynchronous programming in Python and how the event loop works in practice. While I had used async/await before, I realized I was using it more like syntax than truly understanding what was happening under the hood.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vX0Vw3vC10DqAKQ-ycQ1CA.png" /></figure><h3>Moving Beyond Synchronous Thinking</h3><p>Coming from a synchronous mindset, I was used to code executing step by step: <em>one task finishes, then the next begins</em>. This model is simple, but it becomes inefficient when dealing with operations that involve waiting, such as database queries or network requests.</p><p>Asynchronous programming changes this model. <em>Instead of blocking execution while waiting, tasks can pause and allow other work to continue.</em> This is especially useful in backend systems where responsiveness matters.</p><h4>examples:</h4><p>Synchronous code:</p><pre>import time<br><br>def task(name):<br>    print(f&quot;{name} started&quot;)<br>    time.sleep(2)  # blocks everything<br>    print(f&quot;{name} finished&quot;)<br><br>task(&quot;A&quot;)<br>task(&quot;B&quot;)</pre><p>Asynchronous function (async def):</p><pre>import asyncio<br><br>async def task(name): #async def = “this function can pause”<br>    print(f&quot;{name} started&quot;)<br>    await asyncio.sleep(2)<br>    print(f&quot;{name} finished&quot;)</pre><h4>Understanding the Event Loop</h4><p>The key concept that tied everything together for me was the <strong>event loop</strong>.</p><p>I learned that the event loop is essentially the engine that drives asynchronous execution in Python. It continuously runs, checks for pending tasks, and decides which one should execute next. When a task reaches an await, it temporarily yields control back to the event loop, allowing other tasks to run.</p><p>This creates a cooperative system where multiple tasks can progress without blocking each other, even though Python itself is still running on a single thread in most cases.</p><p>example:</p><pre>import asyncio<br><br>async def task(name, delay):<br>    print(name, &quot;started&quot;)<br>    await asyncio.sleep(delay)<br>    print(name, &quot;finished&quot;)<br><br>async def main():<br>    await asyncio.gather(<br>        task(&quot;A&quot;, 2),<br>        task(&quot;B&quot;, 1),<br>        task(&quot;C&quot;, 3)<br>    )<br><br>asyncio.run(main())</pre><p>This example shows how Python can handle multiple tasks “at the same time” using an event loop.</p><p>We define a function called task. Each task:</p><ul><li>Prints a start message</li><li>Waits for a certain amount of time (simulating work)</li><li>Prints a finish message</li></ul><p>When Python reaches await, it temporarily pauses that task and gives control back to the event loop. This allows other tasks to run instead of blocking everything.</p><p>Inside main(), we use:</p><pre>await asyncio.gather(...)</pre><p>This tells Python to run all tasks concurrently. So instead of waiting for each task to finish one by one, they all start together.</p><p>Even though everything runs in a single thread, the event loop switches between tasks whenever one is waiting.</p><p>So the execution looks like this:</p><ul><li>Task A starts</li><li>Task B starts</li><li>Task C starts</li><li>Task B finishes first</li><li>Task A finishes next</li><li>Task C finishes last</li></ul><h3>Blocking vs Non-Blocking Behavior</h3><p>One of the most important insights I gained was the difference between blocking and non-blocking code.</p><p>Blocking operations freeze execution until they complete, while non-blocking async operations allow the program to stay active and switch between tasks. This distinction became much clearer once I saw how the event loop schedules work in the background.</p><h4>Working with asyncio in Practice</h4><p>I also explored asyncio more deeply by using:</p><ul><li>async def to define asynchronous functions</li><li>await to pause execution without blocking the event loop</li><li>asyncio.create_task() to run background tasks concurrently</li></ul><p>This helped me understand how real-world async systems are structured, especially in backend applications.</p><h4>Final Thoughts</h4><p>This experience helped me move from simply using async syntax to actually understanding how asynchronous systems behave at runtime.</p><p>The biggest takeaway for me is that the event loop is not just an implementation detail it is the foundation that allows Python applications to stay responsive while handling concurrent work efficiently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d86c5f7e5ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Are Agent Skills? A Beginner’s Guide for Developers]]></title>
            <link>https://medium.com/@islemothmani127/what-are-agent-skills-a-beginners-guide-for-developers-26351c7231a2?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/26351c7231a2</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[claude-agent-skill]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[github-copilot]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 09:43:44 GMT</pubDate>
            <atom:updated>2026-04-12T09:43:44.994Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wDIajuvx09jghLEE8qVC_Q.png" /></figure><p>As a developer, one of the problems I faced personally was managing pull request (PR) review comments. Sometimes I’d get dozens of comments across multiple files some already fixed, some still unresolved. Keeping track of everything manually was frustrating, time-consuming, and easy to mess up.</p><p>That’s where <strong>agent skills</strong> come in.</p><p><strong>What Are Agent Skills?</strong><br> Agent skills are like giving your AI “superpowers.” Normally, AI can answer questions or provide suggestions but with skills, it can actually <strong>perform tasks for you</strong>. Instead of just giving advice, the AI can interact with tools, APIs, or even your code directly.</p><h3>Types of Agent Skills</h3><p>Agent skills can cover a wide range of tasks, depending on what you need:</p><ul><li><strong>Code-related:</strong> run code snippets, test functions, or fix simple bugs automatically.</li><li><strong>Project management:</strong> fetch PR comments, track tasks, or remind you about deadlines.</li><li><strong>Data &amp; APIs:</strong> query databases, fetch reports, or summarize large documents.</li><li><strong>Daily workflow:</strong> send emails, schedule meetings, or automate repetitive tasks like file renaming or logging.</li></ul><p>Even as a beginner, you can start with simple skills and gradually explore more complex ones.</p><h3>How Agent Skills Work</h3><p>At a basic level, agent skills <strong>extend an AI’s capabilities by connecting it to tools</strong>. Without skills, AI is like a smart parrot it can respond to questions but can’t do anything for you. With skills, it becomes an assistant that can actually act on your behalf.</p><p>Think of it this way: instead of manually checking PRs or running code, your AI agent can handle repetitive tasks while you focus on the important or creative parts of your work.</p><h3>Installation &amp; Setup: A Simple Example</h3><p>One beginner-friendly skill is the <strong>Code Runner Agent Skill</strong>, which lets the agent run small code snippets for you. Here’s how to get started:</p><ol><li>Make sure you have an AI agent platform installed, like the one in VSCode Copilot or a local agent environment.</li><li>Search for the “Code Runner” agent skill in the marketplace or repository.</li><li>Install the skill following the platform instructions.</li><li>Activate the skill in your agent environment.</li><li>Now you can ask your agent to run code snippets, test functions, or debug scripts automatically, without opening a terminal manually.</li></ol><h3>Benefits of Agent Skills</h3><p>Using agent skills comes with several advantages:</p><ul><li><strong>Saves time:</strong> no more manual checking or repetitive work.</li><li><strong>Reduces mistakes:</strong> the agent follows consistent rules.</li><li><strong>Simplifies complex workflows:</strong> tasks that involve multiple steps can be automated.</li><li><strong>Focus on critical tasks:</strong> frees your mental bandwidth for creative problem-solving rather than routine chores.</li></ul><h3>Conclusion</h3><p>Agent skills are changing the way developers work. Even as a beginner, you can start small with a code runner, a task manager, or a simple PR helper and gradually explore more advanced skills. They turn an AI from a passive assistant into an active partner that helps you get things done faster and smarter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26351c7231a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding RAGAS: Evaluating RAG Systems]]></title>
            <link>https://medium.com/@islemothmani127/understanding-ragas-evaluating-rag-systems-fe7c4adb08d7?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe7c4adb08d7</guid>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[raga]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 22:02:53 GMT</pubDate>
            <atom:updated>2026-03-11T22:02:53.197Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*3g9OoFibklZL4Kv0wHkacQ.png" /></figure><p>Before talking about <strong>RAGAS</strong>, we first need to understand the concept it evaluates: <strong>Retrieval-Augmented Generation</strong>.</p><h3>What is RAG?</h3><p><strong>RAG (Retrieval-Augmented Generation)</strong> is an AI approach where a system:</p><ul><li><strong>Retrieves information</strong> from external sources</li><li><strong>Uses that information to generate an answer</strong></li></ul><p>In simple terms:</p><ol><li>The system <strong>searches for relevant documents</strong> (retrieval).</li><li>The AI <strong>uses those documents to produce an answer</strong> (generation).</li></ol><p>This means the AI is <strong>not relying only on its training memory</strong>. Instead, it <strong>reads information first</strong> before responding.</p><p>The idea behind RAG is to handle <strong>large and messy datasets</strong>, organize them, and use them as references to generate useful answers.</p><p>You can think of it like a <strong>research assistant</strong>.<br> Someone asks a question, the assistant looks through documents and notes, and finally comes back with a clear answer.</p><h3>The RAG Pipeline</h3><p>A typical RAG system works through the following steps:</p><h4>1. User asks a question</h4><p>Example:</p><blockquote><em>“What is RAG in AI?”</em></blockquote><h4>2. The system searches for relevant documents (Retrieval)</h4><p>The system looks for information inside:</p><ul><li>databases</li><li>PDFs</li><li>documentation</li><li>knowledge bases</li></ul><h4>3. Relevant documents are selected</h4><p>From the search results, the system selects the <strong>most useful pieces of text</strong>.</p><h4>4. Question + documents are sent to the AI model</h4><p>The AI receives two things:</p><ul><li>the <strong>user question</strong></li><li>the <strong>retrieved context</strong></li></ul><h4>5. The AI generates the answer</h4><p>The AI reads the documents and produces a response based on them.</p><h4>6. The answer is returned to the user</h4><p>The final response is delivered to the user.</p><h3>Now… What is RAGAS?</h3><p><strong>RAGAS</strong> is simply a <strong>tool used to evaluate how well a RAG system performs</strong>.</p><p>It helps answer questions like:</p><ul><li>Did the system retrieve the <strong>right information</strong>?</li><li>Did the AI <strong>use the retrieved information correctly</strong>?</li><li>Is the <strong>final answer accurate and relevant</strong>?</li></ul><p>You can think of <strong>RAGAS as a teacher grading the AI’s homework</strong>.</p><h4>Example</h4><p>Imagine a small knowledge base about animals.</p><h4>Step 1: User Question</h4><blockquote><em>What do pandas eat?</em></blockquote><h4>Step 2 : Retrieved Documents</h4><p>Document 1</p><blockquote><em>Pandas mainly eat bamboo.</em></blockquote><p>Document 2</p><blockquote><em>Pandas live in China.</em></blockquote><h4>Step 3: AI Answer</h4><blockquote><em>Pandas mainly eat bamboo.</em></blockquote><p>Now this is where <strong>RAGAS evaluates the result</strong>.</p><h3>What RAGAS Checks</h3><h4>1. Faithfulness</h4><p>Does the answer come from the retrieved documents?</p><p>Context:</p><blockquote><em>Pandas mainly eat bamboo.</em></blockquote><p>Answer:</p><blockquote><em>Pandas mainly eat bamboo.</em></blockquote><p>Result: <strong>High faithfulness</strong> because the answer is supported by the context.</p><h4>2. Answer Relevance</h4><p>Does the answer actually respond to the question?</p><p>Question:</p><blockquote><em>What do pandas eat?</em></blockquote><p>Answer:</p><blockquote><em>Pandas mainly eat bamboo.</em></blockquote><p>Result: <strong>High relevance</strong>.</p><h4>3. Context Precision</h4><p>Did the system retrieve useful documents?</p><p>Retrieved documents:</p><ul><li><em>Pandas mainly eat bamboo</em> → useful</li><li><em>Pandas live in China</em> → not useful</li></ul><p>Result: <strong>Medium precision</strong>, since only one document was relevant.</p><h4>4. Context Recall</h4><p>Did the system retrieve <strong>all necessary information</strong>?</p><p>Imagine the knowledge base also contains:</p><blockquote><em>Pandas occasionally eat fruit.</em></blockquote><p>If the system <strong>fails to retrieve this document</strong>, then <strong>context recall decreases</strong>, because some relevant information was missed.</p><h4>One-Sentence Summary</h4><p><strong>RAGAS is a framework used to evaluate RAG systems by checking whether the system retrieves the right documents and generates accurate answers based on them.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe7c4adb08d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is a RAG Pipeline? (Beginner-Friendly Explanation)]]></title>
            <link>https://medium.com/@islemothmani127/what-is-a-rag-pipeline-beginner-friendly-explanation-43c61b5ed969?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/43c61b5ed969</guid>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Sun, 01 Mar 2026 10:30:19 GMT</pubDate>
            <atom:updated>2026-03-01T10:30:19.397Z</atom:updated>
            <content:encoded><![CDATA[<h3>Artificial Intelligence models like ChatGPT are powerful — but they have a problem.</h3><p>They generate answers based on what they were trained on. They don’t “look things up” in real time, and they can sometimes hallucinate information.</p><p>This is where <strong>RAG</strong> comes in.</p><h3>What Does RAG Mean?</h3><p><strong>RAG = Retrieval-Augmented Generation</strong></p><p>It’s a method that improves AI answers by making the system:</p><ol><li>Retrieve relevant information first</li><li>Generate the answer using that retrieved information</li></ol><p>In simple terms:</p><blockquote><em>Instead of guessing, the AI searches first — then answers.</em></blockquote><h3>Why Do We Need RAG?</h3><p>If you build an AI assistant for something serious like:</p><ul><li>Legal immigration</li><li>Medical guidance</li><li>Company internal knowledge</li><li>Government policies</li></ul><p>You can’t afford hallucinations.</p><p>You need answers that are:</p><ul><li>Grounded in trusted documents</li><li>Traceable to official sources</li><li>Accurate and structured</li></ul><p>RAG makes that possible.</p><h3>How a RAG Pipeline Works (Step by Step)</h3><p>Let’s break it down clearly.</p><h3>1. User Asks a Question</h3><p>Example:</p><blockquote><em>“How do I apply for a Skilled Worker visa?”</em></blockquote><p>The system receives the query.</p><h3>2. Retrieval Phase (Search Step)</h3><p>Instead of sending the question directly to the language model, the system:</p><ul><li>Converts the question into a numerical representation (embedding)</li><li>Searches a vector database</li><li>Finds the most relevant document chunks</li></ul><p>For example:</p><ul><li>Sections from official immigration guidelines</li><li>Policy documents from trusted sources</li><li>Pre-indexed knowledge articles</li></ul><p>The output is usually the top 3–5 most relevant text chunks.</p><h3>3. Context Construction</h3><p>The system builds a structured prompt like:</p><ul><li>User question</li><li>Retrieved document chunks</li></ul><p>This becomes the <strong>context</strong> that will guide the AI.</p><h3>4. Generation Phase (Answer Writing)</h3><p>Now the language model receives:</p><ul><li>The user’s question</li><li>The retrieved content</li></ul><p>It generates an answer based only on that information.</p><p>This reduces hallucinations and ensures the response is grounded in real documents.</p><h3>5. (Optional but Important) Citations</h3><p>A well-designed RAG system can:</p><ul><li>Attach references to each statement</li><li>Provide source links</li><li>Show document sections used</li></ul><p>This adds transparency and trust.</p><h3>The RAG Flow in One Simple Diagram</h3><p>User Question<br> ↓<br> Retriever (Search relevant documents)<br> ↓<br> Top Relevant Chunks<br> ↓<br> Language Model (Generate answer using context)<br> ↓<br> Final Answer + Citations</p><h3>Key Components of a RAG System</h3><p>A typical RAG pipeline includes:</p><ul><li>A document ingestion process (splitting documents into chunks)</li><li>An embedding model (to convert text into vectors)</li><li>A vector database (to store and search embeddings)</li><li>A retriever (to find relevant content)</li><li>A generator (LLM that writes the final response)</li></ul><h3>What Makes RAG Powerful?</h3><p>RAG systems:</p><ul><li>Combine search and generation</li><li>Reduce hallucination</li><li>Work with private or domain-specific data</li><li>Support metadata filtering (e.g., country, visa type, section)</li><li>Provide explainable answers</li></ul><p>Instead of:</p><blockquote><em>“Here’s an answer I think is right.”</em></blockquote><p>You get:</p><blockquote><em>“Here’s the answer, based on these official documents.”</em></blockquote><h3>In One Sentence</h3><p>RAG is a system that searches trusted knowledge first, then uses AI to generate an answer grounded in that knowledge.</p><p>It’s not magic.</p><p>It’s structured intelligence.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43c61b5ed969" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object-Oriented Programming Made Simple]]></title>
            <link>https://medium.com/@islemothmani127/object-oriented-programming-made-simple-5a318b58e094?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a318b58e094</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[oop-concepts]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Wed, 21 Jan 2026 14:13:09 GMT</pubDate>
            <atom:updated>2026-01-21T14:14:55.328Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Object-Oriented Programming (OOP) is a way of programming that models real-world things as </em><strong><em>objects</em></strong><em>, combining their </em><strong><em>state</em></strong><em> (attributes) and </em><strong><em>behavior</em></strong><em> (methods).</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBRSclekbSGzCP89N_gmjQ.png" /><figcaption>oop</figcaption></figure><h4>what is a class ?</h4><ul><li>Think of a <strong>class as a blueprint</strong> or template.</li><li>It <strong>defines what something is and what it can do</strong>, but it’s not the thing itself.</li><li>A class can have:</li></ul><p><strong>Fields/attributes</strong> (state, properties) and <strong>Methods</strong> (behavior, actions)</p><h4>what is an object ?</h4><ul><li>An <strong>object is a real instance</strong> of a class.</li><li>It’s what you actually use in the program.</li><li>Each object can have <strong>different values</strong> for its attributes.</li></ul><h3>The 4 Pillars of OOP:</h3><h4>1/Encapsulation:</h4><p>Encapsulation is used to protect an object’s data and control how it is accessed or modified, because allowing direct access to variables can lead to invalid or inconsistent states. Getters are used to safely read private data without exposing it directly, giving flexibility to change how values are returned in the future. Setters are used to modify data in a controlled way, allowing validation and rules to be enforced. Together, encapsulation with getters and setters helps keep objects consistent, secure, and easier to maintain as programs grow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o_wr4b5rVBEUXZhy-LOJLw.png" /><figcaption>Encapsulation</figcaption></figure><h4>2/ Abstraction:</h4><p><strong>Show what an object does, not how it does it.</strong>Usually via <strong>interfaces</strong> or <strong>abstract classes</strong>.</p><p>Abstraction lets you <strong>focus on what an object <em>does</em></strong>, not <em>how it does it</em>.</p><p>You create <strong>abstract classes</strong> or <strong>interfaces</strong> to define behavior without giving the full implementation.</p><p>Later, subclasses or implementing classes fill in the details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SFe9DtjBT0ZFPjH65zHA5Q.png" /><figcaption>abstraction</figcaption></figure><p>why we use abstract class ?</p><ul><li>You have classes that share <strong>some behavior</strong> and <strong>some rules.</strong></li><li>You want subclasses to inherit <strong>fields and methods</strong>.</li><li>Example: Vehicles, Animals, Employees things with shared features.</li></ul><p>why we use interface ?</p><ul><li>You want to define <strong>abilities</strong> or <strong>capabilities</strong>, not full behavior.</li><li>Classes might <strong>do multiple things</strong> (multiple inheritance of type).</li><li>Example: Flyable, Swimmable, Payable – mix and match abilities.</li></ul><h4>3/ Inheritance:</h4><p><strong>Reuse code by creating parent–child relationships.</strong></p><pre>class Vehicle {<br>  void move() {}<br>}<br><br>class Car extends Vehicle {}</pre><p>Car <em>is a</em> Vehicle.</p><p>Why?</p><ul><li>Avoid duplication</li><li>Share common behavior</li></ul><p>Warning:</p><ul><li>Overusing inheritance creates fragile family trees</li><li>Prefer composition when things get weird</li></ul><h4>4/Polymorphism:</h4><ul><li>You can <strong>use the same method or object in different ways</strong> depending on the context.</li><li>It allows your code to <strong>treat different objects the same way</strong>, even if they behave differently.</li></ul><h4>Two Types of Polymorphism</h4><p><strong>1.Compile-time (or Method Overloading)</strong></p><ul><li>Same method name, <strong>different parameters</strong>.</li><li>The compiler decides which one to use.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*g_hR0kYU4GFhGjAJt1SlMw.png" /></figure><p><strong>2.Run-time (or Method Overriding)</strong></p><ul><li>Same method name <strong>in parent and child class</strong>, but child provides its own version.</li><li>The JVM decides which one to call at runtime.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*rHHeUOBuGGidd2pP3I0ffA.png" /></figure><h3>other terms you should know</h3><h4>1/ Composition:</h4><ul><li>If inheritance is <strong>is-a</strong> (Car is a Vehicle),</li><li>Composition is <strong>has-a</strong> (Car has an Engine).</li><li>You <strong>reuse code by including objects</strong>, not by extending classes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*aZVXkkKk_Oy1ya4q59ReEA.png" /></figure><h4>2/Constructor:</h4><p>Runs when an object is created.</p><pre>class User {<br>  String name;<br><br>  User(String name) {<br>    this.name = name;<br>  }<br>}</pre><h4>3/This:</h4><p>Refers to the current object.</p><p>Used to:</p><ul><li>Avoid confusion</li><li>Remind yourself which object you’re inside</li></ul><h4>4/Access Modifiers</h4><p>Control visibility.</p><ul><li>private → only inside class</li><li>protected → class + subclasses</li><li>public → everyone, including future mistakes</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a318b58e094" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOLID Thinking: Build Software That Last]]></title>
            <link>https://medium.com/@islemothmani127/solid-thinking-build-software-that-last-2bd0723af626?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bd0723af626</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[solid-principles]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Tue, 20 Jan 2026 14:16:54 GMT</pubDate>
            <atom:updated>2026-01-20T14:16:54.367Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Yq1ZG4ZbdhprlOOg.png" /></figure><p>SOLID principles are five rules for writing code that does not collapse into a crying mess the moment you add a new feature. They exist because humans keep changing requirements and code takes it personally.</p><h4>Single Responsibility Principle (SRP)<strong> </strong><br> “One class. One job.”</h4><p>If a class has more than one reason to change, you already lost.<br>For example if your class handles users, sends emails, logs errors, and makes coffee, it is lying about its purpose. Each thing should have exactly one reason to change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*ntcrK3Mao2midL9Oty1tpg.png" /></figure><p>We use SRP <strong>to keep code predictable, changeable, testable, and sane</strong>.</p><h4>Open / Closed Principle (OCP)</h4><p>“Open for extension, closed for modification.”<br> You should be able to add new behavior without rewriting old, working code and breaking everything. In practice: use interfaces, inheritance, composition instead of editing core logic every time.</p><p>once a piece of code works and is tested, you stop poking it. You <em>extend</em> it instead of rewriting it and accidentally inventing three new bugs.</p><p>The idea is simple. Your core logic should stay stable. New behavior should be added around it, not jammed inside it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*BW2CCvbtXjl2xDAwVr85Mw.png" /></figure><h4>Liskov Substitution Principle (LSP)</h4><p><em>If class B is a subclass of class A, you should be able to use B anywhere you use A </em><strong><em>without breaking anything</em></strong><em>.</em></p><p>In other words, a subclass must behave like its parent. Not kind of, not sometimes, all the time.</p><p>Subtypes must be replaceable for their base types.<br> If a Bird can fly, then a Penguin should not inherit from Bird. Child classes must behave in a way that does not shock the parent contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tX6kBTUjknBIn0XB-6dsBA.png" /></figure><h4>Interface Segregation Principle (ISP)</h4><p>Many small interfaces &gt; one giant interface.<br> Do not force a class to implement methods it does not use. If your interface feels obese, split it. Classes deserve dignity</p><p>The <strong>Interface Segregation Principle</strong> says: don’t force classes to implement methods they don’t need. Instead of one giant, “obese” interface, create many small, focused interfaces so each class only commits to what it can actually do. This keeps classes honest, flexible, and maintainable</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yhnXpIrJsqBoDOqIlH9uzw.png" /></figure><h4>Dependency Inversion Principle (DIP)</h4><p>Depend on abstractions, not concrete implementations.<br> High-level logic should not care whether data comes from MySQL, MongoDB, or a notebook someone found in a drawer. Use interfaces or abstractions so details can change without wrecking your system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LqVbs6U5Q7KbDVq_jEqnBQ.png" /></figure><p>SOLID makes code <strong>cleaner, safer, easier to maintain, and less likely to make you rage-quit</strong>. It’s like giving your code a brain and a moral compass instead of leaving it wild and broken.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bd0723af626" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How AI Understands Your Query: From Embeddings to the Most Relevant Answer]]></title>
            <link>https://medium.com/@islemothmani127/how-ai-understands-your-query-from-embeddings-to-the-most-relevant-answer-bd5ee956c072?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd5ee956c072</guid>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Sun, 21 Dec 2025 15:07:08 GMT</pubDate>
            <atom:updated>2025-12-21T15:07:08.121Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding Cosine Similarity in Semantic Search</h3><p>When we talk about <strong>embeddings</strong> in AI, we turn text into <strong>vectors </strong>essentially lists of numbers that capture the meaning of that text. You can think of each vector as a virtual <strong>arrow</strong> in a high-dimensional space. The arrow isn’t real; it’s just a math representation of meaning.</p><h4>Step 1: Represent text as vectors</h4><p>Suppose you have a user query and some documents:</p><ul><li><strong>Query:</strong> “reset password”</li><li><strong>Document A:</strong> “How to change your account password”</li><li><strong>Document B:</strong> “Company holiday schedule”</li></ul><p>A model converts each into vectors (arrows):</p><pre>Query vector (Q):[0.8,0.1,0.6]<br>Doc A vector (A): [0.7,0.2,0.6]<br>Doc B vector (B):[0.1,0.9,0.2]</pre><h4>Step 2: Compare arrows using cosine similarity</h4><p>Cosine similarity measures how <strong>aligned</strong> two vectors are:</p><ul><li><strong>1</strong> → pointing in the same direction (very similar)</li><li><strong>0</strong> → perpendicular (unrelated)</li><li><strong>-1</strong> → opposite direction (contradictory)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*ILDu3N8KSaJ7niBo.jpg" /><figcaption>learndatasci.com</figcaption></figure><p>Formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*x4fOAgEvPhVIdJI8yQC0RQ.png" /></figure><p>where D here can be document A or document B.</p><h4>Step 3: Calculate similarity (example)</h4><p><strong>Query vs Doc A:</strong></p><pre>Dot product: (0.8*0.7 + 0.1*0.2 + 0.6*0.6) = 0.94<br>Magnitudes: ||Q|| ≈ 1.005, ||A|| ≈ 0.95<br>Cosine similarity: 0.94 / (1.005 * 0.95) ≈ 0.98</pre><p><strong>Query vs Doc B:</strong></p><pre>Dot product: (0.8*0.1 + 0.1*0.9 + 0.6*0.2) = 0.29<br>Magnitudes: ||B|| ≈ 0.93<br>Cosine similarity: 0.29 / (1.005 * 0.93) ≈ 0.31</pre><p>Result: <strong>Doc A is much more relevant</strong> to the query than Doc B.</p><h4>Step 4: Rank and retrieve</h4><p>Using cosine similarity, we can <strong>rank documents by relevance</strong>:</p><ol><li>Doc A → 0.98 → top</li><li>Doc B → 0.31 → lower</li></ol><p>Optionally, a <strong>reranker</strong> can refine this further, and the top documents are sent to an LLM for a grounded answer.</p><h3>Understanding Ranking</h3><p>Ranking is the process of <strong>ordering search results by relevance</strong>. This can be based on cosine similarity, keyword matches, metadata, or any relevance score. It usually happens during the <strong>initial retrieval step</strong>, which quickly surfaces the most promising candidates.</p><h4>1. Initial / Primary Ranking</h4><p><strong>What it is:</strong> The first, fast guess of which results might be useful.<br> <strong>How it works:</strong> The system quickly looks for words or general meaning.</p><h4>2. Reranking</h4><p><strong>What it is:</strong> A smarter sorting done after the first guess.<br> <strong>How it works:</strong> Looks carefully at each candidate and picks the truly best ones.</p><h4>3. Learning-to-Rank (LTR)</h4><p><strong>What it is:</strong> The system <strong>learns from experience</strong> which results are usually useful.</p><h4>4. Co-Ranking / Cross-Ranking</h4><p><strong>What it is:</strong> Combines <strong>different clues</strong> to decide which results are best.<br> <strong>How it works:</strong> Looks at meaning, keywords, popularity, and other hints together.</p><h4>5. Hybrid Ranking / Hybrid Search</h4><p><strong>What it is:</strong> Mixes <strong>semantic search</strong> (meaning) and <strong>keyword search</strong> (exact words).<br> <strong>How it works:</strong> Checks both the meaning and the exact words in the query.</p><h4>6. Contextual / Dynamic Ranking</h4><p><strong>What it is:</strong> Changes the order based on <strong>who you are or where you are</strong>.<br> <strong>How it works:</strong> Looks at your past choices, current location, or session to decide which results to show first.</p><h3>Hybrid Search</h3><p><strong>What it is:</strong><br> A search method that <strong>combines two approaches</strong>:</p><ol><li><strong>Semantic search</strong> : understands the meaning of your query.</li><li><strong>Keyword search (lexical search) : </strong>looks for exact words you typed.</li></ol><p><strong>Why it’s needed:</strong></p><ul><li>Semantic search is great for understanding meaning but might miss exact matches.</li><li>Keyword search is great for exact matches but can miss synonyms or related meaning.</li><li>Hybrid search <strong>uses both</strong> to get the best of both worlds.</li></ul><p><strong>How it works:</strong></p><ol><li>Compute a semantic similarity score for each document.</li><li>Compute a keyword match score for each document.</li><li>Combine the scores (weighted sum or other methods).</li><li>Rank the results by the combined score.</li></ol><h4>2. SAC (Semantic Answer Comparison / Search-Answer Combination)</h4><p><strong>What it is:</strong></p><ul><li>A method to <strong>compare answers or retrieved documents</strong> and pick the <strong>most relevant one</strong>.</li><li>Often used in <strong>retrieval-augmented generation (RAG)</strong> to give LLMs the best context.</li></ul><p><strong>Why it’s needed:</strong></p><ul><li>Sometimes multiple documents look relevant.</li><li>SAC helps <strong>decide which one actually answers the question best</strong>.</li></ul><p><strong>Example:</strong></p><p>Question: “How do I reset my password?”</p><p>Retrieved documents:</p><ol><li>“Step-by-step guide to reset your password”</li><li>“Company holiday schedule”</li><li>“How to change your account email”</li></ol><p>SAC compares the content of each document to the query and <strong>scores them</strong>:</p><ul><li>Step-by-step guide → 0.95 (best)</li><li>Company schedule → 0.1 (irrelevant)</li><li>Email change → 0.5 (partially relevant)</li><li>Final ranking: the system gives the <strong>most relevant answer first</strong>.</li></ul><p><strong>How it works:</strong></p><ol><li>Take the query and all candidate answers/documents.</li><li>Compute semantic similarity or use a small model to judge relevance.</li><li>Rank answers by score → feed the top ones to the user or LLM.</li></ol><h3>Scenario</h3><p>You ask an AI system: &quot;How do I reset my password?&quot;<br> The system has a database with many documents:</p><ol><li>&quot;Step-by-step guide to reset your password&quot;</li><li>&quot;Company holiday schedule&quot;</li><li>&quot;How to change your account email&quot;</li><li>&quot;How to set up two-factor authentication&quot;</li><li>&quot;Troubleshooting login issues&quot;</li></ol><h4>Step 1: Embeddings + Cosine Similarity</h4><ul><li>The system turns your query and all documents into <strong>vectors (arrows)</strong>.</li><li>It computes <strong>cosine similarity</strong> between the query and each document.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*PgYsH6H1Mmn-JxvRbdkGIw.png" /></figure><h4>Step 2: Initial Ranking (Primary Retrieval)</h4><p>he system quickly grabs the <strong>top 3–4 candidates</strong> based on similarity scores.</p><p><strong>Candidates:</strong></p><ol><li>Reset password guide (0.98)</li><li>Login issues (0.75)</li><li>Change email (0.50)</li><li>2FA setup (0.45)</li></ol><p><strong>Outcome:</strong> Reduces millions of documents to a small set for deeper evaluation.</p><h4>Step 3: Hybrid Search</h4><ul><li>Now it combines <strong>semantic similarity + keyword match</strong>.</li><li>Keyword search looks for &quot;reset&quot; and &quot;password&quot; exactly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*bJUt-TsGrpM4GXmQGknyJg.png" /></figure><p>Ensures documents that <strong>exactly match keywords and meaning</strong> are ranked higher</p><h4>Step 4: Reranking</h4><ul><li>A smarter model now examines <strong>query + each candidate</strong> in detail.</li><li>It refines relevance:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*o1fs6LEBuVypoFkdZQklSg.png" /></figure><p>Outcome<strong>:</strong> Truly relevant results are at the top.</p><h4>Step 5: SAC (Semantic Answer Comparison)</h4><p>Finally, the system decides <strong>which document actually answers the question best</strong>.</p><p>SAC evaluates content, context, and relevance.</p><p><strong>Final Answer:</strong></p><ul><li>&quot;Step-by-step guide to reset your password&quot;</li></ul><p>Outcome<strong>:</strong> Only the <strong>most precise answer</strong> is returned to the user or LLM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C03BDzQvjrERJObY1KYr0w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd5ee956c072" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Cross-Site Request Forgery (CSRF)?]]></title>
            <link>https://medium.com/@islemothmani127/what-is-cross-site-request-forgery-csrf-f1dbef5aa269?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1dbef5aa269</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[network]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 19:29:55 GMT</pubDate>
            <atom:updated>2025-12-17T19:29:55.057Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mulHp0LJmiLZC0aG" /></figure><p>Cross-Site Request Forgery (CSRF) is a malicious attack vector that exploits the trust a website has in a user’s browser. Here’s a more detailed breakdown of how CSRF works:</p><p>Imagine Bob, a regular user of a banking web application, who has logged into his account. To maintain his authentication state across sessions, the banking app stores Bob’s authentication data, such as session tokens or user IDs, in cookies, as explained in a previous article.</p><p>Now, let’s consider a hacker who wants to gain unauthorized access to Bob’s account and make changes, such as altering his email address and password. The hacker’s objective is to trick Bob’s browser into making requests to the banking website on behalf of Bob without his knowledge or consent.</p><p>The hacker crafts a deceptive email and sends it to Bob. The email might contain enticing content or appear to be from a trusted source, encouraging Bob to click on a link embedded within it. This link leads to a website controlled by the hacker, designed to execute the CSRF attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R_ZtEmHz6avfE2Ru" /></figure><p>When Bob clicks on the link, his browser follows it and navigates to the hacker’s website. Simultaneously, the hacker’s website contains hidden elements or code, such as invisible frames or auto-submitting forms, designed to send forged requests to the banking website in the background.</p><p>These forged requests contain instructions to perform actions on Bob’s behalf, such as changing his email address and password. Because Bob’s browser includes his authentication cookies with every request to the banking website, the website trusts these requests and executes them as if they were initiated by Bob himself.</p><p>With the CSRF attack successful, the hacker can now gain control over Bob’s account. They can change Bob’s email address to one controlled by the hacker, effectively locking Bob out of his account. Additionally, they can change the password, preventing Bob from regaining access and effectively taking ownership of the account.</p><p>In summary, CSRF attacks exploit the inherent trust between a user’s browser and a website to perform unauthorized actions on behalf of the user. By manipulating the victim’s browser into sending forged requests with valid authentication credentials, attackers can carry out various malicious activities, including account takeover and data manipulation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1dbef5aa269" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide to Retrieval-Augmented Generation (RAG)]]></title>
            <link>https://medium.com/@islemothmani127/a-practical-guide-to-retrieval-augmented-generation-rag-086a741e5d8c?source=rss-f8fa269cfb32------2</link>
            <guid isPermaLink="false">https://medium.com/p/086a741e5d8c</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Islemothmani]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 14:05:08 GMT</pubDate>
            <atom:updated>2025-12-17T14:19:42.759Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/735/0*vYYTRblf42B1AmbP.jpg" /></figure><p>Before RAG, AI models relied almost entirely on their <strong>training memory</strong> or on very limited context provided in a prompt. They could answer general questions reasonably well, but anything <strong>outside their training data</strong> or involving <strong>large document collections</strong> was difficult to handle accurately.</p><p>RAG (Retrieval-Augmented Generation) solved this limitation by combining <strong>retrieval</strong> and <strong>generation</strong>, allowing models to use real, external, and potentially up-to-date information while still producing fluent, natural language responses.</p><h3>How RAG works</h3><p>RAG (Retrieval-Augmented Generation) combines two main steps: <strong>retrieval</strong> and <strong>generation</strong>, so the AI does not rely only on its internal memory.</p><ol><li>The Question (Query)</li></ol><ul><li>This is the input provided by the end user.</li><li>Example: “Which city has the most cats in the world?”</li></ul><p><strong>2. Retrieval</strong></p><p>The system searches external data sources to find relevant information.</p><ul><li>Both the user query and documents are converted into <strong>embeddings</strong>, which are vectors in a high-dimensional space.</li><li>The system compares these vectors to find the most relevant document chunks.</li><li>The result is a small set of text snippets likely to contain the answe</li></ul><p><strong>3. Augmentation</strong></p><p>The retrieved chunks are added to the prompt sent to the language model (LLM).</p><p>Instead of guessing from memory, the model now has <strong>real context</strong> to base its response on.</p><p><strong>4. Generation</strong></p><p>The LLM reads both:</p><ul><li>the user’s question</li><li>the retrieved context</li></ul><p>It then generates a <strong>fluent and accurate answer</strong> grounded in the retrieved data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hfyer3sOSaGvybuyHH306w.png" /><figcaption>RAG pipeline</figcaption></figure><h3>Key Definitions</h3><h4>Vector Database</h4><p>It is a specialized type of database designed to store:</p><ul><li>vectors (arrays of floating-point numbers)</li><li>metadata such as the original text, page number, category, or document ID</li></ul><p>It is optimized for searching and comparing vectors efficiently.</p><h4><strong>Embeddings</strong></h4><p><strong>Embeddings</strong> are numerical representations of text in a high-dimensional space.<br> They capture semantic meaning, so texts with similar meanings are located close to each other in that space.</p><p>The process of converting text into vectors is called <strong>embedding</strong>.</p><h3>How Data Is Stored in a Vector Database</h3><p>Each stored item typically includes:</p><ul><li>an embedding (the vector)</li><li>metadata (the original text and additional information)</li></ul><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*CRzBoq1GmR2d-YnDkSoiag.png" /><figcaption>example of how data is stored in vector database</figcaption></figure><h3>Embedding Similarity Example</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*0cPXst97jsjWV8pfNOMclg.png" /><figcaption>embeddings example</figcaption></figure><p>For example, the embeddings for <strong>“cat”</strong> and <strong>“dog”</strong> are close together because they are semantically similar, while <strong>“car”</strong> is far away because it represents a different concept.</p><h3>Why Vector Databases Are Special</h3><p>Unlike traditional databases, vector databases are optimized for <strong>high-dimensional similarity search</strong>. They rely on two main types of algorithms:</p><ul><li><strong>Indexing algorithms</strong><br> Organize vectors efficiently for fast searches (e.g. HNSW, IVF).</li><li><strong>Matching algorithms</strong><br> Compute similarity between vectors using metrics such as cosine similarity or Euclidean distance</li></ul><h3>How Embedding Search Works in RAG</h3><ul><li><strong>Documents → Chunks → Embeddings</strong><br> Documents are split into chunks, and each chunk is converted into an embedding and stored in a vector database.</li><li><strong>Query → Embedding</strong><br> The user’s question is also converted into an embedding.</li><li><strong>Similarity Search</strong><br> The system compares the query embedding with stored embeddings and finds the closest ones.</li><li><strong>Retrieval</strong><br> The top-N most relevant chunks are retrieved and passed to the LLM as context.</li></ul><h3>Tools Commonly Used to Build a RAG System</h3><h4>Document Processing</h4><ul><li><strong>PyPDF2 / pdfplumber</strong> — extract text from PDFs</li><li><strong>python-docx</strong> — extract text from Word documents</li><li><strong>LangChain text splitters</strong> or <strong>LlamaIndex SentenceSplitter</strong> — split text into chunks</li></ul><h4>Embeddings</h4><ul><li>OpenAI embeddings (text-embedding-3-small, text-embedding-3-large)</li><li>Hugging Face models (sentence-transformers/all-MiniLM-L6-v2)</li><li>InstructorEmbedding or Cohere embeddings</li></ul><h4>Vector Databases</h4><ul><li><strong>FAISS</strong> — lightweight, local, open-source</li><li><strong>Chroma</strong> — Python-friendly, good for local and production use</li><li><strong>Milvus</strong> — scalable, cloud-ready vector database</li></ul><h4>Large Language Models (LLMs)</h4><ul><li>OpenAI GPT models</li><li>Hugging Face LLMs (LLaMA, Falcon, MPT, etc.)</li><li>Local models using transformers or llama.cpp</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=086a741e5d8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>