<?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 Glxy on Medium]]></title>
        <description><![CDATA[Stories by Glxy on Medium]]></description>
        <link>https://medium.com/@codeglxy?source=rss-7478b74fc5b4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hG_IyKEne00t3kXwIB43zQ.png</url>
            <title>Stories by Glxy on Medium</title>
            <link>https://medium.com/@codeglxy?source=rss-7478b74fc5b4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 13:15:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@codeglxy/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[The Poisoned Side of Entrepreneurship]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://codeglxy.medium.com/the-poisoned-side-of-entrepreneurship-8ec6db04e0e3?source=rss-7478b74fc5b4------2"><img src="https://cdn-images-1.medium.com/max/2600/0*qGCtZmfo6rM0_wjm" width="3465"></a></p><p class="medium-feed-snippet">Why blindly following mentors, motivational talks, and startup hype can cost you years.</p><p class="medium-feed-link"><a href="https://codeglxy.medium.com/the-poisoned-side-of-entrepreneurship-8ec6db04e0e3?source=rss-7478b74fc5b4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://codeglxy.medium.com/the-poisoned-side-of-entrepreneurship-8ec6db04e0e3?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ec6db04e0e3</guid>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[business-advice]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 09:32:51 GMT</pubDate>
            <atom:updated>2025-09-22T09:32:51.477Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[From Prompt Chaos to Clarity: Why I Built PromptPilot]]></title>
            <link>https://codeglxy.medium.com/from-prompt-chaos-to-clarity-why-i-built-promptpilot-b33eb4ecab77?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b33eb4ecab77</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Mon, 21 Apr 2025 22:01:11 GMT</pubDate>
            <atom:updated>2025-04-21T22:01:11.537Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZMOLjfiycVKR_8cw" /><figcaption>Photo by <a href="https://unsplash.com/@rayyu?utm_source=medium&amp;utm_medium=referral">Rayyu Maldives</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A few months ago, I found myself staring at yet another Notion page filled with slightly different versions of the same AI prompt. One was “more engaging,” another “more concise,” and a third was the one I swore I liked best — but had somehow overwritten. I’d lost count of how many times I’d gone through this cycle. Sound familiar?</p><p>When working with LLMs became a core part of my projects, I realized something unexpected: the hardest part wasn’t generating responses — it was managing the prompts themselves.</p><p>Every time I needed to fine-tune a prompt, I’d copy-paste from old documents, tweak a few words, send it off to the model, and hope for the best. Sometimes I’d forget which version I’d used, or worse, overwrite one that had performed well. There was no version history, no side-by-side comparison, and definitely no consistent testing strategy.</p><p>And that’s when it hit me: we treat our code with care — we version it, test it, document it — but we don’t give our AI prompts the same respect. Yet they’re just as crucial.</p><p>So, I decided to build a tool for myself. Something dead simple, fast, and developer-friendly. That tool became <strong>PromptPilot</strong>.</p><h3>Building for Developer Brain</h3><p>I didn’t want a heavy GUI or a bloated all-in-one platform. I wanted a CLI that felt like git, ran fast, and stayed out of the way. PromptPilot had to feel like an extension of my natural workflow—something I could run from the terminal, script with, and integrate into my existing projects.</p><p>Here’s what I focused on:</p><ul><li><strong>Prompt Versioning</strong>: Save, list, and diff different versions of your prompts. You don’t even need Git, but it works great with it.</li><li><strong>A/B Testing</strong>: Test multiple versions of a prompt with the same input and provider. See which performs better — based on token efficiency and response quality.</li><li><strong>Multi-Provider Support</strong>: Use OpenAI, Claude, Llama, or HuggingFace. Switch models, compare outputs, optimize for cost.</li><li><strong>Organized Prompt Files</strong>: Prompts live in your repo, versioned and readable. Each version is saved as a .yml file with metadata.</li></ul><p>What started as a weekend project quickly became essential to my daily workflow.</p><h3>Why This Matters</h3><p>As more developers embed AI into products, prompt design is becoming a first-class citizen. It’s not just about getting a response — it’s about getting the <em>right</em> response, consistently. That means experimentation, refinement, and iteration. Just like we do with product features or API endpoints.</p><p>But unlike traditional code, prompts aren’t typed, tested, or linted. They’re freeform text, prone to ambiguity and subtle errors. Having a way to track their evolution, test their performance, and optimize across providers is more than helpful — it’s necessary.</p><p>PromptPilot doesn’t try to do everything. It just gives you a clean, minimal workflow to:</p><ul><li>Keep your prompt versions in check</li><li>Run repeatable tests with clear inputs and outputs</li><li>Stay organized and focused while iterating</li></ul><p>And for me, that clarity was a game changer.</p><h3>What’s Next?</h3><p>PromptPilot is still young. There’s a lot I want to add — support for collaborative prompt libraries, richer analytics, and maybe even integration with prompt marketplaces. But I’m starting simple, with what developers actually need right now.</p><p>If you’re tired of managing your prompts in a sea of sticky notes, half-finished Google Docs, or buried somewhere in your terminal history — I built this for you.</p><p>You can explore it on GitHub here: <a href="https://github.com/doganarif/promptpilot">https://github.com/doganarif/promptpilot</a></p><p>And if you have thoughts, feedback, or pain points of your own, I’d genuinely love to hear them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b33eb4ecab77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The $50,000 Silence: Why Most Product Builders Fail Before They Begin]]></title>
            <link>https://codeglxy.medium.com/the-50-000-silence-why-most-product-builders-fail-before-they-begin-9dafe7783563?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dafe7783563</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[product-development]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Wed, 12 Mar 2025 00:09:35 GMT</pubDate>
            <atom:updated>2025-03-12T00:09:35.803Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tucyo3yuPlyV3c7A.jpeg" /></figure><h3>The Moment Every Founder Dreads</h3><p>Your finger hovers over the refresh button. Again. And again.</p><p>The analytics dashboard hasn’t changed in hours. Launch day — the culmination of six months of brutal work, thousands of dollars spent, and countless sacrificed weekends — has produced nothing but deafening silence.</p><p>Five sign-ups. All from friends who haven’t even activated their accounts.</p><p>Your stomach sinks. Was it all for nothing?</p><p>This isn’t just a bad day. This is the moment 90% of product builders eventually face — the crushing realization that you’ve built something nobody wants. The moment that kills most startups before they ever have a chance to live.</p><p>But what if I told you this moment was predictable — and preventable?</p><h3>The $50,000 Mistake You’re About to Make</h3><p>Before you write a single line of code or spend a dollar on design, consider this:</p><p>The average indie hacker spends 6+ months building their product before validating it with real users. At minimum wage, that’s roughly $15,000 in opportunity cost. Factor in actual market rates for development, and many founders are effectively burning $50,000 or more on unvalidated ideas.</p><p>Would you invest $50,000 in a stock without researching it first?</p><p>Would you spend $50,000 on a house without checking if it has a foundation?</p><p>Yet every day, smart, capable founders make exactly this mistake with their most precious resources: their time, money, and passion.</p><p>Why?</p><h3>The Dopamine Trap</h3><p>There’s a neurological reason we jump straight into building: dopamine.</p><p>The chemical hit from solving technical problems. The tangible progress of watching your creation take shape. The fantasy of launch day success that keeps you going through debugging sessions at 2 AM.</p><p>“I’ll validate it after I build a basic version,” we tell ourselves, as our brains light up with each small win.</p><p>Building feels productive. Research feels nebulous. Validation feels slow.</p><p>And so the intoxicating cycle continues, until that moment of reckoning arrives: launch day silence.</p><h3>The Question That Changes Everything</h3><p>What if you flipped the entire equation?</p><p>What if instead of:</p><ul><li>6 months building → Launch → 0 users</li><li>$50,000 worth of time and resources → $0 return</li></ul><p>You followed this path:</p><ul><li>4 weeks validating → 8 weeks building → Launch → Paying customers from day one</li><li>$5,000 worth of time in validation → $20,000 in focused building → Immediate revenue</li></ul><p>This isn’t hypothetical. This is the reality for a growing movement of founders who’ve discovered the secret: validation isn’t what happens after you build — it’s what determines what you should build in the first place.</p><h3>The 80/20 Rule of Product Success</h3><p>Here’s the brutal truth most “build in public” Twitter accounts won’t tell you: 80% of your product’s success is determined before you write a single line of code.</p><p>The questions you answer before building determine everything:</p><ul><li>Are you solving a real, painful problem?</li><li>Does your target audience recognize this problem?</li><li>Are they actively seeking solutions?</li><li>Will they pay what you need to charge?</li><li>Is your solution meaningfully better than alternatives?</li></ul><p>Get these wrong, and no amount of clever marketing, sleek design, or technical excellence will save you.</p><p>Get these right, and even a minimally viable product can take off.</p><p>The math is undeniable: founders who follow systematic validation processes are 3.2x more likely to find product-market fit and do so in 68% less time.</p><h3>Inside the Black Box of Successful Validation</h3><p>But here’s where most advice falls short. “Just validate your idea” is like telling someone to “just be confident” before a job interview. The intention is good, but the execution guidance is missing.</p><p>Validation itself often feels like a black box — murky, unstructured, and overwhelming. Without a clear framework, it’s easy to:</p><ul><li>Conduct “validation theater” that only confirms your biases</li><li>Ask leading questions that give false positives</li><li>Misinterpret lukewarm interest as strong demand</li><li>Build based on what people say rather than what they do</li><li>Price based on gut feeling rather than value metrics</li></ul><p>This is precisely why so many skip validation altogether. When the path is unclear, we default to what we know: building.</p><h3>The AI-Guided Validation Revolution</h3><p>What if the expertise previously locked behind $150/hour consulting fees became accessible to every indie hacker and solo founder?</p><p>This is the promise of AI-guided validation — turning the black box of validation into a clear, repeatable process:</p><ol><li><strong>Problem Confirmation</strong>: Does this problem actually exist, how painful is it, and who feels the pain most acutely?</li><li><strong>Market Mapping</strong>: Where do your potential customers currently go for solutions, and what gaps exist?</li><li><strong>Solution Validation</strong>: What specific aspects of your solution would create must-have value?</li><li><strong>Pricing Discovery</strong>: What is the value-based price point that optimizes for both adoption and revenue?</li><li><strong>MVP Definition</strong>: What is the smallest possible product that delivers core value?</li><li><strong>Go-to-Market Validation</strong>: Where does your audience gather, and what messaging resonates with them?</li></ol><p>Each step builds on the last, creating a foundation of certainty before you invest significant resources.</p><h3>From Six Months of Silence to Six Weeks of Progress</h3><p>When you follow this framework, the transformation is dramatic:</p><ul><li>Day 1–3: Clearly define the problem and identify your ideal customer profile</li><li>Week 1: Map the competitive landscape and identify your unique opportunity</li><li>Week 2–3: Conduct 5–8 targeted customer interviews to validate core assumptions</li><li>Week 4: Create and test a simple landing page that sells your solution concept</li><li>Week 5: Analyze conversion rates and customer feedback to refine your approach</li><li>Week 6+: Begin building with confidence, focusing only on what creates core value</li></ul><p>Contrast this with the traditional approach — six months of building based on assumptions, followed by the painful realization that you’ve missed the mark.</p><p>The difference isn’t just in time saved. It’s in the psychological freedom of building with certainty rather than hope.</p><h3>The New Founder’s Unfair Advantage</h3><p>The stories from founders who’ve embraced validation-first approaches read like miracle testimonials, but they’re simply the result of a better process:</p><p>A bootstrapped SaaS founder who struggled for years now consistently finds product-market fit. His method? He doesn’t write code until he’s validated his idea through structured research and customer conversations.</p><p>A no-code builder who reduced her development time by 68% while tripling her success rate. “Validation doesn’t slow me down,” she reports. “It shows me exactly where to focus, so I build in weeks what used to take months.”</p><p>A technical founder who cut customer acquisition costs in half by deeply understanding his audience before building. “My marketing practically writes itself now because I know exactly what language resonates with my users.”</p><p>These founders aren’t working harder — they’re working smarter, using validation as their secret weapon.</p><h3>The Future Belongs to the Validated</h3><p>We’re entering a new era of product development — one where validation is no longer an afterthought but the foundation of the entire process.</p><p>The most successful founders of tomorrow won’t be those who build the fastest or have the most technical skill. They’ll be those who validate the smartest.</p><p>They’ll use AI-guided approaches to:</p><ul><li>Turn messy customer feedback into actionable insights</li><li>Identify patterns in market data that human analysis might miss</li><li>Generate and test dozens of value propositions in days, not weeks</li><li>Make data-driven decisions about features and pricing</li></ul><p>The gap between validated and non-validated products will only widen as these tools become more sophisticated and accessible.</p><h3>Your Two Possible Futures</h3><p>Two paths lie before you.</p><p>Path One: Spend the next six months building based on assumptions. Launch to crickets. Spend the following six months trying to salvage what you’ve built or, more likely, abandon it and start over.</p><p>Path Two: Spend four weeks validating systematically. Build for eight weeks with laser focus on what you know users want. Launch to a waiting audience. Iterate based on actual usage.</p><p>The resources required for both paths are similar. The outcomes couldn’t be more different.</p><p>The tools for AI-guided validation exist today, making professional-level product strategy accessible to solo founders and bootstrapped teams. LaunchLoom (https://launchloom.ai) is one such platform that’s helping founders turn the black box of validation into a clear, repeatable process.</p><h3>The $50,000 Question</h3><p>So I’ll leave you with this:</p><p>Are you willing to bet $50,000 worth of your time and energy on an unvalidated idea?</p><p>Or will you invest four weeks in validation to ensure those resources create something people actually want?</p><p>Your future users — and your future self — await your decision.</p><p><em>What validation methods have transformed your product development? Share your experiences in the comments below.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dafe7783563" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LLMDog: Streamlining Code-LLM Interactions in JetBrains IDEs]]></title>
            <link>https://codeglxy.medium.com/llmdog-streamlining-code-llm-interactions-in-jetbrains-ides-30e0ffb8e546?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/30e0ffb8e546</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Tue, 04 Feb 2025 22:21:38 GMT</pubDate>
            <atom:updated>2025-02-04T22:21:38.033Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bLtpQ4OtfE1lcAaM" /><figcaption>Photo by <a href="https://unsplash.com/@michaelfousert?utm_source=medium&amp;utm_medium=referral">Michael Fousert</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As developers increasingly incorporate AI tools like ChatGPT and Claude into their workflow, a common friction point emerges: preparing code for these conversations. Today, I’m excited to introduce LLMDog, a JetBrains IDE plugin that makes code-LLM interactions seamless and efficient.</p><h3>The Problem</h3><p>If you’ve ever used ChatGPT or similar tools for code review, debugging, or documentation, you’re probably familiar with this workflow:</p><ol><li>Select the relevant files</li><li>Copy each file’s content</li><li>Format them with proper syntax highlighting</li><li>Add file paths and context</li><li>Structure everything in Markdown</li><li>Paste into your AI chat</li><li>Repeat for any additional files</li></ol><p>This process is tedious, error-prone, and interrupts your coding flow. That’s why I created LLMDog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*YC4EoOq_zU6TCF4j7d-MEQ.gif" /></figure><h3>Enter LLMDog 🐕</h3><p>LLMDog is a plugin for JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc.) that automates the entire process of preparing code for LLM interactions. Think of it as your faithful companion that fetches and formats your code perfectly for AI discussions.</p><h3>Key Features</h3><p><strong>Simple Interface</strong></p><ul><li>Integrated tool window in your IDE</li><li>Intuitive checkbox tree for file selection</li><li>Single-click generation</li></ul><p><strong>Smart Formatting</strong></p><ul><li>Automatic Markdown generation</li><li>Proper syntax highlighting</li><li>Directory structure preservation</li><li>File path inclusion</li></ul><p><strong>Workflow Integration</strong></p><ul><li>Works with any JetBrains IDE</li><li>Supports all programming languages</li><li>Instant clipboard copy</li><li>Recursive folder handling</li></ul><h3>How It Works</h3><p>Using LLMDog is straightforward:</p><ol><li>Open the LLMDog tool window (View → Tool Windows → LLMDog)</li><li>Select files or folders using the checkbox tree</li><li>Click “Let’s Dog It!”</li><li>Paste the generated Markdown into your AI chat</li></ol><p>The plugin generates a complete report including:</p><pre># Directory Structure<br>your-project/<br>  src/<br>    main.js<br>    utils/<br>      helper.js<br><br># File Contents<br>## File: src/main.js<br>```javascript<br>// Your code here</pre><p>LLMDog aims to remove the friction from code-LLM interactions, letting you focus on the actual discussion rather than the preparation. It’s open source and available on <a href="https://github.com/doganarif/llmdog-intellij-plugin">GitHub</a></p><p>Try it out, and let me know how it fits into your workflow. I’m actively looking for feedback and suggestions for improvement.</p><blockquote>If you found this useful, consider starring the repository and sharing with your fellow developers. Every woof helps! 🐕*</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30e0ffb8e546" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing LLMDog: My Journey to Simplify File Preparation for LLMs]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://codeglxy.medium.com/introducing-llmdog-my-journey-to-simplify-file-preparation-for-llms-3fc64787c3d6?source=rss-7478b74fc5b4------2"><img src="https://cdn-images-1.medium.com/max/2600/0*u9Oq79nwB64BjHJC" width="6000"></a></p><p class="medium-feed-snippet">In today&#x2019;s rapidly evolving AI landscape, large language models (LLMs) are revolutionizing how we build applications and process data. Yet&#x2026;</p><p class="medium-feed-link"><a href="https://codeglxy.medium.com/introducing-llmdog-my-journey-to-simplify-file-preparation-for-llms-3fc64787c3d6?source=rss-7478b74fc5b4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://codeglxy.medium.com/introducing-llmdog-my-journey-to-simplify-file-preparation-for-llms-3fc64787c3d6?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fc64787c3d6</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Tue, 04 Feb 2025 05:17:03 GMT</pubDate>
            <atom:updated>2025-02-04T05:17:03.729Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Why Modern Programming Feels Like a Broken System ]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://codeglxy.medium.com/why-modern-programming-feels-like-a-broken-system-9dff7605087a?source=rss-7478b74fc5b4------2"><img src="https://cdn-images-1.medium.com/max/2600/0*R_m1VaD72Gqsb6g-" width="5047"></a></p><p class="medium-feed-snippet">In the fast-paced world of coding, it&#x2019;s easy to feel like you&#x2019;re drowning in a sea of frameworks, performance issues, and imposter&#x2026;</p><p class="medium-feed-link"><a href="https://codeglxy.medium.com/why-modern-programming-feels-like-a-broken-system-9dff7605087a?source=rss-7478b74fc5b4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://codeglxy.medium.com/why-modern-programming-feels-like-a-broken-system-9dff7605087a?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dff7605087a</guid>
            <category><![CDATA[future]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Sun, 19 Jan 2025 14:08:51 GMT</pubDate>
            <atom:updated>2025-01-19T14:08:51.842Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Building Multi-Window Desktop Apps with Electron: A Modern Web-to-Desktop Approach]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://codeglxy.medium.com/building-multi-window-desktop-apps-with-electron-a-modern-web-to-desktop-approach-2c95233d15db?source=rss-7478b74fc5b4------2"><img src="https://cdn-images-1.medium.com/max/2600/0*5-6ZeHhGzUmzpovH" width="8192"></a></p><p class="medium-feed-snippet">A developer&#x2019;s guide to embedding web content in desktop apps: From concept to production with Electron and React</p><p class="medium-feed-link"><a href="https://codeglxy.medium.com/building-multi-window-desktop-apps-with-electron-a-modern-web-to-desktop-approach-2c95233d15db?source=rss-7478b74fc5b4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://codeglxy.medium.com/building-multi-window-desktop-apps-with-electron-a-modern-web-to-desktop-approach-2c95233d15db?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c95233d15db</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[electronjs]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Fri, 29 Nov 2024 09:28:03 GMT</pubDate>
            <atom:updated>2024-11-29T09:28:03.137Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Supercharge Your PHP Applications with a Ready-to-Use PHP 8.3 FPM OpenSwoole Docker Image]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://codeglxy.medium.com/supercharge-your-php-applications-with-a-ready-to-use-php-8-3-fpm-openswoole-docker-image-4c9bdc0eea9d?source=rss-7478b74fc5b4------2"><img src="https://cdn-images-1.medium.com/max/2600/0*b8o00iJvvMzcYpxU" width="3981"></a></p><p class="medium-feed-snippet">Boost your PHP performance using a pre-built Docker image with PHP 8.3 FPM and OpenSwoole. Lightweight, fast, and ready for production.</p><p class="medium-feed-link"><a href="https://codeglxy.medium.com/supercharge-your-php-applications-with-a-ready-to-use-php-8-3-fpm-openswoole-docker-image-4c9bdc0eea9d?source=rss-7478b74fc5b4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://codeglxy.medium.com/supercharge-your-php-applications-with-a-ready-to-use-php-8-3-fpm-openswoole-docker-image-4c9bdc0eea9d?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c9bdc0eea9d</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Thu, 21 Nov 2024 10:01:57 GMT</pubDate>
            <atom:updated>2024-11-21T10:01:57.202Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Build Your Own ChatGPT for PDFs: A Complete Guide to AI-Powered Document Intelligence]]></title>
            <link>https://codeglxy.medium.com/build-your-own-chatgpt-for-pdfs-a-complete-guide-to-ai-powered-document-intelligence-5ff086498f60?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ff086498f60</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Tue, 12 Nov 2024 16:34:08 GMT</pubDate>
            <atom:updated>2024-11-12T16:40:05.814Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j0UlUx_RFAgCCf7N" /><figcaption>Photo by <a href="https://unsplash.com/@hsantos?utm_source=medium&amp;utm_medium=referral">Humberto Santos</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Ever wanted to build a system that can intelligently answer questions about your PDF documents? In this comprehensive guide, we’ll create a secure, scalable PDF Question-Answering system that combines vector search capabilities with the power of large language models. This system isn’t just about searching text — it’s about understanding documents and providing relevant, accurate answers while maintaining strict security boundaries between different teams and organizations.</p><h3>What We’re Building</h3><p>Our system provides:</p><ul><li>Secure, team-isolated document processing and storage</li><li>Intelligent question answering using OpenAI’s language models</li><li>Efficient vector search with Qdrant</li><li>Authorization-scoped access to documents and queries</li><li>RESTful API interface for easy integration</li></ul><h3>Prerequisites</h3><p>Before starting, ensure you have:</p><ul><li>Python 3.8 or higher installed</li><li>Access to OpenAI API (Azure or regular)</li><li>Qdrant vector database (running locally or in cloud)</li><li>Basic understanding of Flask and REST APIs</li><li>Understanding of authentication and authorization principles</li><li>Familiarity with async/await patterns in Python</li></ul><h3>System Architecture Overview</h3><h3>Authorization Design</h3><p>Our system implements a multi-tenant architecture using team_id as the primary authorization scope:</p><ul><li>Each team has an isolated document space</li><li>All operations (uploads, queries) are scoped to specific teams</li><li>Cross-team access is prevented by design</li><li>Team-level rate limiting and access control</li><li>Complete data isolation between different organizations</li></ul><h3>Key Components</h3><h4>PDF Processing Layer:</h4><ul><li>Text extraction and chunking</li><li>Metadata preservation</li><li>Team-scoped document storage</li></ul><h4>Vector Search Layer:</h4><ul><li>Semantic embedding generation</li><li>Efficient similarity search</li><li>Team-isolated vector spaces</li></ul><h4>Answer Generation Layer:</h4><ul><li>Context retrieval within team scope</li><li>AI-powered answer generation</li><li>Source attribution</li></ul><h4>API Layer:</h4><ul><li>Secure endpoints</li><li>Authorization middleware</li><li>Rate limiting and monitoring</li></ul><h3>Detailed Implementation</h3><h4>1. OpenAI and Embedding Setup</h4><p>First, let’s set up our AI components with proper configuration:</p><pre>from openai import AzureOpenAI<br>from sentence_transformers import SentenceTransformer<br>import os<br>from typing import Optional<br><br>class AIConfig:<br>    &quot;&quot;&quot;<br>    Configuration manager for AI services with security considerations<br>    &quot;&quot;&quot;<br>    def __init__(self):<br>        # Load configuration from environment variables for security<br>        self.openai_client = AzureOpenAI(<br>            azure_endpoint=os.getenv(&quot;AZURE_OPENAI_ENDPOINT&quot;),<br>            api_key=os.getenv(&quot;AZURE_OPENAI_API_KEY&quot;),<br>            api_version=os.getenv(&quot;AZURE_API_VERSION&quot;, &quot;2024-02-01&quot;),<br>            azure_deployment=os.getenv(&quot;AZURE_DEPLOYMENT_NAME&quot;)<br>        )<br>        <br>        # Initialize embedding model<br>        self.embedding_model = SentenceTransformer(&#39;all-MiniLM-L6-v2&#39;)<br>        <br>        # Warm up the model to prevent cold starts<br>        self._warmup()<br>    <br>    def _warmup(self):<br>        &quot;&quot;&quot;Warm up the embedding model&quot;&quot;&quot;<br>        _ = self.embedding_model.encode(&quot;Warm up text&quot;)<br>        <br>    def get_embedding(self, text: str) -&gt; list:<br>        &quot;&quot;&quot;Generate embeddings with error handling&quot;&quot;&quot;<br>        try:<br>            return self.embedding_model.encode(text).tolist()<br>        except Exception as e:<br>            print(f&quot;Error generating embedding: {str(e)}&quot;)<br>            raise<br><br># Initialize global AI configuration<br>ai_config = AIConfig()</pre><h4>2. Vector Database Setup</h4><p>Next, let’s configure our vector database with proper security measures:</p><pre># src/vector_store.py<br>from qdrant_client import QdrantClient<br>from qdrant_client.http.models import NamedVector<br>from qdrant_client.models import PointStruct, Distance, VectorParams, models<br>from typing import List, Optional<br>from src.config import config<br>import logging<br><br>logger = logging.getLogger(__name__)<br><br><br>class VectorStore:<br>    &quot;&quot;&quot;Secure vector storage management with team isolation&quot;&quot;&quot;<br><br>    def __init__(self):<br>        self.client = QdrantClient(<br>            host=config.QDRANT_HOST,<br>            port=config.QDRANT_PORT,<br>            api_key=config.QDRANT_API_KEY,<br>            https=config.QDRANT_HTTPS<br>        )<br>        self.collection_name = &quot;pdf_embeddings&quot;<br>        self.embedding_dim = 384  # Dimension for all-MiniLM-L6-v2<br><br>    def setup_collection(self) -&gt; bool:<br>        &quot;&quot;&quot;Create or recreate the vector collection&quot;&quot;&quot;<br>        try:<br>            # Remove existing collection if it exists<br>            collections = self.client.get_collections().collections<br>            if any(collection.name == self.collection_name for collection in collections):<br>                self.client.delete_collection(self.collection_name)<br>                logger.info(f&quot;Deleted existing collection &#39;{self.collection_name}&#39;&quot;)<br><br>            # Create new collection<br>            self.client.create_collection(<br>                collection_name=self.collection_name,<br>                vectors_config={<br>                    &quot;custom_vector&quot;: VectorParams(<br>                        size=self.embedding_dim,<br>                        distance=Distance.COSINE<br>                    )<br>                }<br>            )<br>            logger.info(f&quot;Created collection &#39;{self.collection_name}&#39;&quot;)<br>            return True<br><br>        except Exception as e:<br>            logger.error(f&quot;Error setting up collection: {str(e)}&quot;)<br>            raise<br><br>    def search_vectors(<br>            self,<br>            team_id: str,<br>            query_vector: List[float],<br>            limit: int = 10<br>    ) -&gt; List[PointStruct]:<br>        &quot;&quot;&quot;Search vectors within team&#39;s authorization scope&quot;&quot;&quot;<br>        try:<br>            team_filter = models.Filter(<br>                must=[<br>                    models.FieldCondition(<br>                        key=&quot;team_id&quot;,<br>                        match=models.MatchValue(value=team_id)<br>                    )<br>                ]<br>            )<br><br>            # Use NamedVector for the query<br>            return self.client.search(<br>                collection_name=self.collection_name,<br>                query_vector=NamedVector(<br>                    name=&quot;custom_vector&quot;,<br>                    vector=query_vector<br>                ),<br>                query_filter=team_filter,<br>                limit=limit<br>            )<br><br>        except Exception as e:<br>            logger.error(f&quot;Error searching vectors: {str(e)}&quot;)<br>            raise<br><br>    def upsert_points(self, points: List[PointStruct]) -&gt; bool:<br>        &quot;&quot;&quot;Insert or update points in the Qdrant collection&quot;&quot;&quot;<br>        try:<br>            response = self.client.upsert(<br>                collection_name=self.collection_name,<br>                points=points<br>            )<br>            logger.info(f&quot;Successfully upserted {len(points)} points&quot;)<br>            return True<br><br>        except Exception as e:<br>            logger.error(f&quot;Error upserting points: {str(e)}&quot;)<br>            raise<br><br><br># Initialize global vector store<br>vector_store = VectorStore()</pre><h4>3. Secure PDF Processing Pipeline</h4><p>Let’s implement our PDF processing with proper team isolation:</p><pre>import pdfplumber<br>from typing import List, Any<br>from werkzeug.utils import secure_filename<br>from src.ai_service import ai_service<br>from src.vector_store import vector_store<br>from qdrant_client.models import PointStruct<br>import uuid<br>import logging<br><br>logger = logging.getLogger(__name__)<br><br><br>class DocumentProcessor:<br>    &quot;&quot;&quot;Secure document processing with team isolation&quot;&quot;&quot;<br><br>    def process_pdf(<br>            self,<br>            pdf_file: Any,<br>            team_id: str,<br>            doc_name: str,<br>            document_id: str,<br>            chunk_size: int = 500<br>    ) -&gt; List[PointStruct]:<br>        &quot;&quot;&quot;Process PDF with team-scoped authorization&quot;&quot;&quot;<br>        try:<br>            points = []<br>            doc_name = secure_filename(doc_name)<br><br>            with pdfplumber.open(pdf_file) as pdf:<br>                for page_num, page in enumerate(pdf.pages, start=1):<br>                    text = page.extract_text()<br>                    if not text:<br>                        continue<br><br>                    # Create chunks<br>                    chunks = self._create_chunks(text, chunk_size)<br><br>                    # Generate embeddings<br>                    embeddings = [ai_service.get_embedding(chunk) for chunk in chunks]<br><br>                    # Create points<br>                    points.extend(self._create_points(<br>                        chunks, embeddings, team_id, doc_name,<br>                        document_id, page_num<br>                    ))<br><br>            # Store vectors<br>            if points:<br>                vector_store.upsert_points(points)<br><br>            return points<br><br>        except Exception as e:<br>            logger.error(f&quot;Error processing PDF: {str(e)}&quot;)<br>            raise<br><br>    def _create_chunks(self, text: str, chunk_size: int) -&gt; List[str]:<br>        &quot;&quot;&quot;Create overlapping chunks from text&quot;&quot;&quot;<br>        chunks = []<br>        for i in range(0, len(text), chunk_size):<br>            chunk = text[max(0, i - 50):i + chunk_size]<br>            chunks.append(chunk)<br>        return chunks<br><br>    def _create_points(<br>            self,<br>            chunks: List[str],<br>            embeddings: List[List[float]],<br>            team_id: str,<br>            doc_name: str,<br>            document_id: str,<br>            page_num: int<br>    ) -&gt; List[PointStruct]:<br>        &quot;&quot;&quot;Create points for vector storage&quot;&quot;&quot;<br>        points = []<br>        for i, (chunk, embedding) in enumerate(zip(chunks, embeddings)):<br>            point = PointStruct(<br>                id=str(uuid.uuid4()),<br>                vector={&quot;custom_vector&quot;: embedding},<br>                payload={<br>                    &quot;team_id&quot;: team_id,<br>                    &quot;doc_name&quot;: doc_name,<br>                    &quot;document_id&quot;: document_id,<br>                    &quot;page_number&quot;: page_num,<br>                    &quot;chunk_index&quot;: i,<br>                    &quot;text&quot;: chunk,<br>                    &quot;embedding_model&quot;: &quot;all-MiniLM-L6-v2&quot;<br>                }<br>            )<br>            points.append(point)<br>        return points<br><br><br># Initialize global document processor<br>document_processor = DocumentProcessor()</pre><h4>4. Answer Generation with Authorization</h4><p>Implement secure answer generation with team isolation:</p><pre>class AnswerGenerator:<br>    &quot;&quot;&quot;<br>    Generate answers within team authorization scope<br>    &quot;&quot;&quot;<br>    def __init__(self, ai_config: AIConfig, vector_store: VectorStore):<br>        self.ai_config = ai_config<br>        self.vector_store = vector_store<br>        <br>    def generate_answer(self, team_id: str, question: str) -&gt; Dict[str, Any]:<br>        &quot;&quot;&quot;<br>        Generate answers using only team-authorized documents<br>        &quot;&quot;&quot;<br>        # Validate authorization<br>        if not self._validate_team_id(team_id):<br>            return {<br>                &quot;answer&quot;: &quot;Unauthorized access&quot;,<br>                &quot;sources&quot;: [],<br>                &quot;status&quot;: &quot;error&quot;<br>            }<br>            <br>        try:<br>            # Generate question embedding<br>            query_vector = self.ai_config.get_embedding(question)<br>            <br>            # Get relevant documents within team scope<br>            points = self.vector_store.search_vectors(team_id, query_vector, limit=15)<br>            <br>            if not points:<br>                return {<br>                    &quot;answer&quot;: &quot;No relevant documents found&quot;,<br>                    &quot;sources&quot;: [],<br>                    &quot;status&quot;: &quot;no_context&quot;<br>                }<br>            <br>            # Prepare context with source tracking<br>            context_parts = []<br>            sources = set()<br>            seen_text = set()<br>            <br>            for point in points:<br>                if point.payload:<br>                    text = point.payload.get(&#39;text&#39;, &#39;&#39;).strip()<br>                    # Deduplicate similar content<br>                    if text in seen_text:<br>                        continue<br>                    <br>                    doc_info = f&quot;[Document: {point.payload.get(&#39;doc_name&#39;)}, Page: {point.payload.get(&#39;page_number&#39;)}]&quot;<br>                    context_parts.append(f&quot;{doc_info}\n{text}&quot;)<br>                    sources.add((<br>                        point.payload.get(&#39;doc_name&#39;),<br>                        point.payload.get(&#39;page_number&#39;)<br>                    ))<br>                    seen_text.add(text)<br>            <br>            # Generate answer using AI<br>            messages = [<br>                {<br>                    &quot;role&quot;: &quot;system&quot;,<br>                    &quot;content&quot;: (<br>                        &quot;You are a helpful assistant that provides accurate, &quot;<br>                        &quot;comprehensive answers based on the given context. &quot;<br>                        &quot;Always cite your sources using [Document: X, Page: Y] format.&quot;<br>                    )<br>                },<br>                {<br>                    &quot;role&quot;: &quot;user&quot;,<br>                    &quot;content&quot;: (<br>                        f&quot;Answer this question using only the context provided. &quot;<br>                        f&quot;If you cannot answer based on the context, say so.\n\n&quot;<br>                        f&quot;Context:\n{&#39; &#39;.join(context_parts)}\n\n&quot;<br>                        f&quot;Question: {question}&quot;<br>                    )<br>                }<br>            ]<br>            <br>            response = self.ai_config.openai_client.chat.completions.create(<br>                model=os.getenv(&quot;OPENAI_MODEL_DEPLOYMENT&quot;),<br>                messages=messages,<br>                max_tokens=1000,<br>                temperature=0.2<br>            )<br>            <br>            return {<br>                &quot;answer&quot;: response.choices[0].message.content.strip(),<br>                &quot;sources&quot;: list(sources),<br>                &quot;status&quot;: &quot;success&quot;<br>            }<br>            <br>        except Exception as e:<br>            return {<br>                &quot;answer&quot;: &quot;Error generating answer&quot;,<br>                &quot;sources&quot;: [],<br>                &quot;status&quot;: &quot;error&quot;,<br>                &quot;error&quot;: str(e)<br>            }<br>            <br>    def _validate_team_id(self, team_id: str) -&gt; bool:<br>        &quot;&quot;&quot;<br>        Validate team_id authorization<br>        Implementation depends on your authentication system<br>        &quot;&quot;&quot;<br>        # Add your team validation logic here<br>        return bool(team_id and isinstance(team_id, str))<br><br># Initialize global answer generator<br>answer_generator = AnswerGenerator(ai_config, vector_store)</pre><h4>5. Secure API Layer</h4><p>Implement the API with proper authorization and security:</p><pre>from flask import Flask, request, jsonify<br>from functools import wraps<br>import time<br><br>app = Flask(__name__)<br>app.config[&#39;MAX_CONTENT_LENGTH&#39;] = 16 * 1024 * 1024  # 16MB max file size<br><br># Rate limiting configuration<br>RATE_LIMIT = {<br>    &quot;window&quot;: 60,  # seconds<br>    &quot;max_requests&quot;: 100  # requests per window<br>}<br><br>class RateLimiter:<br>    &quot;&quot;&quot;Simple in-memory rate limiter&quot;&quot;&quot;<br>    def __init__(self):<br>        self.requests = {}<br>    <br>    def is_allowed(self, team_id: str) -&gt; bool:<br>        now = time.time()<br>        team_requests = self.requests.get(team_id, [])<br>        <br>        # Clean old requests<br>        team_requests = [req_time for req_time in team_requests <br>                        if now - req_time &lt; RATE_LIMIT[&quot;window&quot;]]<br>        <br>        if len(team_requests) &gt;= RATE_LIMIT[&quot;max_requests&quot;]:<br>            return False<br>            <br>        team_requests.append(now)<br>        self.requests[team_id] = team_requests<br>        return True<br><br>rate_limiter = RateLimiter()<br><br>def require_team_auth(f):<br>    &quot;&quot;&quot;Authorization middleware&quot;&quot;&quot;<br>    @wraps(f)<br>    def decorated_function(*args, **kwargs):<br>        # Get team_id from request<br>        team_id = request.form.get(&#39;team_id&#39;) or request.json.get(&#39;team_id&#39;)<br>        <br>        if not team_id:<br>            return jsonify({&quot;error&quot;: &quot;team_id is required&quot;}), 401<br>            <br>        # Check rate limit<br>        if not rate_limiter.is_allowed(team_id):<br>            return jsonify({&quot;error&quot;: &quot;Rate limit exceeded&quot;}), 429<br>            <br>        # Add your additional authorization checks here<br>        # For example, validating JWT tokens, checking team membership, etc.<br>        <br>        return f(*args, **kwargs)<br>    return decorated_function<br><br>@app.post(&#39;/answer&#39;)<br>@require_team_auth<br>def get_answer():<br>    &quot;&quot;&quot;<br>    Generate answer for question within team scope<br>    &quot;&quot;&quot;<br>    try:<br>        data = request.json<br>        team_id = data.get(&#39;team_id&#39;)<br>        question = data.get(&#39;question&#39;)<br>        <br>        if not question:<br>            return jsonify({&quot;error&quot;: &quot;Question is required&quot;}), 400<br>            <br>        response = answer_generator.generate_answer(team_id, question)<br>        return jsonify(response)<br>        <br>    except Exception as e:<br>        return jsonify({&quot;error&quot;: str(e)}), 500<br><br>```python<br>@app.route(&quot;/upload&quot;, methods=[&#39;POST&#39;])<br>@require_team_auth<br>def upload_file():<br>    &quot;&quot;&quot;<br>    Upload and process PDF within team scope<br>    &quot;&quot;&quot;<br>    try:<br>        # Validate request<br>        if &#39;file&#39; not in request.files:<br>            return jsonify({&quot;error&quot;: &quot;No file part&quot;}), 400<br>            <br>        file = request.files[&#39;file&#39;]<br>        if file.filename == &#39;&#39;:<br>            return jsonify({&quot;error&quot;: &quot;No selected file&quot;}), 400<br>            <br>        if not file.filename.endswith(&#39;.pdf&#39;):<br>            return jsonify({&quot;error&quot;: &quot;Only PDF files are allowed&quot;}), 400<br>        <br>        team_id = request.form[&#39;team_id&#39;]<br>        document_id = request.form[&#39;document_id&#39;]<br>        <br>        # Process file with team scope<br>        chunks = doc_processor.process_pdf(<br>            pdf_file=file,<br>            team_id=team_id,<br>            doc_name=secure_filename(file.filename),<br>            document_id=document_id<br>        )<br>        <br>        return jsonify({<br>            &quot;status&quot;: &quot;success&quot;,<br>            &quot;chunks_processed&quot;: len(chunks),<br>            &quot;document_id&quot;: document_id<br>        })<br>        <br>    except Exception as e:<br>        return jsonify({<br>            &quot;error&quot;: str(e),<br>            &quot;status&quot;: &quot;error&quot;<br>        }), 500<br><br>@app.route(&quot;/documents&quot;, methods=[&#39;GET&#39;])<br>@require_team_auth<br>def list_documents():<br>    &quot;&quot;&quot;<br>    List documents available for a team<br>    &quot;&quot;&quot;<br>    team_id = request.args.get(&#39;team_id&#39;)<br>    <br>    try:<br>        # Query vector store for team&#39;s documents<br>        filter_query = Filter(<br>            must=[<br>                FieldCondition(<br>                    key=&quot;team_id&quot;,<br>                    match=MatchValue(value=team_id)<br>                )<br>            ]<br>        )<br>        <br>        # Get unique documents<br>        points = vector_store.client.scroll(<br>            collection_name=vector_store.collection_name,<br>            scroll_filter=filter_query,<br>            limit=1000  # Adjust based on your needs<br>        )<br>        <br>        # Extract unique document information<br>        documents = set()<br>        for point in points[0]:  # points[0] contains the actual points<br>            if point.payload:<br>                documents.add((<br>                    point.payload.get(&#39;document_id&#39;),<br>                    point.payload.get(&#39;doc_name&#39;)<br>                ))<br>        <br>        return jsonify({<br>            &quot;status&quot;: &quot;success&quot;,<br>            &quot;documents&quot;: [<br>                {&quot;id&quot;: doc_id, &quot;name&quot;: doc_name}<br>                for doc_id, doc_name in documents<br>            ]<br>        })<br>        <br>    except Exception as e:<br>        return jsonify({<br>            &quot;error&quot;: str(e),<br>            &quot;status&quot;: &quot;error&quot;<br>        }), 500<br><br># Environmental configuration<br>if __name__ == &quot;__main__&quot;:<br>    # Initialize vector store collection<br>    vector_store.setup_collection()<br>    <br>    # Configure server<br>    app.run(<br>        host=&#39;0.0.0.0&#39;,<br>        port=int(os.getenv(&#39;PORT&#39;, 8000)),<br>        debug=os.getenv(&#39;DEBUG&#39;, &#39;False&#39;).lower() == &#39;true&#39;,<br>        ssl_context=&#39;adhoc&#39; if os.getenv(&#39;ENABLE_HTTPS&#39;, &#39;False&#39;).lower() == &#39;true&#39; else None<br>    )</pre><h3>System Usage Examples</h3><h4>1. Upload a Document</h4><pre>import requests<br><br>def upload_document(file_path: str, team_id: str, document_id: str):<br>    &quot;&quot;&quot;Example: Upload a PDF document&quot;&quot;&quot;<br>    with open(file_path, &#39;rb&#39;) as file:<br>        response = requests.post(<br>            &#39;http://localhost:8000/upload&#39;,<br>            files={&#39;file&#39;: file},<br>            data={<br>                &#39;team_id&#39;: team_id,<br>                &#39;document_id&#39;: document_id<br>            }<br>        )<br>    return response.json()</pre><h4>2. Ask Questions</h4><pre>def ask_question(team_id: str, question: str):<br>    &quot;&quot;&quot;Example: Ask a question about uploaded documents&quot;&quot;&quot;<br>    response = requests.post(<br>        &#39;http://localhost:8000/answer&#39;,<br>        json={<br>            &#39;team_id&#39;: team_id,<br>            &#39;question&#39;: question<br>        }<br>    )<br>    return response.json()</pre><h3>Deployment Guide</h3><h4>Docker Setup</h4><p>Create a Dockerfile for the application:</p><pre>FROM python:3.9-slim<br><br># Set working directory<br>WORKDIR /app<br><br># Install system dependencies<br>RUN apt-get update &amp;&amp; \<br>    apt-get install -y --no-install-recommends \<br>    build-essential \<br>    &amp;&amp; rm -rf /var/lib/apt/lists/*<br><br># Copy requirements first for better caching<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br><br># Copy application code<br>COPY . .<br><br># Set environment variables<br>ENV PYTHONUNBUFFERED=1<br>ENV PYTHONDONTWRITEBYTECODE=1<br><br># Run the application<br>CMD [&quot;python&quot;, &quot;app.py&quot;]</pre><h4>Docker Compose Configuration</h4><pre>version: &#39;3.8&#39;<br><br>services:<br>  app:<br>    build: .<br>    ports:<br>      - &quot;8000:8000&quot;<br>    environment:<br>      - AZURE_OPENAI_ENDPOINT=${AZURE_OPENAI_ENDPOINT}<br>      - AZURE_OPENAI_API_KEY=${AZURE_OPENAI_API_KEY}<br>      - AZURE_API_VERSION=${AZURE_API_VERSION}<br>      - AZURE_DEPLOYMENT_NAME=${AZURE_DEPLOYMENT_NAME}<br>      - QDRANT_HOST=qdrant<br>      - QDRANT_PORT=6333<br>      - ENABLE_HTTPS=false<br>    depends_on:<br>      - qdrant<br>    networks:<br>      - app-network<br><br>  qdrant:<br>    image: qdrant/qdrant<br>    ports:<br>      - &quot;6333:6333&quot;<br>    volumes:<br>      - qdrant_data:/qdrant/storage<br>    networks:<br>      - app-network<br><br>networks:<br>  app-network:<br>    driver: bridge<br><br>volumes:<br>  qdrant_data:</pre><h4>2. Security Headers</h4><p>Implement secure headers middleware:</p><pre>from flask_talisman import Talisman<br><br># Initialize Talisman with security headers<br>Talisman(app,<br>    force_https=True,<br>    strict_transport_security=True,<br>    session_cookie_secure=True,<br>    content_security_policy={<br>        &#39;default-src&#39;: &quot;&#39;self&#39;&quot;,<br>        &#39;img-src&#39;: &#39;*&#39;,<br>        &#39;script-src&#39;: &quot;&#39;self&#39;&quot;<br>    }<br>)</pre><h3>Monitoring and Maintenance</h3><h4>1. Health Check Implementation</h4><pre>@app.route(&quot;/health&quot;, methods=[&#39;GET&#39;])<br>def health_check():<br>    &quot;&quot;&quot;System health check endpoint&quot;&quot;&quot;<br>    try:<br>        # Check components<br>        health_status = {<br>            &quot;vector_store&quot;: &quot;healthy&quot;,<br>            &quot;openai&quot;: &quot;healthy&quot;,<br>            &quot;timestamp&quot;: time.time()<br>        }<br>        <br>        # Test vector store<br>        vector_store.client.get_collections()<br>        <br>        # Test OpenAI connection<br>        ai_config.get_embedding(&quot;test&quot;)<br>        <br>        return jsonify(health_status)<br>        <br>    except Exception as e:<br>        return jsonify({<br>            &quot;status&quot;: &quot;unhealthy&quot;,<br>            &quot;error&quot;: str(e)<br>        }), 500</pre><h4>2. Logging Configuration</h4><pre>import logging.config<br><br># Configure logging<br>logging.config.dictConfig({<br>    &#39;version&#39;: 1,<br>    &#39;disable_existing_loggers&#39;: False,<br>    &#39;formatters&#39;: {<br>        &#39;standard&#39;: {<br>            &#39;format&#39;: &#39;%(asctime)s [%(levelname)s] %(name)s: %(message)s&#39;<br>        },<br>    },<br>    &#39;handlers&#39;: {<br>        &#39;default&#39;: {<br>            &#39;level&#39;: &#39;INFO&#39;,<br>            &#39;formatter&#39;: &#39;standard&#39;,<br>            &#39;class&#39;: &#39;logging.StreamHandler&#39;,<br>        },<br>        &#39;file&#39;: {<br>            &#39;level&#39;: &#39;INFO&#39;,<br>            &#39;formatter&#39;: &#39;standard&#39;,<br>            &#39;class&#39;: &#39;logging.FileHandler&#39;,<br>            &#39;filename&#39;: &#39;app.log&#39;,<br>            &#39;mode&#39;: &#39;a&#39;,<br>        },<br>    },<br>    &#39;loggers&#39;: {<br>        &#39;&#39;: {<br>            &#39;handlers&#39;: [&#39;default&#39;, &#39;file&#39;],<br>            &#39;level&#39;: &#39;INFO&#39;,<br>            &#39;propagate&#39;: True<br>        }<br>    }<br>})<br><br>logger = logging.getLogger(__name__)</pre><h3>Conclusion</h3><p>This implementation provides a robust, secure foundation for building a PDF question-answering system. Key features include:</p><h4>Security</h4><ul><li>Team-based isolation</li><li>Rate limiting</li><li>Secure file handling</li><li>Authorization middleware</li></ul><h4>Scalability</h4><ul><li>Docker containerization</li><li>Efficient vector search</li><li>Modular design</li></ul><h4>Maintainability</h4><ul><li>Comprehensive logging</li><li>Health monitoring</li><li>Clear documentation</li></ul><p>Remember to:</p><ul><li>Keep dependencies updated</li><li>Monitor system performance</li><li>Regularly backup vector data</li><li>Review security configurations</li><li>Test thoroughly before deployment</li></ul><p>This guide provides a foundation for building intelligent document systems. Ready to implement it in your organization or need help with a custom solution? I’m available for select consulting projects and technical advisory roles, focusing on production-grade AI systems. Let’s discuss your implementation: <a href="/service/mailto:me@arif.sh">me@arif.sh</a></p><p><strong>Full Source Code:</strong> <a href="https://github.com/doganarif/pdf-gpt-vectordb-qa">github.com/doganarif/pdf-gpt-vectordb-qa</a></p><p><em>Star ⭐️ the repository if you found this guide helpful!</em></p><p>⚡ Happy Building!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ff086498f60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI Journal App: A Beginner’s Learning Journey]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://codeglxy.medium.com/swiftui-journal-app-a-beginners-learning-journey-b45f517978e0?source=rss-7478b74fc5b4------2"><img src="https://cdn-images-1.medium.com/max/2600/0*itVuskh6Yww8WpuA" width="5616"></a></p><p class="medium-feed-snippet">Diving into SwiftUI has been an exciting adventure for me. As someone new to iOS development, I decided to create a simple journal app to&#x2026;</p><p class="medium-feed-link"><a href="https://codeglxy.medium.com/swiftui-journal-app-a-beginners-learning-journey-b45f517978e0?source=rss-7478b74fc5b4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://codeglxy.medium.com/swiftui-journal-app-a-beginners-learning-journey-b45f517978e0?source=rss-7478b74fc5b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b45f517978e0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Glxy]]></dc:creator>
            <pubDate>Fri, 27 Sep 2024 13:02:15 GMT</pubDate>
            <atom:updated>2024-09-27T13:02:15.531Z</atom:updated>
        </item>
    </channel>
</rss>