<?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 Japan Gor on Medium]]></title>
        <description><![CDATA[Stories by Japan Gor on Medium]]></description>
        <link>https://medium.com/@japangor?source=rss-be1bf8285f8b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*k6yRjgSKnVmYKpzZMup07w.jpeg</url>
            <title>Stories by Japan Gor on Medium</title>
            <link>https://medium.com/@japangor?source=rss-be1bf8285f8b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 17:43:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@japangor/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[I Wanted FlightRadar24 for Trains. It Didn’t Exist.]]></title>
            <link>https://medium.com/gjam/i-wanted-flightradar24-for-trains-it-didnt-exist-970c68445b27?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/970c68445b27</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[travelaapp]]></category>
            <category><![CDATA[travel]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[railways]]></category>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Sun, 07 Jun 2026 11:50:19 GMT</pubDate>
            <atom:updated>2026-07-04T10:41:43.032Z</atom:updated>
            <content:encoded><![CDATA[<h3>So I started exploring what real-time train tracking could look like for India’s railway network.<br>https://play.google.com/store/apps/details?id=com.railways</h3><figure><img alt="https://play.google.com/store/apps/details?id=com.railways" src="https://cdn-images-1.medium.com/max/1024/1*nNO_g4GzpQVG23b5pft-lg.png" /></figure><p>India operates one of the world’s largest railway networks, carrying millions of passengers daily. Yet there wasn’t a simple way to visualize train movement the way flight tracking platforms visualize aircraft.</p><p>More than the product itself, what fascinated me was the challenge: turning a massive, constantly moving railway network into something people could understand at a glance.<br><a href="https://play.google.com/store/apps/details?id=com.railways">https://play.google.com/store/apps/details?id=com.railways</a></p><p><a href="https://rail24.in/">https://rail24.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=970c68445b27" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gjam/i-wanted-flightradar24-for-trains-it-didnt-exist-970c68445b27">I Wanted FlightRadar24 for Trains. It Didn’t Exist.</a> was originally published in <a href="https://medium.com/gjam">GJAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I built an AI travel-itinerary SaaS in 14 days with Next.js,]]></title>
            <link>https://japangor.medium.com/i-built-an-ai-travel-itinerary-saas-in-14-days-with-next-js-3474d822b3d7?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3474d822b3d7</guid>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Sat, 23 May 2026 16:13:43 GMT</pubDate>
            <atom:updated>2026-05-23T16:14:49.966Z</atom:updated>
            <content:encoded><![CDATA[<h3>I built an AI travel-itinerary SaaS in 14 days with Next.js, Postgres and OpenAI — here’s what shipped and what broke</h3><p>Travel agencies still write quotes in **Word + Excel + Canva + WhatsApp screenshots**. A single inquiry takes 1–3 hours to turn into a sent quote. By the time the agent hits <em>*Send*</em>, three competitors already replied.</p><p>I run a travel business myself ([Shree Kanaiya Travels](https://www.kanaiyatravels.com)) and I watched our sales team lose deals like this every single week. So I built **TripQuote**: paste a customer’s WhatsApp inquiry → AI drafts a full day-by-day itinerary with hotels, meals, transport and a price suggestion → export a branded PDF or share a public quote link with built-in lead capture.</p><p>I open-sourced the build process for one reason: indie devs constantly ask <em>*”what should I build?”*</em> and the answer is rarely <em>*”another todo app”*</em>. It’s <em>*”watch a real business owner suffer for 20 minutes, then fix that exact pain”*</em>. This is that build.</p><p>If you just want the product: [TripQuote on Gumroad → from $49 lifetime](https://japangor.gumroad.com/l/quote).</p><p>## The stack (and why each choice)</p><p>```</p><p>Next.js 14 (App Router) → one framework for marketing + dashboard + API</p><p>TypeScript → every API boundary is Zod-validated</p><p>PostgreSQL + Drizzle ORM → multi-tenant from day one</p><p>Tailwind CSS → shadcn-style handcrafted components</p><p>@react-pdf/renderer → server-side branded PDFs</p><p>OpenAI GPT-4o-mini → cheap, fast, structured JSON output</p><p>JWT in HTTP-only cookies → no NextAuth bloat</p><p>Docker + docker-compose → one-command local dev</p><p>```</p><p>A few non-obvious calls:</p><p>### 1. Why Drizzle ORM, not Prisma</p><p>Prisma’s generated client is huge (~13 MB) and the migration UX makes me want to scream. Drizzle is a thin SQL-shaped layer with the <em>*best*</em> TypeScript inference I’ve used. Migrations are plain SQL files you check into git. It works on Neon, Supabase, RDS, anywhere.</p><p>### 2. Why GPT-4o-mini, not GPT-4o</p><p>For <em>*structured*</em> outputs (a day-by-day itinerary object), `4o-mini` hits the same JSON schema 95% of the time at **1/30th the cost**. We’re not writing poetry — we’re filling fields. Cost per itinerary: roughly **$0.001**. A travel agency does maybe 30 itineraries a day = **$0.90/month** in AI bills.</p><p>### 3. Why HTTP-only JWT cookies, not NextAuth</p><p>NextAuth solves a problem we don’t have (federated identity, magic links). For a B2B SaaS where the agency owner logs in with email + password, a 30-line auth file with `jose` + `bcryptjs` is the entire spec.</p><p>### 4. Why @react-pdf/renderer, not Puppeteer / wkhtmltopdf</p><p>Puppeteer needs a headless Chrome (200+ MB) on every server. `@react-pdf/renderer` is pure JS, renders identically on Vercel / Docker / a $4 VPS, and the template is just React components — designers can edit it without learning anything new.</p><p>— -</p><p>## The architecture in one diagram</p><p>```</p><p>┌─────────────────────────────────────────────────────────────┐</p><p>│ / marketing landing │</p><p>│ /signup, /login JWT auth │</p><p>│ /dashboard, /itineraries agency dashboard │</p><p>│ /q/[token] PUBLIC mobile-first quote page │</p><p>│ /api/ai/draft POST {inquiry} → JSON itinerary │</p><p>│ /api/pdf/[id] GET → branded PDF stream │</p><p>│ /api/q/[token]/lead POST lead capture from public │</p><p>└─────────────────────────────────────────────────────────────┘</p><p>┌──────────────┐ ┌─────────────┐ ┌──────────────┐</p><p>│ Browser │ ─→ │ Next.js 14 │ ─→ │ PostgreSQL │</p><p>│ (Agency UI) │ │ middleware │ │ (Drizzle) │</p><p>└──────────────┘ │ + APIs │ └──────────────┘</p><p>└─────────────┘</p><p>│</p><p>↓</p><p>┌─────────────┐</p><p>│ OpenAI │</p><p>│ GPT-4o-mini│</p><p>└─────────────┘</p><p>```</p><p>Multi-tenant from day one: every row in every table has an `agency_id`. A single deploy can host 1 agency or 1000. The SaaS-tier license on Gumroad lets buyers run it as their own white-label SaaS.</p><p>— -</p><p>## The 7 hardest engineering decisions (and how I lost an evening to each)</p><p>### Decision 1 — Single shareable token vs auth-gated quote links</p><p>The customer should be able to open the quote page from a WhatsApp link **without signing up**. But spamming `agency-id + itinerary-id` in a URL is leaky. The fix: every published itinerary gets a random `shareToken` (16 chars, base62). The public route `/q/[token]` looks up by token only. View tracking is anonymous; lead capture is unauthenticated.</p><p>```ts</p><p><em>// src/app/api/itineraries/[id]/publish/route.ts</em></p><p>const shareToken = nanoid(16);</p><p>await db.update(itineraries)</p><p>.set({ status: “published”, shareToken, publishedAt: new Date() })</p><p>.where(eq(itineraries.id, id));</p><p>```</p><p>### Decision 2 — Structuring the AI prompt for JSON output</p><p>OpenAI’s “JSON mode” is non-negotiable for production. The trick is giving the model an <em>*exact*</em> schema example in the system prompt — not a Zod schema, not TypeScript, but a literal example JSON it can pattern-match.</p><p>```ts</p><p><em>// src/lib/ai.ts (excerpt)</em></p><p>const SYSTEM_PROMPT = `You are a senior travel-itinerary planner…</p><p>Respond with ONLY this JSON shape — no prose:</p><p>{</p><p>“title”: “Kashmir Paradise 5N/6D”,</p><p>“days”: [</p><p>{ “day”: 1, “title”: “Arrive Srinagar”, “hotel”: “Houseboat”, … }</p><p>],</p><p>“pricePerPerson”: 24999,</p><p>“currency”: “INR”,</p><p>…</p><p>}`;</p><p>```</p><p>Hit rate went from 60% → 99% the moment I switched from “describe the schema” to “show an example object”.</p><p>### Decision 3 — Routing conflict that killed the public quote page</p><p>I had `/api/q/[id]/lead` and `/api/q/[token]/view` side by side. **Next.js does not allow two different dynamic slug names at the same path depth.** Took me 40 minutes of <em>*”works on my machine”*</em> before I read the build warning carefully. Fix: rename everything to `[token]`, treat tokens as the only identifier on public routes.</p><p>If you ever see `Error: You cannot use different slug names for the same dynamic path`, this is what it means.</p><p>### Decision 4 — PDF font failure on production</p><p>`@react-pdf/renderer` lets you load fonts via `Font.register({ family, src })`. In dev it works. On Vercel it sometimes times out fetching from `fonts.gstatic.com`, leaving the PDF blank. Fix: use the **built-in Helvetica** (it ships with the library) and only register custom fonts when you’ve bundled them locally:</p><p>```tsx</p><p>import { Font } from “@react-pdf/renderer”;</p><p><em>// DO NOT do this in prod:</em></p><p><em>// Font.register({ family: “Inter”, src: “https://fonts.gstatic.com/...&quot; });</em></p><p><em>// DO this:</em></p><p><em>// just use { fontFamily: “Helvetica” } — already bundled</em></p><p>```</p><p>### Decision 5 — Empty strings break React-PDF</p><p>`&lt;Text&gt;{value}&lt;/Text&gt;` where `value === “”` throws <em>*”Invalid ‘’ string child outside &lt;Text&gt;”*</em> during PDF generation. Sanitise everything:</p><p>```ts</p><p><em>// src/lib/format.ts</em></p><p>export function cleanText(<em>v</em>: unknown): string {</p><p>if (typeof v !== “string”) return “”;</p><p>const t = v.trim();</p><p>return t.length ? t : “ — “; <em>// ← always render at least a dash</em></p><p>}</p><p>```</p><p>### Decision 6 — Middleware vs API route auth</p><p>For HTML pages, redirect to `/login`. For API routes, return `401 JSON`. Same middleware file, different branches. The mistake I made for a day: putting <em>*everything*</em> through the redirect path, which made `fetch(‘/api/…’)` calls follow a 307 and return HTML instead of JSON. Always branch on `pathname.startsWith(‘/api/’)`.</p><p>### Decision 7 — Building marketing &amp; SEO into the <em>*same*</em> deploy</p><p>I almost set up a separate static-HTML subdomain for SEO landing pages. Then I realised Next.js 14’s `generateStaticParams` + `(marketing)` route group lets me build 7 fully-SSG’d SEO pages inside the same app — sharing the same Tailwind, the same Gumroad CTA component, the same canonical-URL logic. One deploy, one domain, one bundle. **Don’t fragment your stack to optimise for SEO**; SSG handles it.</p><p>— -</p><p>## The numbers</p><p>| Metric | Value |</p><p>| — -| — -|</p><p>| Total source files | ~120 |</p><p>| Lines of TypeScript | ~4,200 |</p><p>| Days from idea to v1.0 | 14 (evenings + weekends) |</p><p>| Cold-start time on Vercel | 280 ms |</p><p>| Cost per AI itinerary | ~$0.001 |</p><p>| Lighthouse score (mobile) | 96 perf / 100 SEO |</p><p>| ZIP size shipped to customers | 180 KB (source only) |</p><p>— -</p><p>## What’s NOT in v1.0 (intentional)</p><p>- **Razorpay / Stripe payment** on the public quote page → v1.1</p><p>- **Customer login portal** → v1.x</p><p>- **Multi-language quote pages** → v1.x</p><p>- **WhatsApp Cloud API** (right now we use `wa.me` deep links — zero Meta approval needed)</p><p>I deliberately did not ship these in v1. The minimum lovable product is: <em>*paste inquiry → branded quote sent in 90 seconds*</em>. Everything else is a distraction until that core loop is bulletproof.</p><p>— -</p><p>## If you want to build something similar</p><p>The principles are framework-agnostic:</p><p>1. **Find a real business owner.** Watch them work for 30 minutes. The pain is always obvious.</p><p>2. **Build the smallest end-to-end loop.** Not 12 features at 60%. One feature at 95%.</p><p>3. **Multi-tenant from day one.** Adding `agency_id` to every table on day 1 costs you 4 hours. Adding it on day 90 costs 4 weeks.</p><p>4. **Self-hostable wins indie sales.** Travel agencies don’t want another SaaS subscription. They want to <em>*own*</em> the tool. Gumroad’s lifetime-license model fits this perfectly.</p><p>5. **Ship the boring stuff.** README, INSTALL.md, DEPLOYMENT.md, CHANGELOG.md, SUPPORT.md. These triple the perceived value of any indie product.</p><p>— -</p><p>## If you want the actual product</p><p>I’m selling TripQuote on Gumroad with three tiers — the full source ships in a 180 KB ZIP, `npm install` does the rest:</p><p>- **Single-Agency** — $49 → one production site you own</p><p>- **Studio** — $129 → up to 5 client sites</p><p>- **SaaS / Reseller** — $399 → run as your own multi-tenant SaaS</p><p>👉 **[Get TripQuote on Gumroad](https://japangor.gumroad.com/l/quote?wanted=true)**</p><p>Or browse the deeper guides on the marketing site:</p><p>- [AI itinerary generator for travel agents](https://tripquote.gjam.in/ai-itinerary-generator)</p><p>- [WhatsApp itinerary builder](https://tripquote.gjam.in/whatsapp-itinerary-builder)</p><p>- [Best itinerary builder software (2026)](https://tripquote.gjam.in/best-itinerary-builder-software)</p><p>— -</p><p>## What’s next</p><p>I’m doing two things in public for the next 30 days:</p><p>1. **Shipping v1.1** — Razorpay deposit collection on the public quote page, plus multi-language quote pages (AI-translated on demand).</p><p>2. **Building TripQuote-Lite** — a free, single-tenant version for solo travel consultants who don’t need the multi-tenant SaaS scaffolding.</p><p>If you’ve built (or want to build) something for an underserved B2B niche, I’d love to hear about it. DM me on Twitter or LinkedIn (links in my profile).</p><p>— -</p><p><em>*Built by [Japan Gor](https://gjam.in) at [GJAM Technologies](https://gjam.in) — a Mumbai-based product studio shipping AI-augmented business software. Follow me here for the v1.1 build log.*</em></p><p>— -</p><p>If you want the engineering decisions, keep reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3474d822b3d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Parasocial relationships]]></title>
            <link>https://medium.com/gjam/parasocial-relationships-ff6478f30a32?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff6478f30a32</guid>
            <category><![CDATA[creators]]></category>
            <category><![CDATA[relationships]]></category>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 08:21:57 GMT</pubDate>
            <atom:updated>2026-01-06T08:22:08.905Z</atom:updated>
            <content:encoded><![CDATA[<p>Defination: Parasocial relationships are one-sided relationships, where one person extends emotional energy, interest, and time, and the other party, the persona, is completely unaware of the other’s existence.</p><p>My opinion:</p><p>Now, this applies to everyone but I have a problem with the creators who tell their audience that they are part of his/her family.</p><p>Every time big creators tell you that you are part of their family, they might be telling you a lie. No one is on the internet is your friend or family unless you know or interacted with them personally. They sometimes don’t have to time check your Dm’s and notifications. They will not reply with your every interaction. Your true friends and family are outside of these screens. They will help you in your ups and downs, not a random person on the internet, so spent time with them.</p><p>If you think you are part of their family then tell them to give you a shoutout, invite you to your wedding, buy you PS5, etc. No one will.</p><p>There is a reason why there is ‘followers’ text not ‘family members’</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff6478f30a32" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gjam/parasocial-relationships-ff6478f30a32">Parasocial relationships</a> was originally published in <a href="https://medium.com/gjam">GJAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Financial Wisdom for Young Software Developers: A Blueprint for Success]]></title>
            <link>https://japangor.medium.com/financial-wisdom-for-young-software-developers-a-blueprint-for-success-fd4e644bbb1b?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd4e644bbb1b</guid>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Thu, 17 Oct 2024 23:26:36 GMT</pubDate>
            <atom:updated>2024-10-17T23:26:36.829Z</atom:updated>
            <content:encoded><![CDATA[<p>Financial Wisdom for Young Software Developers: A Blueprint for Success</p><p>As a young software developer, your career is like building a complex system. The choices you make now—how you invest in your skills and finances—will determine the success of your long-term project. Let&#39;s dive into some financial advice that can help you not only navigate but excel in this journey, using a real-life analogy that you&#39;ll easily relate to: building a scalable application.</p><p>1. Invest in Your Skills Like Initial Code Development</p><p>Think of your technical skills as the foundation of your software project. The time you invest in learning new programming languages, frameworks, and best practices is equivalent to laying down the architecture for a robust, scalable app. Early investment in skills like DevOps, full-stack development, or AI will provide returns much like well-structured code does in reducing future maintenance costs.</p><p>Just like an application that benefits from regular updates, the job market rewards those who keep their skills sharp. Attend conferences, contribute to open-source projects, and gain relevant certifications. This is your foundation for career growth and increased earning potential.</p><p>2. Avoid Get-Rich-Quick Schemes—Don&#39;t Trust That Short-Term Hack</p><p>In software development, shortcuts often lead to tech debt—a pile of quick fixes that seem great at first but come back to haunt you later. Similarly, get-rich-quick schemes, like day trading in the stock market, often promise fast gains but come with substantial risks.</p><p>Like a buggy hack, these schemes may work for a few, but most lose more than they gain. According to a study by SEBI, 89% of individual traders in the equity market incurred losses. Instead, focus on long-term, stable financial strategies, just as you would focus on writing clean, maintainable code that scales well in the future.</p><p>3. Focus on Your Core Competency—Build What You Know Best</p><p>As a software developer, your strength lies in your ability to solve problems through code. This is your core competency, much like the main feature of an app. Instead of being distracted by complex, risky investments, realize that your skills are your most powerful asset. The tech industry offers high salaries and countless career growth opportunities, so maximizing these is far more predictable and profitable than speculative investments.</p><p>Think of it this way: If you’re building an e-commerce app, would you spend your time creating a new social media algorithm on the side? No—you’d focus on the core features that directly add value. Similarly, focus on excelling in your profession before branching out into financial adventures.</p><p>4. Consider Index Funds—Think of Them as Stable Servers</p><p>Index funds are like the reliable server infrastructure of your financial portfolio—they offer broad market exposure, low costs, and steady growth over time. Much like choosing a stable, scalable cloud provider for your app ensures uptime and reliability, investing in index funds can provide you with diversification and a hedge against the unpredictable swings of individual stock markets.</p><p>While you can attempt to tweak performance in your app with complex algorithms, choosing a stable, tried-and-tested index fund is akin to relying on trusted server architecture to keep things running smoothly.</p><p>5. Keep Fixed Expenses Low—Optimize Your Memory Usage</p><p>Just as you wouldn’t want your app to be bogged down by memory leaks or unnecessary processes, it’s wise to keep your personal expenses lean. Avoid lifestyle inflation—just because you’ve started earning more doesn’t mean you need to increase your spending. Maintain the lifestyle you had before your first big paycheck, and you’ll have more financial room to invest in what truly matters—your future.</p><p>Much like optimizing an app to run on fewer resources, keeping fixed expenses low gives you financial flexibility and the ability to invest in higher-yield areas, such as stocks, index funds, or your side projects.</p><p>6. Maximize Retirement Contributions—Your Long-Term Data Backup</p><p>Just as you wouldn’t neglect to back up your data for an important project, don’t overlook your long-term financial safety net—retirement savings. Many companies offer employer-matching retirement plans, which is essentially free money. It’s akin to having a powerful backup system for your finances—there when you need it most.</p><p>By consistently contributing to your retirement fund, you&#39;re ensuring that your &quot;financial server&quot; remains stable even after your most active working years are behind you.</p><p>7. Remain Flexible—Your Career is a Microservice</p><p>The tech industry changes fast—new frameworks, languages, and trends emerge every year. Just as microservices architecture allows for flexibility and scalability in software systems, staying adaptable in your career can help you navigate the rapidly evolving tech landscape.</p><p>Be open to new opportunities, roles, or even companies in the first 3-5 years of your career. This adaptability could lead to increased responsibilities and higher salaries, similar to how microservices allow a system to grow and improve without the limitations of a monolithic structure.</p><p>8. Automate Your Savings—Set Up Your Financial Cron Jobs</p><p>Automation is key in both tech and finance. In the same way that cron jobs automate tasks in your app, automate your savings and investments to ensure consistency. Set up automatic transfers from your paycheck to savings and investment accounts. By paying yourself first, you’ll ensure that your financial progress remains on track without the need for constant manual intervention.</p><p>Imagine setting up a script that cleans your database every day—automated savings work in the same way, ensuring that you’re continuously making progress toward your financial goals without needing to worry about it.</p><p>Final Thoughts</p><p>Much like developing a robust, scalable app, managing your finances requires careful planning, constant updates, and disciplined execution. By focusing on what you&#39;re good at—developing high-quality code—and applying those same principles to your financial habits, you can set yourself up for both career and financial success.</p><p>Take the lessons you’ve learned from debugging code, refactoring systems, and automating tasks, and apply them to your financial life. Just like a well-built app can stand the test of time, a thoughtful financial strategy will support you for decades to come.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd4e644bbb1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Code Retrieval System with RAG and Google’s Gemini API: A Step-by-Step Guide]]></title>
            <link>https://medium.com/gjam/building-a-code-retrieval-system-with-rag-and-googles-gemini-api-a-step-by-step-guide-6fd4a072533b?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fd4a072533b</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Thu, 17 Oct 2024 23:25:43 GMT</pubDate>
            <atom:updated>2024-10-17T23:25:43.671Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>Retrieval-Augmented Generation (RAG) is a powerful technique that enhances the output of large language models (LLMs) by integrating external knowledge. In this article, I’ll show you how to build a code retrieval system using RAG with Google’s Gemini API. We’ll cover the entire workflow step-by-step, complete with code snippets, to help you easily follow along and create your own working system. If you’re interested in taking your LLMs to the next level by integrating them with existing knowledge repositories, this guide is for you!</p><p>Be sure to follow me on social media for more content like this:</p><ul><li>Twitter: <a href="http://x.com/japangor">Japan Gor</a></li><li>web: <a href="http://japangor.com/">https://japangor.com</a></li><li>LinkedIn: <a href="http://linkedin.com/in/japangor">JAPANGOR</a></li></ul><p><strong>What is Retrieval-Augmented Generation (RAG)?</strong></p><p>Retrieval-Augmented Generation (RAG) combines LLMs with an external knowledge retrieval component, allowing for better relevance and accuracy in responses. Instead of relying purely on a model’s pre-trained knowledge, RAG pulls in information from external sources to generate context-aware answers. This approach is particularly useful for specialized domains, such as code generation, where domain-specific knowledge is often required.</p><p><strong>Step-by-Step Workflow</strong></p><h3>Step 1: Setting Up the Environment</h3><p>The first step is to install the necessary packages, including Google Cloud’s AI Platform SDK, LangChain for building LLM applications, and FAISS for managing the vector store.</p><pre># Install Required Packages<br>%pip install --upgrade --user -q google-cloud-aiplatform \<br>    langchain langchain_google_vertexai langchain-community \<br>    faiss-cpu nbformat</pre><p>If you’re using Google Colab, you’ll need to restart the runtime to use the newly installed packages.</p><pre># Restart Runtime (for Colab)<br>import sys<br>if &quot;google.colab&quot; in sys.modules:<br>    import IPython<br>    app = IPython.Application.instance()<br>    app.kernel.do_shutdown(True)</pre><h3>Step 2: Authenticating and Importing Libraries</h3><p>To use Google Cloud services, authenticate your environment and import the necessary libraries.</p><pre># Authenticate with Google Cloud (if needed)<br>from google.colab import auth<br>auth.authenticate_user()</pre><pre># Import Libraries<br>import time<br>from google.cloud import aiplatform<br>from langchain.chains import RetrievalQA<br>from langchain.prompts import PromptTemplate<br>from langchain.vectorstores import FAISS<br>from langchain.text_splitter import Language, RecursiveCharacterTextSplitter<br>from langchain_google_vertexai import VertexAI, VertexAIEmbeddings<br>import nbformat<br>import requests</pre><h3>Step 3: Initializing Vertex AI SDK</h3><p>Next, you need to initialize the Vertex AI SDK by specifying your project ID and location.</p><pre># Initialize Vertex AI SDK<br>PROJECT_ID = &quot;your_project_id&quot;<br>LOCATION = &quot;us-central1&quot;<br>vertexai.init(project=PROJECT_ID, location=LOCATION)</pre><h3>Step 4: Setting Up the Gemini Model</h3><p>Now that we have the environment set up, let’s initialize the Gemini API for code generation. This model will be responsible for generating Python code based on user prompts.</p><pre># Setup Model (Gemini API)<br>code_llm = VertexAI(<br>    model_name=&quot;gemini-1.5-pro&quot;,<br>    max_output_tokens=2048,<br>    temperature=0.1,<br>    verbose=False,<br>)</pre><h3>Step 5: Crawling GitHub for Jupyter Notebooks and Python Files</h3><p>The next step is to gather code examples. We will use the GitHub API to crawl the repository for .ipynb and .py files.</p><pre># Define GitHub Token and Repository<br>GITHUB_TOKEN = &quot;your_github_token&quot;<br>GITHUB_REPO = &quot;GoogleCloudPlatform/generative-ai&quot;</pre><pre># Function to Crawl GitHub Repository for Notebooks<br>def crawl_github_repo(url, is_sub_dir=False, access_token=GITHUB_TOKEN):<br>    api_url = f&quot;https://api.github.com/repos/{url}/contents&quot; if not is_sub_dir else url<br>    headers = {&quot;Authorization&quot;: f&quot;Bearer {access_token}&quot;}<br>    response = requests.get(api_url, headers=headers)<br>    response.raise_for_status()<br>    files = []<br>    for item in response.json():<br>        if item[&quot;type&quot;] == &quot;file&quot; and item[&quot;name&quot;].endswith((&quot;.py&quot;, &quot;.ipynb&quot;)):<br>            files.append(item[&quot;html_url&quot;])<br>        elif item[&quot;type&quot;] == &quot;dir&quot;:<br>            files.extend(crawl_github_repo(item[&quot;url&quot;], True))<br>    return files</pre><pre># List Files in Repository<br>code_files = crawl_github_repo(GITHUB_REPO)</pre><h3>Step 6: Extracting Code from the Jupyter Notebooks</h3><p>After we have the list of .ipynb and .py files, we extract the code from them for indexing.</p><pre># Extract Python Code from Notebooks<br>def extract_code(github_url):<br>    raw_url = github_url.replace(&quot;github.com&quot;, &quot;raw.githubusercontent.com&quot;).replace(&quot;/blob/&quot;, &quot;/&quot;)<br>    response = requests.get(raw_url)<br>    response.raise_for_status()<br>    notebook = nbformat.reads(response.text, as_version=nbformat.NO_CONVERT)<br>    return &quot;\n&quot;.join(cell.source for cell in notebook.cells if cell.cell_type == &quot;code&quot;)</pre><pre># Extract Code from Listed Files<br>code_content = [extract_code(url) for url in code_files]</pre><h3>Step 7: Chunking Code Strings</h3><p>To make it easier for the model to retrieve and understand the code, we split it into smaller chunks.</p><pre># Chunking Code Strings<br>text_splitter = RecursiveCharacterTextSplitter.from_language(<br>    language=Language.PYTHON, chunk_size=2000, chunk_overlap=200<br>)<br>texts = text_splitter.split_documents(code_content)</pre><h3>Step 8: Creating a Vector Store with FAISS</h3><p>We need a way to efficiently search through these code chunks. We’ll use FAISS to create a vector store.</p><pre># Custom Embedding Class with Rate Limiting<br>class CustomVertexAIEmbeddings(VertexAIEmbeddings):<br>    def embed_documents(self, texts, batch_size=None):<br>        return [self.client.get_embeddings([text]).values[0] for text in texts]</pre><pre># Create Vector Store using FAISS<br>embeddings = CustomVertexAIEmbeddings(model_name=&quot;textembedding-gecko@latest&quot;)<br>db = FAISS.from_documents(texts, embeddings)<br>retriever = db.as_retriever(search_type=&quot;similarity&quot;, search_kwargs={&quot;k&quot;: 5})</pre><h3>Step 9: Defining the Prompt Template and Querying the Model</h3><p>Now that everything is set up, we can define a prompt template and use the Gemini API to generate responses based on retrieved code snippets.</p><pre># Define Prompt Template and Query<br>prompt_template = PromptTemplate(<br>    input_variables=[&quot;question&quot;],<br>    template=&quot;You are a Python developer. Respond with the correct code for: {question}&quot;<br>)<br>retrieval_chain = RetrievalQA(llm=code_llm, retriever=retriever, prompt_template=prompt_template)</pre><pre># Example Query to Test RAG<br>question = &quot;Write a Python function to fetch JSON data from a public API.&quot;<br>response = retrieval_chain.run(question)<br>print(response)</pre><p><strong>Conclusion</strong></p><p>In this article, we’ve built a code retrieval system using RAG and the Gemini API. By integrating LLMs with an external knowledge base like GitHub, you can enhance the relevance of the generated output, especially for niche tasks like code generation. I hope this guide helps you get started with building your own RAG-based applications.</p><p>If you have questions or need further clarification, feel free to reach out on social media.</p><ul><li>Twitter: <a href="http://x.com/japangor">Japan Gor</a></li><li>web: <a href="http://japangor.com/">https://japangor.com</a></li><li>LinkedIn: <a href="http://linkedin.com/in/japangor">JAPANGOR</a></li></ul><p><strong>Happy coding!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fd4a072533b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gjam/building-a-code-retrieval-system-with-rag-and-googles-gemini-api-a-step-by-step-guide-6fd4a072533b">Building a Code Retrieval System with RAG and Google’s Gemini API: A Step-by-Step Guide</a> was originally published in <a href="https://medium.com/gjam">GJAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leveraging OpenAI's Models for Algorithmic Trading: A Step-by-Step Guide with Working Code for…]]></title>
            <link>https://medium.com/gjam/leveraging-openais-models-for-algorithmic-trading-a-step-by-step-guide-with-working-code-for-96043b247636?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/96043b247636</guid>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Tue, 15 Oct 2024 23:53:33 GMT</pubDate>
            <atom:updated>2024-10-15T23:53:33.806Z</atom:updated>
            <content:encoded><![CDATA[<p>Leveraging OpenAI&#39;s Models for Algorithmic Trading: A Step-by-Step Guide with Working Code for Indian and US Markets</p><p>By Japan Gor</p><p>Algorithmic trading has revolutionized the financial markets by automating trading decisions and executions. With the emergence of advanced AI models from OpenAI, traders now have powerful tools to analyze market data and develop strategies that can potentially outperform traditional methods.</p><p>In this comprehensive guide, we&#39;ll walk you through the process of creating an AI-powered algorithmic trading strategy for both the Indian and US markets. We&#39;ll provide detailed explanations and working code snippets to ensure that you can implement the strategy on your own.</p><p>Table of Contents</p><p>1. Introduction</p><p>2. Setting Up the Environment</p><p>3. Data Acquisition and Preprocessing</p><p>4. Developing the AI-Powered Trading Strategy</p><p>5. Backtesting the Strategy</p><p>6. Implementing the Strategy in Live Markets</p><p>7. Conclusion</p><p>8. Disclaimer</p><p>1. Introduction</p><p>What is Algorithmic Trading?</p><p>Algorithmic trading involves using computer algorithms to execute trades based on predefined criteria. It eliminates human emotions from trading decisions, allows for faster execution, and can analyze vast amounts of data to identify trading opportunities.</p><p>Why Use AI in Trading?</p><p>Artificial Intelligence (AI) models, such as those developed by OpenAI, can process and analyze complex datasets to identify patterns and make predictions. By integrating AI into trading strategies, traders can:</p><p>Enhance Predictive Accuracy: AI models can uncover hidden patterns in data.</p><p>Automate Decision-Making: Execute trades based on AI-generated signals.</p><p>Adapt to Market Changes: AI can learn and adjust to new market conditions.</p><p>2. Setting Up the Environment</p><p>To follow along with this guide, you&#39;ll need to set up a Python environment with the necessary libraries.</p><p>Required Software and Libraries</p><p>Python 3.7 or higher</p><p>Anaconda or virtualenv (recommended for managing packages)</p><p>Libraries:</p><p>pandas</p><p>numpy</p><p>matplotlib</p><p>scikit-learn</p><p>yfinance</p><p>ta (Technical Analysis Library)</p><p>openai</p><p>Installation Steps</p><p>1. Install Python</p><p>If you haven&#39;t already, download and install Python from the official website.</p><p>2. Set Up a Virtual Environment (Optional but Recommended)</p><p>Using virtualenv:</p><p>pip install virtualenv<br>virtualenv trading_env<br>source trading_env/bin/activate # On Windows, use trading_env\Scripts\activate</p><p>3. Install Required Libraries</p><p>pip install pandas numpy matplotlib scikit-learn yfinance ta openai</p><p>4. Obtain OpenAI API Key</p><p>Sign up for an account at OpenAI and obtain your API key.</p><p>---</p><p>&lt;a name=&quot;data&quot;&gt;&lt;/a&gt;</p><p>3. Data Acquisition and Preprocessing</p><p>We&#39;ll use historical stock data from Yahoo Finance for both Indian and US markets.</p><p>Import Libraries</p><p>import pandas as pd<br>import numpy as np<br>import yfinance as yf<br>import matplotlib.pyplot as plt<br>from ta import add_all_ta_features<br>from ta.utils import dropna<br>import openai<br>import datetime</p><p>Set OpenAI API Key</p><p>openai.api_key = &#39;your_openai_api_key&#39; # Replace with your OpenAI API key</p><p>Define Date Range</p><p>start_date = &#39;2018-01-01&#39;<br>end_date = datetime.datetime.today().strftime(&#39;%Y-%m-%d&#39;)</p><p>Download Historical Data</p><p># Indian Market - Reliance Industries<br>reliance = yf.download(&#39;RELIANCE.NS&#39;, start=start_date, end=end_date)</p><p># US Market - Apple Inc.<br>apple = yf.download(&#39;AAPL&#39;, start=start_date, end=end_date)</p><p>Handle Missing Data</p><p># Drop rows with missing values<br>reliance.dropna(inplace=True)<br>apple.dropna(inplace=True)</p><p>Add Technical Indicators</p><p>We will use the ta library to add technical indicators to our dataset.</p><p># For Reliance<br>reliance = add_all_ta_features(<br> reliance, open=&quot;Open&quot;, high=&quot;High&quot;, low=&quot;Low&quot;, close=&quot;Close&quot;, volume=&quot;Volume&quot;, fillna=True<br>)</p><p># For Apple<br>apple = add_all_ta_features(<br> apple, open=&quot;Open&quot;, high=&quot;High&quot;, low=&quot;Low&quot;, close=&quot;Close&quot;, volume=&quot;Volume&quot;, fillna=True<br>)</p><p>---</p><p>&lt;a name=&quot;strategy&quot;&gt;&lt;/a&gt;</p><p>4. Developing the AI-Powered Trading Strategy</p><p>We&#39;ll develop a trading strategy that uses OpenAI&#39;s language models to predict the next day&#39;s closing price based on historical data and technical indicators.</p><p>Prepare the Data</p><p>We&#39;ll define features and the target variable.</p><p># Define features and target for Reliance<br>features_reliance = reliance.drop([&#39;Close&#39;, &#39;Adj Close&#39;], axis=1)<br>target_reliance = reliance[&#39;Close&#39;]</p><p># Define features and target for Apple<br>features_apple = apple.drop([&#39;Close&#39;, &#39;Adj Close&#39;], axis=1)<br>target_apple = apple[&#39;Close&#39;]</p><p>Normalize the Features</p><p>Normalization helps in improving the performance of machine learning models.</p><p>from sklearn.preprocessing import MinMaxScaler</p><p>scaler = MinMaxScaler()</p><p># For Reliance<br>features_reliance_scaled = scaler.fit_transform(features_reliance)<br>features_reliance_scaled = pd.DataFrame(features_reliance_scaled, index=features_reliance.index, columns=features_reliance.columns)</p><p># For Apple<br>features_apple_scaled = scaler.fit_transform(features_apple)<br>features_apple_scaled = pd.DataFrame(features_apple_scaled, index=features_apple.index, columns=features_apple.columns)</p><p>Define a Function to Generate Predictions</p><p>We&#39;ll use OpenAI&#39;s API to generate predictions. Since OpenAI&#39;s GPT models are language models and not designed for time series prediction, we&#39;ll simulate the behavior for educational purposes. In practice, you should use models designed for time series forecasting.</p><p>def generate_prediction(prompt):<br> response = openai.Completion.create(<br> engine=&#39;text-davinci-003&#39;, # Using a GPT-3 model<br> prompt=prompt,<br> max_tokens=10,<br> temperature=0<br> )<br> prediction = response.choices[0].text.strip()<br> try:<br> return float(prediction)<br> except ValueError:<br> return None</p><p>Generate Predictions for Each Day</p><p>We&#39;ll generate predictions by passing the features as a prompt to the model.</p><p># For Reliance<br>predictions_reliance = []</p><p>for index, row in features_reliance_scaled.iterrows():<br> prompt = f&quot;Based on the following technical indicators, predict the next day&#39;s closing price:\n{row.to_dict()}&quot;<br> prediction = generate_prediction(prompt)<br> predictions_reliance.append(prediction)</p><p># For Apple<br>predictions_apple = []</p><p>for index, row in features_apple_scaled.iterrows():<br> prompt = f&quot;Based on the following technical indicators, predict the next day&#39;s closing price:\n{row.to_dict()}&quot;<br> prediction = generate_prediction(prompt)<br> predictions_apple.append(prediction)</p><p>Note: This process can be slow and may consume a significant number of API credits. Be cautious and consider limiting the number of API calls.</p><p>Add Predictions to DataFrames</p><p># Add predictions to the DataFrames<br>reliance[&#39;Predicted_Close&#39;] = predictions_reliance<br>apple[&#39;Predicted_Close&#39;] = predictions_apple</p><p>Create Trading Signals</p><p>We will generate trading signals based on the predicted closing prices.</p><p># For Reliance<br>reliance[&#39;Signal&#39;] = 0<br>reliance.loc[reliance[&#39;Predicted_Close&#39;] &gt; reliance[&#39;Close&#39;], &#39;Signal&#39;] = 1<br>reliance.loc[reliance[&#39;Predicted_Close&#39;] &lt; reliance[&#39;Close&#39;], &#39;Signal&#39;] = -1</p><p># For Apple<br>apple[&#39;Signal&#39;] = 0<br>apple.loc[apple[&#39;Predicted_Close&#39;] &gt; apple[&#39;Close&#39;], &#39;Signal&#39;] = 1<br>apple.loc[apple[&#39;Predicted_Close&#39;] &lt; apple[&#39;Close&#39;], &#39;Signal&#39;] = -1</p><p>Compute Positions</p><p># For Reliance<br>reliance[&#39;Position&#39;] = reliance[&#39;Signal&#39;].shift(1)</p><p># For Apple<br>apple[&#39;Position&#39;] = apple[&#39;Signal&#39;].shift(1)</p><p>---</p><p>&lt;a name=&quot;backtesting&quot;&gt;&lt;/a&gt;</p><p>5. Backtesting the Strategy</p><p>Backtesting allows us to evaluate the performance of the trading strategy over historical data.</p><p>Calculate Returns</p><p># For Reliance<br>reliance[&#39;Market_Returns&#39;] = reliance[&#39;Close&#39;].pct_change()<br>reliance[&#39;Strategy_Returns&#39;] = reliance[&#39;Market_Returns&#39;] * reliance[&#39;Position&#39;]</p><p># For Apple<br>apple[&#39;Market_Returns&#39;] = apple[&#39;Close&#39;].pct_change()<br>apple[&#39;Strategy_Returns&#39;] = apple[&#39;Market_Returns&#39;] * apple[&#39;Position&#39;]</p><p>Calculate Cumulative Returns</p><p># For Reliance<br>reliance[&#39;Cumulative_Market_Returns&#39;] = (1 + reliance[&#39;Market_Returns&#39;]).cumprod()<br>reliance[&#39;Cumulative_Strategy_Returns&#39;] = (1 + reliance[&#39;Strategy_Returns&#39;]).cumprod()</p><p># For Apple<br>apple[&#39;Cumulative_Market_Returns&#39;] = (1 + apple[&#39;Market_Returns&#39;]).cumprod()<br>apple[&#39;Cumulative_Strategy_Returns&#39;] = (1 + apple[&#39;Strategy_Returns&#39;]).cumprod()</p><p>Plot the Results</p><p># For Reliance<br>plt.figure(figsize=(14,7))<br>plt.plot(reliance[&#39;Cumulative_Market_Returns&#39;], label=&#39;Market Returns&#39;)<br>plt.plot(reliance[&#39;Cumulative_Strategy_Returns&#39;], label=&#39;Strategy Returns&#39;)<br>plt.title(&#39;Reliance Industries Strategy Performance&#39;)<br>plt.legend()<br>plt.show()</p><p># For Apple<br>plt.figure(figsize=(14,7))<br>plt.plot(apple[&#39;Cumulative_Market_Returns&#39;], label=&#39;Market Returns&#39;)<br>plt.plot(apple[&#39;Cumulative_Strategy_Returns&#39;], label=&#39;Strategy Returns&#39;)<br>plt.title(&#39;Apple Inc. Strategy Performance&#39;)<br>plt.legend()<br>plt.show()</p><p>Evaluate Performance Metrics</p><p># For Reliance<br>total_return_reliance = reliance[&#39;Cumulative_Strategy_Returns&#39;][-1] - 1<br>annual_return_reliance = reliance[&#39;Strategy_Returns&#39;].mean() * 252<br>annual_volatility_reliance = reliance[&#39;Strategy_Returns&#39;].std() * np.sqrt(252)<br>sharpe_ratio_reliance = annual_return_reliance / annual_volatility_reliance</p><p># For Apple<br>total_return_apple = apple[&#39;Cumulative_Strategy_Returns&#39;][-1] - 1<br>annual_return_apple = apple[&#39;Strategy_Returns&#39;].mean() * 252<br>annual_volatility_apple = apple[&#39;Strategy_Returns&#39;].std() * np.sqrt(252)<br>sharpe_ratio_apple = annual_return_apple / annual_volatility_apple</p><p>print(&quot;Reliance Industries Strategy Performance:&quot;)<br>print(f&quot;Total Return: {total_return_reliance:.2%}&quot;)<br>print(f&quot;Annual Return: {annual_return_reliance:.2%}&quot;)<br>print(f&quot;Annual Volatility: {annual_volatility_reliance:.2%}&quot;)<br>print(f&quot;Sharpe Ratio: {sharpe_ratio_reliance:.2f}&quot;)</p><p>print(&quot;\nApple Inc. Strategy Performance:&quot;)<br>print(f&quot;Total Return: {total_return_apple:.2%}&quot;)<br>print(f&quot;Annual Return: {annual_return_apple:.2%}&quot;)<br>print(f&quot;Annual Volatility: {annual_volatility_apple:.2%}&quot;)<br>print(f&quot;Sharpe Ratio: {sharpe_ratio_apple:.2f}&quot;)</p><p>---</p><p>&lt;a name=&quot;deployment&quot;&gt;&lt;/a&gt;</p><p>6. Implementing the Strategy in Live Markets</p><p>Important Note: Trading in live markets involves significant risks. Ensure you comply with all regulatory requirements and thoroughly test your strategy before deploying.</p><p>Setting Up a Brokerage Account with API Access</p><p>You&#39;ll need to choose a broker that provides API access for automated trading.</p><p>India: Zerodha Kite Connect, Upstox API</p><p>US: Interactive Brokers API, Alpaca Markets</p><p>Example: Connecting to Zerodha&#39;s Kite Connect API</p><p>Install the Kite Connect Library</p><p>pip install kiteconnect</p><p>Initialize the Kite Connect API</p><p>from kiteconnect import KiteConnect</p><p># Initialize<br>kite = KiteConnect(api_key=&quot;your_api_key&quot;)</p><p># Generate session (you need to complete the login flow to get the request token)<br>data = kite.generate_session(&quot;your_request_token&quot;, api_secret=&quot;your_api_secret&quot;)<br>kite.set_access_token(data[&quot;access_token&quot;])</p><p>Implementing Real-Time Data Streaming</p><p>You need to set up websockets to receive real-time data. Refer to the broker&#39;s API documentation for details.</p><p>Automating Trade Execution</p><p>def place_order(symbol, transaction_type):<br> try:<br> order_id = kite.place_order(<br> tradingsymbol=symbol,<br> exchange=kite.EXCHANGE_NSE,<br> transaction_type=transaction_type,<br> quantity=1,<br> order_type=kite.ORDER_TYPE_MARKET,<br> product=kite.PRODUCT_CNC<br> )<br> print(f&quot;Order placed successfully, Order ID: {order_id}&quot;)<br> except Exception as e:<br> print(f&quot;Error placing order: {e}&quot;)</p><p># Example usage<br>latest_signal = reliance[&#39;Signal&#39;].iloc[-1]<br>previous_signal = reliance[&#39;Signal&#39;].iloc[-2]</p><p>if latest_signal == 1 and previous_signal != 1:<br> place_order(&#39;RELIANCE&#39;, kite.TRANSACTION_TYPE_BUY)<br>elif latest_signal == -1 and previous_signal != -1:<br> place_order(&#39;RELIANCE&#39;, kite.TRANSACTION_TYPE_SELL)</p><p>Scheduling the Script</p><p>You can schedule your script to run at regular intervals using a scheduler like cron on Unix systems or Task Scheduler on Windows.</p><p>---</p><p>&lt;a name=&quot;conclusion&quot;&gt;&lt;/a&gt;</p><p>7. Conclusion</p><p>By integrating OpenAI&#39;s advanced models into your algorithmic trading strategies, you can potentially gain an edge in the financial markets. This guide provided a step-by-step approach to developing, backtesting, and implementing an AI-powered trading strategy for both the Indian and US markets.</p><p>Key Takeaways:</p><p>Data Preparation is Crucial: Clean and preprocess your data carefully.</p><p>Model Selection Matters: Choose appropriate models for time series forecasting.</p><p>Risk Management is Essential: Always consider the risks and manage them appropriately.</p><p>Continuous Learning: Markets evolve, and so should your strategies.</p><p>---</p><p>&lt;a name=&quot;disclaimer&quot;&gt;&lt;/a&gt;</p><p>Disclaimer</p><p>This article is for informational and educational purposes only and should not be considered financial advice. Trading stocks, options, futures, and other securities involves risk. Past performance is not indicative of future results. Consult a financial advisor before making any investment decisions.</p><p>---</p><p>Thank you for reading! If you found this guide helpful, feel free to share it with others.</p><p>---</p><p>Appendix: Troubleshooting and Tips</p><p>Handling API Rate Limits</p><p>OpenAI API has rate limits and usage costs. Be mindful of these when making API calls.</p><p>Batch Predictions: Consider batching your data to reduce the number of API calls.</p><p>Alternative Models: For time series forecasting, consider using specialized models like LSTM or Prophet.</p><p>Alternative Time Series Models</p><p>Since GPT models are not optimized for numerical predictions, you might get better results using time series models.</p><p>Using Facebook&#39;s Prophet</p><p>pip install prophet</p><p>Implementing Prophet</p><p>from prophet import Prophet</p><p># Prepare data for Prophet<br>reliance_prophet = reliance[[&#39;Close&#39;]].reset_index()<br>reliance_prophet.rename(columns={&#39;Date&#39;: &#39;ds&#39;, &#39;Close&#39;: &#39;y&#39;}, inplace=True)</p><p># Initialize and fit the model<br>model = Prophet()<br>model.fit(reliance_prophet)</p><p># Make future predictions<br>future = model.make_future_dataframe(periods=30)<br>forecast = model.predict(future)</p><p># Plot the forecast<br>model.plot(forecast)<br>plt.show()</p><p>---</p><p>References</p><p>OpenAI API Documentation</p><p>Yahoo Finance API Documentation</p><p>Technical Analysis Library in Python Documentation</p><p>Kite Connect API Documentation</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96043b247636" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gjam/leveraging-openais-models-for-algorithmic-trading-a-step-by-step-guide-with-working-code-for-96043b247636">Leveraging OpenAI&#39;s Models for Algorithmic Trading: A Step-by-Step Guide with Working Code for…</a> was originally published in <a href="https://medium.com/gjam">GJAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Customer Support with LLaMA: Building a Real-World AI-Powered Ticket Manager]]></title>
            <link>https://japangor.medium.com/automating-customer-support-with-llama-building-a-real-world-ai-powered-ticket-manager-5a161a18d854?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a161a18d854</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 07:39:13 GMT</pubDate>
            <atom:updated>2024-10-13T07:39:13.293Z</atom:updated>
            <content:encoded><![CDATA[<p>Author: Japan Gor | Medium for GJAM</p><h3>Introduction</h3><p>Building an AI-Powered Support Ticket Manager with LLaMA for Real-Life Customer Service Efficiency</p><p>Managing customer support tickets can be a daunting task for any business, especially when dealing with a high volume of customer inquiries. Imagine if you could automatically categorize, prioritize, and respond to support tickets based on customer queries using artificial intelligence. By leveraging LLaMA (Large Language Model Meta AI), you can do just that!</p><p>In this article, we&#39;ll walk you through building a fully functional AI-powered ticket manager using LLaMA. This tool will help businesses automate ticket handling, save time, and improve customer satisfaction by generating appropriate responses, categorizing tickets, and prioritizing urgent issues.</p><p>---</p><h3><strong>Step 1: Set Up the Environment</strong></h3><p>First, you need to set up the environment. Install the following dependencies using pip.</p><pre>pip install llama-cpp-python pinecone-client fastapi uvicorn transformers torch</pre><p>This will include LLaMA for natural language processing, Pinecone for embeddings and fast retrieval, and FastAPI for building the API.</p><h3>Step 2: Creating a Ticket Management System</h3><p>We&#39;ll start by defining a system to manage support tickets. The system should create and store tickets with metadata such as ticket ID, customer query, and priority.</p><p>Code: Create a Support Ticket</p><p>import json</p><p># Function to create a support ticket<br>def create_ticket(ticket_id, customer_query):<br> ticket = {<br> &quot;ticket_id&quot;: ticket_id,<br> &quot;customer_query&quot;: customer_query,<br> &quot;category&quot;: &quot;Uncategorized&quot;, # Default category<br> &quot;priority&quot;: &quot;Medium&quot; # Default priority<br> }<br> # Store ticket as JSON<br> with open(f&quot;tickets/ticket_{ticket_id}.json&quot;, &quot;w&quot;) as file:<br> json.dump(ticket, file)<br> print(f&quot;Ticket {ticket_id} created.&quot;)<br> <br># Example: Create a support ticket<br>create_ticket(&quot;001&quot;, &quot;I&#39;m unable to access my account.&quot;)</p><p>Step 3: Using LLaMA for Ticket Categorization and Prioritization</p><p>Now, we’ll use the LLaMA model to automatically categorize and assign priorities to tickets based on the customer’s query.</p><p>Code: Categorize and Prioritize Tickets using LLaMA</p><p>from llama_cpp import LLaMA</p><p># Load the LLaMA model<br>model_path = &quot;path_to_llama_model.bin&quot; # Replace with actual model path<br>llama = LLaMA(model_path)</p><p># Function to categorize and prioritize a support ticket<br>def categorize_and_prioritize(ticket_id):<br> # Load the ticket<br> with open(f&quot;tickets/ticket_{ticket_id}.json&quot;, &quot;r&quot;) as file:<br> ticket = json.load(file)<br> <br> # Generate the categorization and prioritization using LLaMA<br> prompt = f&quot;Categorize and assign priority to this support ticket: {ticket[&#39;customer_query&#39;]}&quot;<br> result = llama.generate(prompt)<br> response = result[&#39;choices&#39;][0][&#39;text&#39;].strip().split(&quot;, &quot;)<br> <br> # Update the ticket with category and priority<br> ticket[&quot;category&quot;], ticket[&quot;priority&quot;] = response[0].split(&quot;: &quot;)[1], response[1].split(&quot;: &quot;)[1]<br> <br> # Save the updated ticket<br> with open(f&quot;tickets/ticket_{ticket_id}.json&quot;, &quot;w&quot;) as file:<br> json.dump(ticket, file)<br> <br> print(f&quot;Ticket {ticket_id} categorized as {ticket[&#39;category&#39;]} with priority {ticket[&#39;priority&#39;]}.&quot;)</p><p># Example: Categorize and prioritize ticket<br>categorize_and_prioritize(&quot;001&quot;)</p><p>In this example, the LLaMA model will process the customer query and return a category (e.g., &quot;Technical Support&quot;) and priority (e.g., &quot;High&quot;).</p><p>---</p><p>Step 4: Building the FastAPI Backend for Ticket Management</p><p>Next, we’ll expose the ticket system as an API using FastAPI. This will allow your support team to interact with the system, create tickets, and retrieve information through HTTP requests.</p><p>Code: FastAPI for Ticket Management</p><p>from fastapi import FastAPI<br>import json</p><p>app = FastAPI()</p><p># Create a new support ticket<br>@app.post(&quot;/create_ticket&quot;)<br>async def create_support_ticket(ticket_id: str, query: str):<br> create_ticket(ticket_id, query)<br> return {&quot;status&quot;: &quot;Ticket created successfully&quot;, &quot;ticket_id&quot;: ticket_id}</p><p># Categorize and prioritize a support ticket<br>@app.post(&quot;/categorize_ticket&quot;)<br>async def categorize_ticket(ticket_id: str):<br> categorize_and_prioritize(ticket_id)<br> return {&quot;status&quot;: &quot;Ticket categorized successfully&quot;, &quot;ticket_id&quot;: ticket_id}</p><p># Run the FastAPI app<br>if __name__ == &quot;__main__&quot;:<br> import uvicorn<br> uvicorn.run(app, host=&quot;0.0.0.0&quot;, port=8000)</p><p>Once this API is running, support staff can send requests to create, categorize, and prioritize tickets through endpoints like /create_ticket and /categorize_ticket.</p><p>---</p><p>Step 5: Generate Response Suggestions for Support Tickets</p><p>Now that we’ve categorized and prioritized the tickets, we can generate response suggestions to help the support team quickly reply to customers.</p><p>Code: Generate Response Suggestions</p><p># Function to generate a response suggestion using LLaMA<br>def generate_response(ticket_id):<br> with open(f&quot;tickets/ticket_{ticket_id}.json&quot;, &quot;r&quot;) as file:<br> ticket = json.load(file)<br> <br> # Generate a response based on the ticket&#39;s category and query<br> prompt = f&quot;Generate a response for a {ticket[&#39;category&#39;]} issue: {ticket[&#39;customer_query&#39;]}&quot;<br> result = llama.generate(prompt)<br> <br> # Extract the generated response<br> response = result[&#39;choices&#39;][0][&#39;text&#39;].strip()<br> <br> print(f&quot;Response for ticket {ticket_id}: {response}&quot;)<br> return response</p><p># Example: Generate a response for a ticket<br>generate_response(&quot;001&quot;)</p><p>In this example, the LLaMA model will generate an appropriate response based on the ticket’s category and customer query, helping the support team respond faster.</p><p>---</p><p>Step 6: Testing and Finalizing the Support Ticket Manager</p><p>Now that we have a fully functional support ticket manager, you can test it by creating tickets, categorizing them, and generating responses. Here&#39;s an example of how this tool works in a real-world scenario:</p><p>1. Create a new ticket: The customer submits a query such as, &quot;I can&#39;t log into my account.&quot;</p><p>2. Categorize and prioritize: The system categorizes it as &quot;Account Issue&quot; and sets the priority to &quot;High.&quot;</p><p>3. Generate response: The system generates a response such as, &quot;We apologize for the inconvenience. Please reset your password using the &#39;Forgot Password&#39; option.&quot;</p><p>With this setup, you can scale customer support without increasing manpower, as the tool automates much of the initial ticket triage and response process.</p><p>---</p><p>Wrapping Up</p><p>By leveraging LLaMA for categorizing and generating responses to support tickets, this AI-powered support ticket manager can significantly streamline your customer service operations. It automates the manual process of sorting, prioritizing, and responding to support tickets, helping support teams handle more tickets efficiently.</p><p>With LLaMA’s natural language capabilities, you can ensure that your customer support responses are relevant, accurate, and timely, improving customer satisfaction and operational efficiency.</p><p>---</p><p>If you have any questions about implementing this tool or need assistance in building out your own AI-powered support system, feel free to reach out to me!</p><p>Japan Gor</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a161a18d854" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart Habit Tracker: Building an AI-Powered Tool for Lifestyle Improvement]]></title>
            <link>https://medium.com/gjam/smart-habit-tracker-building-an-ai-powered-tool-for-lifestyle-improvement-d8ec06a465f3?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8ec06a465f3</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 07:36:57 GMT</pubDate>
            <atom:updated>2024-10-13T07:36:57.276Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Author: Japan Gor | Medium for GJAM Publisher</strong></p><h3>Introduction</h3><p><strong>Create a Smart Habit Tracker for Lifestyle Management and Personal Growth</strong></p><p>Imagine having a tool that not only helps you track your habits but also provides insights on how to improve them, optimizes your routine, and motivates you to stay consistent. The Smart Habit Tracker is designed to do just that. It leverages AI technology, user data, and behavioral science to support you in your journey toward personal growth and lifestyle improvement.</p><p>This tool will combine the power of OpenAI’s GPT, Weaviate as a vector database, and Streamlit for a seamless and interactive user interface, giving you an all-in-one platform to build better habits and optimize your life.</p><ul><li>Japan Gor</li></ul><p><strong>Connect with me:</strong></p><ul><li><a href="https://twitter.com/your_handle">Twitter</a></li><li><a href="https://www.linkedin.com/in/your_profile">LinkedIn</a></li><li><a href="https://github.com/your_username">GitHub</a></li></ul><h3>Step 1: Define the Purpose</h3><p>The purpose of the Smart Habit Tracker is to help users monitor their habits, analyze behavior patterns, and receive tailored advice on how to improve consistency. This tool will allow users to log their habits, visualize progress, and receive personalized recommendations from the AI.</p><h3>Step 2: Set Up Your Environment</h3><p>To build the Smart Habit Tracker, set up your environment with the following dependencies:</p><pre>!pip install -qU openai==0.27.7 weaviate-client==3.5.0 streamlit pandas transformers==4.21.0 requests</pre><p>These packages include OpenAI for generating responses, Weaviate for vector storage, Streamlit for creating the user interface, and transformers for handling embeddings.</p><h3>Step 3: Set Up the Habit Database</h3><p>Use Weaviate as a vector database to store user habits and allow efficient retrieval of information. This setup will make habit tracking and recommendations seamless.</p><p><strong>Code Snippet:</strong></p><pre>import weaviate<br>import json</pre><pre># Initialize Weaviate client<br>client = weaviate.Client(&quot;http://localhost:8080&quot;)</pre><pre># Define habit schema<br>habit_schema = {<br>    &quot;class&quot;: &quot;Habit&quot;,<br>    &quot;properties&quot;: [<br>        {&quot;name&quot;: &quot;name&quot;, &quot;dataType&quot;: [&quot;string&quot;]},<br>        {&quot;name&quot;: &quot;user&quot;, &quot;dataType&quot;: [&quot;string&quot;]},<br>        {&quot;name&quot;: &quot;frequency&quot;, &quot;dataType&quot;: [&quot;int&quot;]},<br>        {&quot;name&quot;: &quot;description&quot;, &quot;dataType&quot;: [&quot;string&quot;]}<br>    ]<br>}</pre><pre># Create schema if not exists<br>if not client.schema.exists(&quot;Habit&quot;):<br>    client.schema.create_class(habit_schema)</pre><pre># Add habit to database<br>def add_habit(user, name, frequency, description):<br>    habit_data = {<br>        &quot;name&quot;: name,<br>        &quot;user&quot;: user,<br>        &quot;frequency&quot;: frequency,<br>        &quot;description&quot;: description<br>    }<br>    client.data_object.create(habit_data, &quot;Habit&quot;)<br>    print(f&quot;Habit &#39;{name}&#39; added for user {user}.&quot;)</pre><pre>add_habit(&quot;user1&quot;, &quot;Morning Run&quot;, 5, &quot;Run every morning for 30 minutes.&quot;)</pre><h3>Step 4: Personalized Habit Insights</h3><p>Use OpenAI’s GPT model to analyze the user’s habits and provide personalized suggestions. By querying the data stored in Weaviate, you can provide meaningful recommendations.</p><p><strong>Code Snippet:</strong></p><pre>import openai</pre><pre>openai.api_key = &quot;YOUR_OPENAI_API_KEY&quot;</pre><pre># Generate habit improvement suggestions<br>def generate_habit_suggestions(user):<br>    # Fetch habits from Weaviate<br>    habits = client.query.get(&quot;Habit&quot;, [&quot;name&quot;, &quot;frequency&quot;, &quot;description&quot;])<br>    habits = habits.with_where({&quot;path&quot;: [&quot;user&quot;], &quot;operator&quot;: &quot;Equal&quot;, &quot;valueString&quot;: user}).do()<br>    if not habits[&#39;data&#39;][&#39;Get&#39;][&#39;Habit&#39;]:<br>        return &quot;No habits found. Please add some habits to track.&quot;</pre><pre>    habit_details = &#39;, &#39;.join([f&quot;{habit[&#39;name&#39;]} ({habit[&#39;frequency&#39;]} times/week)&quot; for habit in habits[&#39;data&#39;][&#39;Get&#39;][&#39;Habit&#39;]])<br>    prompt = f&quot;Here are the habits tracked by the user: {habit_details}. Provide some personalized suggestions to improve consistency and motivation.&quot;<br>    response = openai.Completion.create(<br>        engine=&quot;text-davinci-003&quot;,<br>        prompt=prompt,<br>        max_tokens=150<br>    )<br>    return response.choices[0].text.strip()</pre><pre>suggestions = generate_habit_suggestions(&quot;user1&quot;)<br>print(suggestions)</pre><h3>Step 5: Build an Interactive Dashboard with Streamlit</h3><p>Using Streamlit, create a user-friendly interface for logging habits, visualizing progress, and receiving personalized suggestions from the AI.</p><p><strong>Code Snippet:</strong></p><pre>import streamlit as st</pre><pre># Streamlit app for habit tracking<br>st.title(&quot;Smart Habit Tracker&quot;)</pre><pre># User input to add new habit<br>st.header(&quot;Add a New Habit&quot;)<br>user = st.text_input(&quot;User&quot;, &quot;user1&quot;)<br>habit_name = st.text_input(&quot;Habit Name&quot;)<br>frequency = st.slider(&quot;Frequency (times per week)&quot;, 1, 7, 3)<br>description = st.text_area(&quot;Habit Description&quot;)</pre><pre>if st.button(&quot;Add Habit&quot;):<br>    add_habit(user, habit_name, frequency, description)<br>    st.success(f&quot;Added habit &#39;{habit_name}&#39; for user {user}.&quot;)</pre><pre># Display habit improvement suggestions<br>st.header(&quot;Get Personalized Suggestions&quot;)<br>if st.button(&quot;Generate Suggestions&quot;):<br>    suggestions = generate_habit_suggestions(user)<br>    st.write(suggestions)</pre><h3>Step 6: Add Additional Features for User Motivation</h3><p>To make the habit tracker more engaging, consider adding:</p><ul><li><strong>Progress Visualization</strong>: Use charts to show users how their consistency has improved over time.</li><li><strong>Social Accountability</strong>: Allow users to share their goals with friends and motivate each other.</li><li><strong>Daily Reminders</strong>: Send notifications for scheduled habits.</li></ul><p><strong>Code Snippet for Progress Visualization:</strong></p><pre>import matplotlib.pyplot as plt<br>import pandas as pd</pre><pre># Example: Visualize progress<br>habit_data = {<br>    &quot;week&quot;: [&quot;Week 1&quot;, &quot;Week 2&quot;, &quot;Week 3&quot;, &quot;Week 4&quot;],<br>    &quot;morning_run&quot;: [3, 4, 5, 6]<br>}<br>df = pd.DataFrame(habit_data)</pre><pre># Plot progress<br>plt.figure(figsize=(10, 5))<br>plt.plot(df[&quot;week&quot;], df[&quot;morning_run&quot;], marker=&#39;o&#39;, linestyle=&#39;-&#39;, color=&#39;b&#39;)<br>plt.xlabel(&quot;Weeks&quot;)<br>plt.ylabel(&quot;Frequency of Morning Run&quot;)<br>plt.title(&quot;Morning Run Progress&quot;)<br>plt.grid()<br>plt.show()</pre><h3>Step 7: Test and Iterate</h3><p>Gather feedback from users to identify the strengths and weaknesses of the Smart Habit Tracker. Use their input to improve features, refine recommendations, and make the overall experience more engaging and beneficial.</p><h3>Step 8: Launch and Promote the Tool</h3><p>Once the tool is ready, launch it to the public and emphasize its benefits for personal growth, consistency, and motivation. Promote it as a tool that can help people make meaningful, lasting changes in their daily lives.</p><h3>Wrapping Up</h3><p>With this guide, you’ve built a Smart Habit Tracker that not only tracks habits but also provides personalized insights, visualizes progress, and motivates users to keep going. The integration of AI-driven insights with an intuitive interface makes this tool unique and impactful for users looking to improve their lives.</p><p>If you need help building or expanding your AI-powered Smart Habit Tracker, feel free to reach out to me!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8ec06a465f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gjam/smart-habit-tracker-building-an-ai-powered-tool-for-lifestyle-improvement-d8ec06a465f3">Smart Habit Tracker: Building an AI-Powered Tool for Lifestyle Improvement</a> was originally published in <a href="https://medium.com/gjam">GJAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google vs. Perplexity vs. GJAM Search: A Tale of Three Search Engines and Political Bias]]></title>
            <link>https://medium.com/gjam/google-vs-perplexity-vs-gjam-search-a-tale-of-three-search-engines-and-political-bias-bd2fac293d57?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd2fac293d57</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[search]]></category>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 05:13:44 GMT</pubDate>
            <atom:updated>2024-10-13T05:13:44.838Z</atom:updated>
            <content:encoded><![CDATA[<p><em>October 13, 2024</em></p><p>Let’s talk about the curious case of searching for “Kamala Harris podcast criticism” on three different platforms: Google, Perplexity, and GJAM Search. What do you get when you pit the reigning tech giant against a newcomer in the search engine game and an up-and-coming alternative? You get a front-row seat to political bias at play, with a generous side of head-scratching questions about the ecosystem.</p><h3>Google: The PR Machine</h3><p>You type “Kamala Harris podcast criticism” into Google, and you hit enter. You wait a couple of milliseconds, and there it is — the great wall of positivity! Not a single critical word. It’s like Google hired a PR agency just to sweep the internet clean of any critique. Zero criticism on the entire page. Nada. Kamala Harris must have the cleanest podcast on the planet — according to Google.</p><p>Google, oh Google, the curator of sunshine and rainbows. It’s like typing in “why does everyone love my boss?” and getting a bunch of links on how to make her favorite cookies. Are they hiding something? Or maybe they think criticism is just too negative for your delicate eyeballs. Either way, it’s the good ol’ information sanitization at work, and it’s glorious.</p><h3>Perplexity: The Truth-Teller?</h3><p>Now, let’s head over to Perplexity, that quirky underdog in the search engine world. You punch in the same query, “Kamala Harris podcast criticism,” and <em>bam!</em> There it is — criticism, nuance, balance, the works. Perplexity presents the good, the bad, and the ugly. It’s like sitting down with that brutally honest friend who tells you that, yes, your haircut <em>is</em> a bit of a disaster, but they also tell you why it could work with a little touch-up. Perplexity brings you well-explained, nuanced, and useful information.</p><p>It’s almost like Perplexity trusts you as an adult capable of handling multiple viewpoints. Imagine that! While Google tiptoes around criticism, Perplexity pours you a cup of black coffee and gets real with you. No sugar-coating, no filtering — just the facts, as varied as they may be.</p><h3>GJAM Search: The Pragmatic Middle-Ground</h3><p>And then there’s GJAM Search, the new kid on the block. You type in “Kamala Harris podcast criticism” and, surprisingly, you get a mix — critical analysis, supportive perspectives, and everything in between. GJAM doesn’t try to filter your worldview or make it more comfortable; instead, it seems to understand that life is full of gray areas.</p><p>GJAM Search takes a pragmatic approach. It doesn’t bombard you with an overload of criticism like Perplexity, nor does it shy away from showing anything negative like Google. It’s as if GJAM decided to take the best of both worlds — giving you a balanced, diverse set of viewpoints, while still being easy to navigate. It’s like sitting down with a friend who knows how to read the room: they tell you what you need to hear but don’t forget to add a joke or two to lighten things up.</p><h3>A Political Bias or Just the Algorithm?</h3><p>Here’s the kicker: as much as I want to dismiss political bias as a right-wing conspiracy theory, the evidence is right there, staring back at me. Google’s polished and sanitized version of the internet vs. Perplexity’s raw, unfiltered approach, and GJAM’s attempt to find the middle ground. It’s hard not to wonder if Google’s algorithm has a secret crush on the establishment — or if it’s just programmed to play nice to keep advertisers and stakeholders happy.</p><p>Let’s not kid ourselves. The tech world is like a high school clique. Google is that popular kid who’s always trying to impress the teachers and stay on the good side of the school principal. Perplexity? It’s the scrappy outsider who doesn’t care if their clothes aren’t ironed or their opinions aren’t pleasing everyone — they’re here to tell it like it is. And GJAM? GJAM is that balanced friend who doesn’t pick sides but always keeps it real.</p><h3>The Echo Chamber of Positivity</h3><p>The internet, once touted as the great democratizer of information, now seems to be curated like a luxury garden party. You walk in, and you’re surrounded by carefully trimmed hedges, perfect lighting, and polite conversation. Google’s search results feel like that. The criticism? Oh, it’s somewhere, but it’s hidden behind the lemonade stand. You’ll have to walk around the perfectly curated bushes to find it — if you’re lucky.</p><p>And maybe that’s the problem. The gatekeepers of information are shaping the narrative, turning what should be a rough-and-tumble marketplace of ideas into a sanitized gallery. Perplexity, on the other hand, seems to have no qualms about leaving the gallery door open, even if there’s some spilled paint and a controversial sculpture in the corner. Meanwhile, GJAM gives you a gallery with a “viewer discretion advised” sign — inviting you to explore but warning you of what lies ahead.</p><h3>The Moral of the Story</h3><p>So, here we are. Google vs. Perplexity vs. GJAM — a perfect showdown for the times we live in. One serves you filtered perfection, another hands you the real, sometimes uncomfortable, story, and the third tries to strike a balance. Perhaps it’s time we start questioning our allegiances to these tech giants. Do we want a reality that’s crafted and curated, the raw messiness of the real world, or something that sits comfortably in between?</p><p>It’s not just about a podcast or its criticism — it’s about what we value in the information we consume. The curated comfort of Google, the raw honesty of Perplexity, or the balanced pragmatism of GJAM? You decide.</p><p>In the meantime, I’ll be over here, sipping my tea, scrolling through GJAM and Perplexity, and enjoying a bit of honest, unpolished truth — even if it’s not always pretty.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd2fac293d57" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gjam/google-vs-perplexity-vs-gjam-search-a-tale-of-three-search-engines-and-political-bias-bd2fac293d57">Google vs. Perplexity vs. GJAM Search: A Tale of Three Search Engines and Political Bias</a> was originally published in <a href="https://medium.com/gjam">GJAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ever-Changing Political Landscape of Maharashtra: An In-Depth Analysis]]></title>
            <link>https://medium.com/gjam/the-ever-changing-political-landscape-of-maharashtra-an-in-depth-analysis-1626e3715a2f?source=rss-be1bf8285f8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1626e3715a2f</guid>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[india]]></category>
            <category><![CDATA[maharashtra-government]]></category>
            <dc:creator><![CDATA[Japan Gor]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 05:10:32 GMT</pubDate>
            <atom:updated>2024-10-13T05:10:32.358Z</atom:updated>
            <content:encoded><![CDATA[<p><em>October 13, 2024</em></p><p>Maharashtra, India’s financial powerhouse, has always been a political hotspot with a dynamic and often unpredictable political landscape. The state’s politics have been marked by alliances made and broken, rivalries across generations, and a power struggle that reflects both regional aspirations and national influences. From the rise of the Shiv Sena to the emergence of political splits and strategic alliances, Maharashtra’s political scene has been nothing short of a Bollywood thriller.</p><h3>A History of Alliances and Splits</h3><h3>The Rise of Shiv Sena: From Regional Party to National Ambitions</h3><p>Maharashtra’s political landscape began to change dramatically in the late 1960s with the rise of the Shiv Sena. Founded by Bal Thackeray in 1966, Shiv Sena emerged as a champion of Marathi pride and identity, focusing on regional issues and promoting the cause of the “Marathi Manoos” (Marathi people). Its populist agenda and aggressive approach towards migrant communities helped Shiv Sena build a loyal following, primarily among the working class in Mumbai.</p><p>In the 1990s, Shiv Sena aligned with the Bharatiya Janata Party (BJP), and together they formed a formidable political force. The BJP-Shiv Sena alliance was pivotal in helping the BJP rise to power in Maharashtra, especially after the 1995 elections. But as the years progressed, ideological differences, leadership conflicts, and ambitions clashed, leading to an increasingly strained relationship between the two parties.</p><h3>The Split: The Fall of the Uddhav Thackeray Government</h3><p>One of the most dramatic events in recent years was the split within Shiv Sena in 2022. Uddhav Thackeray, the then Chief Minister of Maharashtra, led a coalition government that included ideologically diverse allies — the Nationalist Congress Party (NCP) and the Indian National Congress. This alliance, known as the Maha Vikas Aghadi (MVA), was an unusual attempt to thwart the rise of the BJP in the state.</p><p>However, Shiv Sena faced internal unrest as Eknath Shinde, a senior leader, led a faction of the party to break away from Uddhav’s leadership. Citing discontent with the Congress-NCP alliance and a deviation from the party’s core values, Shinde’s faction aligned with the BJP, toppling the MVA government in a highly publicized power shift. This led to Eknath Shinde taking over as the Chief Minister with BJP’s Devendra Fadnavis as his deputy.</p><p>This episode highlighted the fragility of political alliances and the underlying ambition of different leaders within the same party. It also showcased the BJP’s shrewd political maneuvering to reclaim influence in Maharashtra.</p><h3>The NCP’s Power Play: Pawar vs. Pawar</h3><p>While the Shiv Sena was experiencing turbulence, the NCP, led by veteran politician Sharad Pawar, was also facing an internal battle. The emergence of Ajit Pawar, Sharad Pawar’s nephew, as a challenger to his uncle’s leadership added another layer of intrigue to Maharashtra politics. Ajit Pawar’s attempted rebellion against Sharad Pawar, and his short-lived alliance with the BJP in 2019, showed the cracks within the NCP and the ambitions brewing within the party.</p><p>Sharad Pawar, often regarded as the master strategist of Indian politics, managed to bring Ajit back into the fold, but the incident highlighted the growing influence of the younger generation within Maharashtra’s political landscape. The power struggle between Sharad Pawar and Ajit Pawar symbolizes the broader tussle between the old guard and the young leaders eager to leave their mark.</p><h3>BJP’s Strategic Dominance</h3><p>The Bharatiya Janata Party has steadily increased its footprint in Maharashtra over the years, capitalizing on internal divisions within both the Shiv Sena and NCP. The BJP’s strategy in Maharashtra has been one of persistence and patience, waiting for the right opportunity to exploit weaknesses within opposition parties.</p><p>Devendra Fadnavis, the former Chief Minister, has been a key figure in the BJP’s plans in Maharashtra. Known for his administrative capabilities and clean image, Fadnavis has been instrumental in maintaining the BJP’s influence in the state. His return as Deputy Chief Minister in the Shinde government demonstrated the BJP’s flexibility and willingness to make tactical sacrifices for the sake of power.</p><h3>Congress: A Diminished Force</h3><p>The Congress, once a dominant force in Maharashtra, has seen its influence wane significantly. Internal factionalism, a lack of strong leadership, and the rise of regional parties have contributed to the decline of Congress in the state. Despite being a part of the MVA government, Congress played a secondary role, often overshadowed by its allies.</p><p>The party’s inability to connect with the youth and address regional issues effectively has further alienated its voter base. As a result, Congress has been relegated to playing a supporting role in coalition politics, rather than being a driving force in Maharashtra.</p><h3>The Road Ahead: Uncertainty and New Equations</h3><p>Maharashtra’s political landscape remains fluid, with several possibilities for new alliances and splits. The Shiv Sena split has led to two factions — Shiv Sena (Uddhav Balasaheb Thackeray) and the Shinde-led Shiv Sena — each claiming to be the true inheritor of Bal Thackeray’s legacy. The ongoing battle for the party’s identity is likely to shape Maharashtra’s political future.</p><p>The NCP’s internal dynamics are also worth watching, as Ajit Pawar’s ambitions may lead to further changes within the party. The BJP, on the other hand, is expected to continue its strategy of expanding its influence, either through alliances or by weakening its rivals from within.</p><p>As Maharashtra heads into the next assembly elections, the political equations are far from settled. The shifting loyalties, family feuds, and power struggles make it difficult to predict what the future holds. However, one thing is certain — Maharashtra’s politics will continue to be as dramatic and unpredictable as ever, keeping both politicians and voters on their toes.</p><h3>Final Thoughts</h3><p>Maharashtra’s political landscape is a fascinating reflection of the complexities of coalition politics, regional identity, and power struggles. The state’s politics are driven by personalities, ambitions, and shifting alliances that can change the course of governance overnight. As parties continue to navigate their internal challenges and forge new alliances, Maharashtra’s politics will remain an arena of high-stakes drama and strategic maneuvering.</p><p>The only constant in Maharashtra politics is change, and as the political chessboard keeps shifting, the state’s future will depend on how well its leaders adapt to the evolving dynamics. Whether it’s the BJP’s strategic moves, the Shiv Sena’s internal battles, or the NCP’s power play, Maharashtra’s politics are a reminder that in the game of power, nothing is ever certain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1626e3715a2f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gjam/the-ever-changing-political-landscape-of-maharashtra-an-in-depth-analysis-1626e3715a2f">The Ever-Changing Political Landscape of Maharashtra: An In-Depth Analysis</a> was originally published in <a href="https://medium.com/gjam">GJAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>