<?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[Tekraze - Medium]]></title>
        <description><![CDATA[A Tech blog to read about technology, computer, developer, tools, Android App, News, coding, program, programming, Tutorial, music, gadgets, inspirational. - Medium]]></description>
        <link>https://medium.com/tekraze?source=rss----a09df5e845a2---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Tekraze - Medium</title>
            <link>https://medium.com/tekraze?source=rss----a09df5e845a2---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 18:46:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/tekraze" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your WordPress Content Might Be Good — But It Doesn’t Look Like It]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/tekraze/your-wordpress-content-might-be-good-but-it-doesnt-look-like-it-f68679794b19?source=rss----a09df5e845a2---4"><img src="https://cdn-images-1.medium.com/max/1536/1*kX7lWxJV64i2ExS31sEH0g.png" width="1536"></a></p><p class="medium-feed-link"><a href="https://medium.com/tekraze/your-wordpress-content-might-be-good-but-it-doesnt-look-like-it-f68679794b19?source=rss----a09df5e845a2---4">Continue reading on Tekraze »</a></p></div>]]></description>
            <link>https://medium.com/tekraze/your-wordpress-content-might-be-good-but-it-doesnt-look-like-it-f68679794b19?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/f68679794b19</guid>
            <category><![CDATA[blogging]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[content-design]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Balvinder Singh]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 00:05:54 GMT</pubDate>
            <atom:updated>2026-01-06T00:05:54.838Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Dashes Don’t Lie: The Hidden Mark of AI Writing]]></title>
            <link>https://medium.com/tekraze/dashes-dont-lie-the-hidden-mark-of-ai-writing-46f4d19b1537?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/46f4d19b1537</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[text-generation]]></category>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[em-dash]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Bhavesh Gupta]]></dc:creator>
            <pubDate>Thu, 21 Aug 2025 13:26:25 GMT</pubDate>
            <atom:updated>2025-08-21T13:26:26.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Futuristic digital scene showing keyboard keys for dash and period morphing into stylized punctuation marks, with glitch effects and subtle highlights to suggest AI text detection and the hidden role of punctuation" src="https://cdn-images-1.medium.com/max/1024/1*O9e27KtF8M_7DQFJE8NowQ.png" /><figcaption>Spotting machine writing: Subtle punctuation marks like em dashes, en dashes, and ellipses can reveal more about your text than you think.</figcaption></figure><p>So, you post a thoughtful message. It’s smart, warm, polished. <br>But something feels off, maybe too polished.</p><p><strong>Here’s why: </strong><br>Normal people don’t use the em dash ( — ), en dash (–), or the true ellipsis (…) by accident. These marks are actually hard to type for most of us.</p><h4><strong>The Secret Code Hiding in Your Punctuation</strong></h4><ul><li><strong>Em dash</strong> ( — ): Want to type it on Windows? You need to press Alt+0151 on the number pad. Mac? Shift+Option+-<br>On mobile? Good luck even finding it.</li><li><strong>En dash</strong> (–): Windows + Alt+0150 and on Mac Option+- <br> Most people just use a regular hyphen (-) for ranges or connections, because it’s the only thing on the keyboard.</li><li><strong>Ellipsis</strong> (…):<br>AI loves the single-character ellipsis, but humans just hit the period key three times: (…)</li></ul><h4><strong>Why Does This Matter?</strong></h4><p>AI tools, by default, reach for perfect punctuation. They’re trained on edited books and web pages, not <strong>thumb-typed</strong> texts and emails. <br>So when a thank-you note or a quick message drops in with flawless dashes or that tight one-character ellipsis, it screams “AI” to anyone who’s paying attention.</p><p>It isn’t about typos or grammar at all, the giveaway is <strong>how the message got punctuated</strong>.</p><h4>Real People Use Keyboard Shortcuts</h4><p>Honestly, who memorizes Alt+0151 ? <br>If you’re writing quickly, texting, or even sending an email, you use what’s easy to reach:</p><ul><li>Two hyphens ( — ) if you want a long pause</li><li>Single hyphen for dates (2020–2025)</li><li>Three periods (…) for an unfinished thought</li></ul><p>That’s why you almost never see true <strong>em</strong> or <strong>en</strong> dashes in chat, on social, or in emails from real people.</p><h4>Want Human-Sounding AI? Use This</h4><p>Before you ask an AI to write, add:</p><blockquote>“Avoid using em dash, en dash, and ellipsis characters. Use hyphens and three dots instead.”</blockquote><p>That little line forces AI to follow the keyboard logic real people use. Suddenly, your output fits in everywhere.</p><p>No overthinking, just use what’s on your keyboard, and your posts will sound (and feel) real.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46f4d19b1537" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tekraze/dashes-dont-lie-the-hidden-mark-of-ai-writing-46f4d19b1537">Dashes Don’t Lie: The Hidden Mark of AI Writing</a> was originally published in <a href="https://medium.com/tekraze">Tekraze</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Better Products in a World of Instant Expertise]]></title>
            <link>https://medium.com/tekraze/building-better-products-in-a-world-of-instant-expertise-026c0a8a4850?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/026c0a8a4850</guid>
            <category><![CDATA[mindset]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[curiosity]]></category>
            <dc:creator><![CDATA[Bhavesh Gupta]]></dc:creator>
            <pubDate>Thu, 21 Aug 2025 13:26:06 GMT</pubDate>
            <atom:updated>2025-08-21T13:26:06.713Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern tech landscape is being defined by an avalanche of ready-made knowledge. The moment a product challenge arises, an endless parade of tutorials, blog posts, and AI-generated guidance beckons for attention. There’s a sense of momentum that comes from such <strong>instantaneous</strong> advice, as if the act of creation has become frictionless. Yet, within that very convenience lies an unsettling possibility: <em>as boundaries to entry collapse and technical shortcuts abound, the true spirit of engineering risks fading into the background.</em></p><figure><img alt="symbolizing the importance of critical thinking and exploring deeper questions in engineering and technology" src="https://cdn-images-1.medium.com/max/1024/1*bELCFYZrju9pZgoXF1wX5w.png" /><figcaption>symbolizing the importance of critical thinking and exploring deeper questions in engineering and technology</figcaption></figure><p>The proliferation of on-demand expertise can make it remarkably easy to accept suggested answers as definitive solutions. In a climate where confidence is often equated with correctness, teams may become content with stringing together communities’ best practices, layering well-worn design patterns atop one another, and following checklists with vigor. What can quietly slip away is the discipline to scrutinize not just <strong>how</strong> a thing is built, but <strong>why</strong> it is built that way in the first place. Habits form around unquestioned answers, and soon the iterative process of asking, experimenting, and learning is replaced by a perfunctory cycle of implementation.</p><p>Imagine for a moment what’s lost when the art of looking beyond received wisdom disappears. Before the rise of instantaneous answers, much of progress in engineering was driven by tension: the friction of incomplete knowledge, the struggle to bridge the gap between problem and solution. This struggle carved out space for genuine creativity, because solutions weren’t simply inherited, they were discovered often unexpectedly, through a deliberate wrestling with ambiguity. Now the very qualities that once set apart exceptional builders are persistent inquiry, the ability to disentangle complex tradeoffs, the willingness to interrogate easy assumptions; <strong>are under threat</strong>. The world doesn’t just need specialists who can assemble components efficiently; it needs those who embrace the uncertainty at the heart of making something new. When answers come prepackaged, opportunities for real exploration become rarer, and the collective intuition that comes from mistakes, false starts, and surprising insights is diminished.</p><p>To truly leverage the positive power of pervasive expertise, we must recommit to cultivating curiosity at every juncture of the building process. The highest impact teams aren’t those who simply follow the quickest path forward, but those who use every tool-<strong>AI included - </strong>as a jumping-off point for deeper investigation. They see each market trend, user request, or technical pattern as an incomplete picture, one that demands interpretation and adaptation rather than passive acceptance. Through this lens, every obvious answer becomes the beginning of a richer conversation.</p><p>It’s not enough to accelerate our workflows or amass a library of solutions. <strong>Progress</strong>, especially in technology, depends on the willingness to pause, to probe the reasoning behind each proposed approach, to resist the inertia of consensus, and to remain open to discovering that a different question might reveal a better answer.</p><blockquote>As we move into this new era of digital abundance, the most successful products will be those anchored by a culture where inquiry is constant, creativity is relentless, and quick fixes are just the starting point not the destination.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=026c0a8a4850" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tekraze/building-better-products-in-a-world-of-instant-expertise-026c0a8a4850">Building Better Products in a World of Instant Expertise</a> was originally published in <a href="https://medium.com/tekraze">Tekraze</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transform Microservices: Step-by-Step JSON to Protobuf Shift]]></title>
            <link>https://medium.com/tekraze/transform-python-microservices-step-by-step-json-to-protobuf-shift-9fb099fbd135?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/9fb099fbd135</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[protobuf]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Bhavesh Gupta]]></dc:creator>
            <pubDate>Sat, 12 Jul 2025 10:58:17 GMT</pubDate>
            <atom:updated>2025-07-12T10:58:16.998Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UgycDaViwuneYogB0zHYlQ.png" /></figure><p>JSON has served developers well. It’s simple, readable, and flexible. But that flexibility becomes a weakness in complex systems, especially as codebases grow across teams, services, and languages.</p><p>At scale, JSON can&#39;t enforce schemas, can&#39;t evolve safely, and lacks efficient encoding. When your system begins to crack under the weight of coordination, versioning, and performance, Protobuf steps in as a solid foundation.</p><p>This post is about how to migrate from JSON to Protobuf in Python, safely, incrementally, and in a way that works even in restricted or offline environments. Whether you need runtime flexibility or want to commit to strict type safety, we’ll walk through options that fit your system without breaking what already works.</p><h3>What Protobuf Solves That JSON Can&#39;t</h3><p>This isn’t just about performance; it’s about defining structure and intent. JSON doesn’t support:</p><ul><li>Strong typing or validation</li><li>Schema evolution with backward compatibility</li><li>Field numbering or metadata</li><li>Efficient binary representation</li></ul><p>Protobuf solves all of this by treating your data schema as part of your codebase. It defines fields with types and IDs, supports optional and repeated fields explicitly, and allows forward/backward-compatible changes.</p><p>The result is a data layer that’s safer to change, easier to validate, and faster to transmit.</p><h3>Protobuf Data Types: What You Get</h3><p>Protobuf supports a clean set of well-typed primitives and containers:</p><p>Scalars: int32, int64, float, double, bool, string, bytes</p><p>Enumerations: Enums with strict values</p><p>Messages: Nested structured types</p><p>Repeated fields: Typed lists (repeated string tags)</p><p>Maps: Only map&lt;scalar, scalar|message&gt;</p><p>What you don’t get is dynamic or mixed-type structures:</p><p>No arbitrary dict equivalent</p><p>No lists like [1, &quot;two&quot;, true]</p><p>That’s intentional. Protobuf is designed for consistency across systems. You can’t break it by accident, and that’s a strength.</p><h3>JSON to Protobuf: Two Proven Paths</h3><p>When migrating from JSON to Protobuf, you have two well-supported options in Python. Both allow you to incrementally move logic over without disrupting your current workflows.</p><h3>Option 1: Static Code Generation (_pb2.py files)</h3><p>Define your .proto schemas, compile them using protoc, and import the generated Python classes.</p><p>Example</p><pre>// user.proto<br>message User {<br>  string name = 1;<br>  int32 age = 2;<br>  repeated string tags = 3;<br>}<br><br></pre><p>Compile using:</p><pre>protoc --proto_path=proto/ --python_out=generated/ proto/user.proto</pre><p>Then use in Python:</p><pre>from generated import user_pb2<br><br>user = user_pb2.User(name=&quot;Alice&quot;, age=30, tags=[&quot;python&quot;, &quot;protobuf&quot;])<br>print(user.SerializeToString())<br></pre><p>Advantages:</p><ul><li>Fastest runtime performance</li><li>IDE support and type checking</li><li>Straightforward integration with existing Python code</li></ul><p>This works well if you control the schema and can check in the generated code. It doesn’t require protoc in production if you precompile and version the _pb2.py files.</p><h3>Option 2: Dynamic Loading via .desc Files</h3><p>This alternative avoids generated code entirely. Instead, compile .proto files into binary descriptor sets (.desc), then dynamically load and use message types at runtime.</p><p>Compile the descriptor (offline or in CI):</p><pre>protoc --proto_path=proto/ --include_imports \<br>       --descriptor_set_out=schema.desc \<br>       proto/user.proto<br></pre><p>Load and use dynamically:</p><pre>from google.protobuf import descriptor_pb2, descriptor_pool, message_factory<br><br>with open(&quot;schema.desc&quot;, &quot;rb&quot;) as f:<br>    desc_set = descriptor_pb2.FileDescriptorSet()<br>    desc_set.ParseFromString(f.read())<br><br>pool = descriptor_pool.DescriptorPool()<br>for fd in desc_set.file:<br>    pool.Add(fd)<br><br>factory = message_factory.MessageFactory(pool)<br>User = factory.GetPrototype(pool.FindMessageTypeByName(&quot;User&quot;))<br><br>user = User(name=&quot;Alice&quot;, age=30, tags=[&quot;dynamic&quot;, &quot;loaded&quot;])<br></pre><p>Advantages:</p><ul><li>No _pb2.py files or static code generation</li><li>Perfect for plugin systems and runtime schema loading</li><li>Works in restricted environments where protoc cannot be used during deploy</li></ul><p>This is also ideal for systems that must support user-defined or changing schemas.</p><h3>Migration Strategy with Zero Risk</h3><p>You don’t need to change your entire codebase to adopt Protobuf. You can keep using JSON for I/O and switch to Protobuf internally:</p><ul><li>Define .proto files to match your existing JSON structure</li><li>Continue using json.load() to read JSON files</li><li>Convert into Protobuf objects:</li></ul><pre>import json<br>from user_pb2 import User<br><br>with open(&quot;user.json&quot;) as f:<br>    data = json.load(f)<br><br>user = User(**data)<br></pre><p>This gives you type enforcement, Protobuf-based validation, and structured serialization, while keeping your existing logic intact.</p><p>Later, you can move upstream or downstream components to write and read Protobuf natively.</p><h3>Tooling for Restricted Environments</h3><p>If your org doesn’t allow external binary tools or internet downloads during deployment:</p><ul><li>Use protoc only in dev or CI to generate .desc or _pb2.py</li><li>Check in these artifacts with your codebase</li><li>At runtime, only use protobuf (pure Python)</li><li>No need for external dependencies or compiler binaries in production</li></ul><p>This is particularly useful in regulated, financial, or air-gapped environments.</p><h3>Dependencies and Docker</h3><p>requirements.txt</p><pre>protobuf==4.25.3<br>grpcio-tools==1.62.1  # optional; for compilation only<br><br></pre><p>Dockerfile (runtime only, clean, no protoc)</p><pre>FROM python:3.11-slim<br><br>WORKDIR /app<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br><br>COPY . .<br><br>CMD [&quot;python&quot;, &quot;main.py&quot;]<br><br></pre><p>Dev image (for descriptor generation)</p><pre>FROM grpc/python:1.62 as builder<br><br>COPY proto/ /proto<br>RUN python -m grpc_tools.protoc \<br>     -I /proto \<br>     --descriptor_set_out=/proto/schema.desc \<br>     --include_imports /proto/*.proto<br><br></pre><p>You can integrate this into your CI pipeline, commit the schema.desc, and load it dynamically in your runtime.</p><h3>Final Word</h3><p>Adopting Protobuf isn’t about rewriting your stack. It’s about enforcing clarity where your system needs it most, in how data is defined, shared, and evolved. JSON will always be part of the picture. But Protobuf gives you structure, validation, and predictability.</p><p>In environments where restrictions make tooling hard to use, Protobuf still delivers. You can define once, compile once, and ship safely. Whether using generated classes or dynamic descriptors, you&#39;re gaining control over your data and protecting yourself from future drift.</p><p>Start with one .proto. Use it internally. See how much tighter your contracts become. Then expand.</p><p>Protobuf isn’t just a serialization format. It’s a contract system for teams that take growth seriously.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fb099fbd135" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tekraze/transform-python-microservices-step-by-step-json-to-protobuf-shift-9fb099fbd135">Transform Microservices: Step-by-Step JSON to Protobuf Shift</a> was originally published in <a href="https://medium.com/tekraze">Tekraze</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Semantic Chunking: The Game-Changer Your LLM Pipeline Needs]]></title>
            <link>https://medium.com/tekraze/semantic-chunking-the-game-changer-your-llm-pipeline-needs-eac2f836b465?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/eac2f836b465</guid>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[chunking-strategies]]></category>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[embedding-model]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Bhavesh Gupta]]></dc:creator>
            <pubDate>Sat, 12 Jul 2025 10:51:20 GMT</pubDate>
            <atom:updated>2025-07-12T10:51:20.601Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oXOh2fo3oHQZAzn5cfqbhg.png" /></figure><h3>When Fixed-Length Chunking Fails: Lessons from Building a Smarter Embedding Pipeline</h3><p>Working with large language models (LLMs) is like collaborating with a brilliant intern: unlimited potential, zero context-unless you spell everything out. I learned this firsthand while building a document search pipeline that lets users query their own uploaded files.</p><p>You probably know the classic approach: split the document, embed each chunk, store those vectors, and later retrieve top matches using cosine similarity. That’s where I started, too. My setup? Simple: 500-token fixed-size chunks, text-embedding-ada-002, and a vector database. Clean. Predictable. Reliable-until it wasn’t.</p><h3>Fixed-Length Chunking: Fast, but Shallow</h3><p>Fixed-size chunking is ruthlessly literal. It slices documents into uniform pieces, ignoring sentence boundaries and conceptual flow. The result? Some chunks end mid-sentence. Others split tightly connected ideas. Retrieval returns technically relevant chunks, but the semantic glue is missing.</p><p>Imagine reading a textbook where the paragraphs are shuffled. That’s how my LLM responses felt: technically accurate, but disconnected and awkward.</p><h3>Enter Semantic Chunking</h3><p>I needed to feed the model semantically meaningful input. So, I pivoted to sentence-based semantic chunking. Each sentence was embedded, and adjacent sentences were grouped based on cosine similarity. When similarity dropped below a threshold, a new chunk began.</p><p>Crucially, I avoided brute-force n² comparisons. Instead, I walked through sentences linearly, aggregating them until semantic drift occurred. This kept processing time practical, even for large documents.</p><p>The payoff? Fewer chunks, better thematic consistency, and dramatically improved retrieval. Suddenly, LLM answers were fluent and on point.</p><h3>The Tradeoff: Cost and Latency</h3><p>Semantic chunking isn’t free:</p><p>- More embeddings (initially), since each sentence requires embedding<br>- Extra compute for grouping<br>- Longer preprocessing per document</p><p>But the benefits were undeniable. Users asked sharper questions, got more precise answers, and no longer had to click through endless “next chunk” buttons.</p><p>Yes, compute costs rose-but only upfront. Embeddings are stored once. Querying remained fast, and richer chunks meant less over-fetching.</p><h3>Preserving Order:</h3><p>Chunks are only part of the story. To reconstruct logic or narrative, order matters. My solution:</p><p>- Each chunk saved its index<br>- MongoDB tracked metadata (document ID, chunk index)<br>- Milvus managed the embedding vectors</p><p>During retrieval, I reassembled chunks by index. This made long-form answers smoother and multi-chunk explanations coherent.</p><h3>Why I Skipped Langchain</h3><p>Langchain is powerful, but I wanted full control. Every step-chunking, embedding, retrieval-was coded from scratch. I wrapped it all into a clean, reusable class that:</p><p>- Accepts any embedding model<br>- Supports semantic or fixed chunking (user’s choice)<br>- Stores metadata and vectors in MongoDB and Milvus<br>- Handles cosine similarity search and post-processing</p><h3>Embedding Model Consistency: A Critical Lesson</h3><p>Early on, I hit a subtle bug: embedding a document with one model and querying with another doesn’t work. The vector spaces are different. Even minor changes in embedding logic throw off similarity.</p><p>To bulletproof the system, I ensured:</p><p>- The same model is always used for both upload and query<br>- Model info is stored or recoverable at query time</p><h3>Flexible Embedding Model Management</h3><p>I wanted users to choose their embedding model. But if someone uploads data with model-A and queries weeks later, how do I know which model to use?</p><p>My solution: bake the embedding model into the collection name in Milvus/Mongo. For example:</p><p>- invoice-docs_ada002<br>- invoice-docs_bge_small</p><p>At query time, the system reads the collection name, parses out the model, and loads the same one for embedding the query. No surprises. No misalignment. Flexible and transparent.</p><h3>User-Controlled Chunking: Real-World Robustness</h3><p>Documents aren’t always well-formed. Some are dense prose, others are bullet lists or tables. Semantic chunking isn’t always best. So I exposed an option-users can pick between:</p><p>- Semantic chunking (great for prose, reports, articles)<br>- Fixed chunking (faster, safer for structured or tabular data)</p><p>Letting users decide makes the system robust to messy, real-world data.</p><h3>Cosine Similarity Wins</h3><p>I tested both cosine and Euclidean distance. Cosine similarity consistently performed better. It focuses on the angle between vectors, not their magnitude-ideal for language tasks where semantics matter more than length.</p><p>Euclidean distance often skewed results due to chunk size and embedding scale. Cosine kept things stable and relevant.</p><h3>What’s Next: Reranker Models</h3><p>Semantic chunking boosted recall, but sometimes the top-k results still missed the best answer. Enter rerankers: models that take a query and a candidate set, then sort by deeper relevance.</p><p>I’m now evaluating lightweight rerankers like bge-reranker-base and OpenAI’s latest. These models sit atop the retrieval layer and give another boost to answer quality.</p><h3>Closing Thoughts</h3><p>Embedding pipelines are deceptively complex. Every choice-chunking style, order preservation, embedding consistency-has huge downstream effects on retrieval quality and LLM performance.</p><p>By building this from the ground up with clear boundaries and a developer-first mindset, I now have a system that’s accurate, fast, and modular.</p><p>If you’re building similar systems or experimenting with RAG pipelines, I’d love to hear how you’re handling chunking, model management, and reranking. Happy to share code or swap optimization strategies!</p><p>Let’s push the boundaries of what LLMs can do-together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eac2f836b465" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tekraze/semantic-chunking-the-game-changer-your-llm-pipeline-needs-eac2f836b465">Semantic Chunking: The Game-Changer Your LLM Pipeline Needs</a> was originally published in <a href="https://medium.com/tekraze">Tekraze</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Containing the Chaos: Building LLM Chatbots That Stick to Their Domain]]></title>
            <link>https://medium.com/tekraze/containing-the-chaos-building-llm-chatbots-that-stick-to-their-domain-39039d585700?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/39039d585700</guid>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Bhavesh Gupta]]></dc:creator>
            <pubDate>Tue, 01 Jul 2025 11:36:19 GMT</pubDate>
            <atom:updated>2025-07-01T11:36:19.024Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pjrVy349jjll95n4-xuKww.png" /></figure><h3>Introduction</h3><p>Imagine you’re developing an AI assistant dedicated to music education. A user suddenly asks for tax advice, and your chatbot confidently dishes out incorrect legal information. This scenario highlights a common pitfall with large language models (LLMs): they can confidently generate responses far outside their intended scope.</p><p>LLMs promise incredible clarity, scalability, and speed. But without proper boundaries, they risk delivering misleading or unsafe answers. In this article, we’ll explore a practical, layered approach to building LLM chatbots that stay “in their lane” — ensuring safety, relevance, and trustworthiness.</p><h3>Why Prompt Engineering Isn’t Enough</h3><p>Prompt engineering is often the first line of defense. By carefully crafting prompts, you can nudge the model toward desired behavior. However, this approach alone is fragile. Users can bypass restrictions through clever phrasing or malicious inputs (like prompt injections). To truly contain the chaos, safety must be baked into the system architecture — not just the prompt.</p><h3>A Layered Safety Audit Framework for LLMs</h3><p>To build a robust chatbot, consider a multi-stage pipeline that:</p><ol><li>Intercepts user input</li><li>Classifies input relevance and intent</li><li>Scopes the prompt to the domain</li><li>Generates the LLM response</li><li>Evaluates the response with a secondary model</li><li>Moderates and logs the final output</li></ol><p>Each step acts as a gatekeeper, reducing risk and maintaining domain integrity.</p><h3>Step 1: Input Classification</h3><p>Before the LLM even sees the input, use a zero-shot classifier or a fine-tuned intent model to filter out irrelevant or unsafe queries.</p><pre>from transformers import pipeline<br><br>classifier = pipeline(&quot;zero-shot-classification&quot;, model=&quot;facebook/bart-large-mnli&quot;)<br><br>input_text = &quot;What&#39;s the capital gains tax in Germany?&quot;<br>labels = [&quot;Indian classical music&quot;, &quot;Tax advice&quot;, &quot;Travel planning&quot;]<br><br>result = classifier(input_text, candidate_labels=labels)<br><br>if result[&#39;labels&#39;][0] != &quot;Indian classical music&quot;:<br>    return &quot;Sorry, I can only help with Indian classical music.&quot;</pre><p>This early filter prevents scope creep and optimizes system resources.</p><h3>Step 2: Scoped Prompting</h3><p>Use prompt templates that clearly define the assistant’s domain and expected behavior.</p><pre>prompt = f&quot;&quot;&quot;<br>You are an expert assistant specialized in Indian classical music.<br>Only answer questions related to ragas, instruments, or musicians.<br>If asked about anything else, respond: &#39;I’m not trained for that.&#39;<br><br>User query: {user_input}<br>&quot;&quot;&quot;</pre><p>While helpful, scoped prompts alone can’t guarantee safety.</p><h3>Step 3: LLM-as-a-Judge Evaluation</h3><p>After generating a response, pass it through a secondary evaluation model to verify relevance and safety. Frameworks like <em>DeepEval</em> can help automate this.</p><pre>from deepeval.metrics import RelevanceMetric<br>from deepeval.test_case import LLMTestCase<br><br>test_case = LLMTestCase(<br>    input=&quot;What is Raag Bhairav?&quot;,<br>    actual_output=&quot;Raag Bhairav is a morning raga known for its meditative quality...&quot;<br>)<br><br>relevance_metric = RelevanceMetric(model=&quot;gpt-4o&quot;, threshold=0.85)<br>relevance_metric.measure(test_case)<br><br>if not test_case.passed:<br>    raise Exception(&quot;Audit failed. Response is not relevant.&quot;)</pre><p>Using a different model for auditing reduces bias and improves reliability.</p><h3>Step 4: Moderation and Logging</h3><p>Finally, scan the response for unsafe or toxic content using moderation APIs.</p><pre>import openai<br><br>moderation_result = openai.Moderation.create(input=llm_response)<br><br>if moderation_result[&quot;results&quot;][0][&quot;flagged&quot;]:<br>    raise Exception(&quot;Response blocked by moderation filter&quot;)</pre><p>Log all inputs, outputs, audit results, and timestamps to build trust, enable compliance, and support continuous improvement.</p><h3>Common Pitfalls to Avoid</h3><ul><li>Using the same model for generation and evaluation: This can cause echo chamber effects. Always use independent models for auditing.</li><li>Overconfident classifiers: Edge cases can slip through. Regularly retrain and monitor model drift.</li><li>Lack of observability: Without proper logging, you can’t diagnose issues or demonstrate compliance.</li></ul><h3>Deployment Tips</h3><ul><li>Apply this layered auditing especially in vertical assistants with strict domain requirements.</li><li>For retrieval-augmented generation (RAG) systems, audit at both passage and response levels.</li><li>For latency-sensitive applications, asynchronous audits are acceptable but ensure all outputs are logged.</li></ul><h3>Conclusion</h3><p>A chatbot that tries to answer everything is a liability, not an asset.</p><p>Real LLM safety comes from a layered approach: controlling inputs, verifying outputs, and maintaining detailed logs. Prompt design alone won’t save you — robust systems will.</p><p>Trust but verify, then log it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39039d585700" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tekraze/containing-the-chaos-building-llm-chatbots-that-stick-to-their-domain-39039d585700">Containing the Chaos: Building LLM Chatbots That Stick to Their Domain</a> was originally published in <a href="https://medium.com/tekraze">Tekraze</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Fix Hash Error with Python OpenSSL]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/tekraze/how-to-fix-hash-error-with-python-openssl-3ba53935e589?source=rss----a09df5e845a2---4"><img src="https://cdn-images-1.medium.com/max/1200/1*YJV0GP3UmG0jnXE-WJQk9g.png" width="1200"></a></p><p class="medium-feed-snippet">Hi Everyone,</p><p class="medium-feed-link"><a href="https://medium.com/tekraze/how-to-fix-hash-error-with-python-openssl-3ba53935e589?source=rss----a09df5e845a2---4">Continue reading on Tekraze »</a></p></div>]]></description>
            <link>https://medium.com/tekraze/how-to-fix-hash-error-with-python-openssl-3ba53935e589?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/3ba53935e589</guid>
            <category><![CDATA[hashing]]></category>
            <category><![CDATA[pip]]></category>
            <category><![CDATA[openssl]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Balvinder Singh]]></dc:creator>
            <pubDate>Sun, 27 Apr 2025 13:34:44 GMT</pubDate>
            <atom:updated>2025-04-27T13:34:30.666Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding React Components and JSX]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/tekraze/understanding-react-components-and-jsx-dbc7b1dd0b81?source=rss----a09df5e845a2---4"><img src="https://cdn-images-1.medium.com/max/1200/1*H9PDYUkkWXvbuQ5UI4o3MQ.jpeg" width="1200"></a></p><p class="medium-feed-snippet">Introduction to React Components</p><p class="medium-feed-link"><a href="https://medium.com/tekraze/understanding-react-components-and-jsx-dbc7b1dd0b81?source=rss----a09df5e845a2---4">Continue reading on Tekraze »</a></p></div>]]></description>
            <link>https://medium.com/tekraze/understanding-react-components-and-jsx-dbc7b1dd0b81?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/dbc7b1dd0b81</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[guides-and-tutorials]]></category>
            <dc:creator><![CDATA[Balvinder Singh]]></dc:creator>
            <pubDate>Mon, 14 Oct 2024 09:48:38 GMT</pubDate>
            <atom:updated>2024-10-14T09:48:38.620Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What Tech Stack should you target for a Job Search?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/tekraze/what-tech-stack-should-you-target-for-a-job-search-c4003312f4c9?source=rss----a09df5e845a2---4"><img src="https://cdn-images-1.medium.com/max/1200/1*GHQej5xY9wP6Jr5q7yRrlA.jpeg" width="1200"></a></p><p class="medium-feed-snippet">Hi everyone, it has been a while since we wrote these types of posts in the development category. We started a Tutorial series about&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/tekraze/what-tech-stack-should-you-target-for-a-job-search-c4003312f4c9?source=rss----a09df5e845a2---4">Continue reading on Tekraze »</a></p></div>]]></description>
            <link>https://medium.com/tekraze/what-tech-stack-should-you-target-for-a-job-search-c4003312f4c9?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/c4003312f4c9</guid>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[guide]]></category>
            <dc:creator><![CDATA[Balvinder Singh]]></dc:creator>
            <pubDate>Mon, 14 Oct 2024 09:19:45 GMT</pubDate>
            <atom:updated>2024-10-14T09:19:45.660Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Setting Up a ReactJs and Nextjs Project]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/tekraze/setting-up-a-reactjs-and-nextjs-project-68c45b184f63?source=rss----a09df5e845a2---4"><img src="https://cdn-images-1.medium.com/max/1200/1*n9eGNlbDf2RNRD5M4UpbHA.jpeg" width="1200"></a></p><p class="medium-feed-snippet">Introduction to Setting up a ReactJS project</p><p class="medium-feed-link"><a href="https://medium.com/tekraze/setting-up-a-reactjs-and-nextjs-project-68c45b184f63?source=rss----a09df5e845a2---4">Continue reading on Tekraze »</a></p></div>]]></description>
            <link>https://medium.com/tekraze/setting-up-a-reactjs-and-nextjs-project-68c45b184f63?source=rss----a09df5e845a2---4</link>
            <guid isPermaLink="false">https://medium.com/p/68c45b184f63</guid>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Balvinder Singh]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 17:35:12 GMT</pubDate>
            <atom:updated>2024-10-09T17:35:00.231Z</atom:updated>
        </item>
    </channel>
</rss>