<?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 Shaikh Niamatullah on Medium]]></title>
        <description><![CDATA[Stories by Shaikh Niamatullah on Medium]]></description>
        <link>https://medium.com/@shaikhniamatullah?source=rss-d8dc81129792------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ILC8xdLjZYeZN1903iQMAQ.jpeg</url>
            <title>Stories by Shaikh Niamatullah on Medium</title>
            <link>https://medium.com/@shaikhniamatullah?source=rss-d8dc81129792------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:40:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shaikhniamatullah/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build a Google Gemini AI Chatbot in Python Using VS Code — A Step-by-Step Guide]]></title>
            <link>https://medium.com/@shaikhniamatullah/build-a-google-gemini-ai-chatbot-in-python-using-vs-code-a-step-by-step-guide-8c7dd25e9739?source=rss-d8dc81129792------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c7dd25e9739</guid>
            <dc:creator><![CDATA[Shaikh Niamatullah]]></dc:creator>
            <pubDate>Sun, 03 Aug 2025 19:09:53 GMT</pubDate>
            <atom:updated>2025-08-03T19:09:53.590Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Build a Google Gemini AI Chatbot in Python Using VS Code — A Step-by-Step Guide</strong></h3><p><strong>Step 1: Install Python 3.7</strong></p><p><strong>Mac</strong></p><p>brew install python@3.7</p><p><strong>On Windows</strong><br>Download installer: <a href="http://python.org/downloads/release/python-370">python.org/downloads/release/python-370</a><br>During setup: Check Add Python to PATH</p><p><strong>Step 2: Install Python Extension in VS Code</strong></p><p>Open VSCode and Install Python extension</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJXPkz3Pm-FkcZA0QscLCQ.png" /></figure><h4>Step 3: Create a .env File</h4><p>In your project folder:</p><pre>Inside .env, add your Gemini API key:</pre><pre>Get your key from https://makersuite.google.com/app/apikey.</pre><h4>Step 4: Install Required Libraries</h4><p>Inside your project folder, install the following:</p><pre>pip install python-dotenv google-generativeai</pre><h3>Step 5: Create Your Chatbot Python File</h3><p>Create a file named chatbot.py and add the following code:</p><pre>import os # import os module to access environment variables<br>import google.generativeai as genai # Import google generate ai library<br>from dotenv import load_dotenv # import load_dotenv to load environment variables from .env file<br><br>class DummyChatbot:<br>    def __init__(self, model_name=&quot;models/gemini-1.5-flash-002&quot;):<br>        load_dotenv() # Load environment variables from .env file<br>        api_key = os.getenv(&quot;GEMINI_API_KEY&quot;)<br>        <br>        # Get the API key from environment variables<br><br>        if not api_key:<br>            raise ValueError(&quot;GEMINI_API_KEY is missing in .env file.&quot;)<br>        <br>        genai.configure(api_key=api_key)<br><br>        self.model_name = model_name<br>        self.model = genai.GenerativeModel(model_name=self.model_name) # Define model name with Gemini API<br> # Create method to get the response from the model<br>    def ask(self, prompt: str) -&gt; str:<br>        try:<br>            response = self.model.generate_content(prompt)<br>            return response.text.strip()<br>        except Exception as e:<br>            return f&quot;Error: {e}&quot;<br>    # Create a method to start the chat<br>    def chat(self):<br>        print(f&quot;Hello! Let&#39;s start chat .\n&quot;)<br>        while True:<br>            user_input = input(&quot;You: &quot;)<br>            if user_input.strip().lower() in [&quot;exit&quot;, &quot;quit&quot;, &quot;bye&quot;]:<br>                print(&quot;ChatBot: Goodbye!&quot;)<br>                break<br>            #Call the ask method to get the response from the model<br>            reply = self.ask(user_input)<br>            print(&quot;Gemini ChatBot:&quot;, reply)<br>            <br># Create a main function to run the chatbot<br>if __name__ == &quot;__main__&quot;:<br>    chatbot = DummyChatbot()<br>    chatbot.chat()</pre><h4>Step 6: Run the Chatbot</h4><h4>Option 1: From VS Code</h4><ul><li>Open chatbot.py</li><li>Click ▶️ “Run Python File” at the top</li></ul><h4>Option 2: From Terminal</h4><pre>python chatbot.py</pre><h4>Output</h4><p>If everything is set up correctly, your terminal will display a response from the Gemini model, like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y6aTUnrgw1FZ0fwMFcFSig.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c7dd25e9739" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stream AI Text in Real-Time with Google’s Gemini API using Angular (@google/genai)]]></title>
            <link>https://medium.com/@shaikhniamatullah/stream-ai-text-in-real-time-with-googles-gemini-api-using-angular-google-genai-56dc384f7836?source=rss-d8dc81129792------2</link>
            <guid isPermaLink="false">https://medium.com/p/56dc384f7836</guid>
            <dc:creator><![CDATA[Shaikh Niamatullah]]></dc:creator>
            <pubDate>Sat, 24 May 2025 14:15:51 GMT</pubDate>
            <atom:updated>2025-05-24T14:16:24.633Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stream AI Text in Real-Time with Google’s Gemini API (@google/genai) using Angular</h3><p>In the world of modern apps, <strong>waiting for a full AI response just doesn’t cut it anymore</strong>. Whether you’re building a chatbot, writing assistant, or a productivity tool — your users expect real-time, streaming responses.</p><p>Thankfully, <strong>Google’s Generative AI SDK</strong> now makes this easier than ever with generateContentStream.</p><p>In this blog, I’ll walk you through how to:</p><p>✅ Set up Google’s AI API<br>✅ Use the Gemini 2.0 Flash model<br>✅ Stream AI responses chunk-by-chunk in real time<br>✅ Integrate with a frontend</p><h3>Step 1: Get Your API Key</h3><p>To use Google’s Gemini models, you need an API key.</p><p>👉 Go to <a href="https://aistudio.google.com/apikey">https://aistudio.google.com/apikey</a><br>Generate your API key and keep it safe — you’ll need it in the next steps.</p><p>📦 Step 2: Install the SDK</p><p>Run this command in your terminal:</p><pre>npm install @google/genai</pre><p>This will install the official SDK from Google for interacting with their GenAI platform.</p><h3>🧠 Step 3: Set Up the Client</h3><p>In your angular service, import and initialize the client using your API key:</p><p>Define the models.</p><pre>import { GoogleGenerativeAI } from &#39;@google/genai&#39;;</pre><pre>const genAI = new GoogleGenerativeAI(&quot;YOUR_API_KEY_HERE&quot;);</pre><h3>🚀 Step 4: Create a Streamed Generation Function with defined Models with generateContentStream method</h3><p>Let’s write a function to generate text <strong>using the streaming API</strong>:</p><pre>const stream = await this.genAI.models.generateContentStream({<br>            model: &#39;gemini-2.0-flash-001&#39;, // Model name <br>            contents: &quot;Your input&quot;<br>    });</pre><pre> generateStream(prompt: string): Observable&lt;string&gt; {<br>    return new Observable&lt;string&gt;(observer =&gt; {<br>      (async () =&gt; {<br>        try {<br>          const stream = await this.genAI.models.generateContentStream({<br>            model: &#39;gemini-2.0-flash-001&#39;,<br>            contents: prompt<br>          });<br><br>          for await (const chunk of stream) { <br>            if (chunk.text) {<br>              observer.next(chunk.text); // Sync up loop chunk text Emit each text chunk<br>            }<br>          }<br><br>          observer.complete();<br>        } catch (error) {<br>          observer.error(error); // Handle errors<br>        }<br>      })();<br>    });<br>  }</pre><p>💡 gemini-2.0-flash-001 is optimized for <strong>speed and interactivity</strong> — perfect for chatbots and live assistants.</p><h3>🧩 Step 5: Handle the Stream in Your Frontend</h3><p>Now let’s consume the stream. This example uses a simple async loop:</p><pre> this.genAiServiceService.generateStream(&quot;your text&quot;).subscribe({<br>      next: (response) =&gt; {<br>        <br>        this.results += response; // Store the response in a component property<br>        console.log(&#39;AI Response:&#39;, this.results);<br>      }<br><br>      ,<br>      error: (error) =&gt; {<br>        console.error(&#39;Error fetching AI response:&#39;, error);<br>      }<br>    });</pre><pre>&lt;div&gt;<br>      @if (results.length &gt; 0) {<br>        &lt;div class=&quot;results&quot;&gt;<br>          {{ results }}<br>        &lt;/div&gt;<br>      } <br>    &lt;/div&gt;</pre><p>Each chunk gives you a part of the response as it&#39;s being generated. You can show it live in your app!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56dc384f7836" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create desktop application from web application using Angular]]></title>
            <link>https://medium.com/@shaikhniamatullah/create-desktop-application-from-web-application-using-angular-4fb1664264c5?source=rss-d8dc81129792------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fb1664264c5</guid>
            <dc:creator><![CDATA[Shaikh Niamatullah]]></dc:creator>
            <pubDate>Sat, 04 Jan 2025 07:46:32 GMT</pubDate>
            <atom:updated>2025-01-04T07:46:32.325Z</atom:updated>
            <content:encoded><![CDATA[<p>In the fast-paced world of technology, web applications dominate the scene. But there are scenarios where users prefer desktop applications for better accessibility, offline capabilities, and native integration with the operating system. Converting a web application into a desktop application can bridge this gap seamlessly.</p><p>Here’s a step-by-step guide to turning your web app into a fully functional desktop application.</p><h3>1. Understand the Use Case</h3><p>Before diving into the conversion process, it’s essential to understand why you want a desktop application. Common motivations include:</p><ul><li>Offline access</li><li>Enhanced performance</li><li>Better OS-level integration (e.g., file system access, notifications)</li><li>Branding or distribution needs</li></ul><p>A clear purpose helps guide the technical decisions in the conversion process.</p><h3>2. Choose the Right Framework</h3><p>There are several tools and frameworks that make it easy to package a web application as a desktop app. Here are some popular ones:</p><ul><li><strong>Electron.js</strong>: A powerful framework that lets you build cross-platform desktop apps using web technologies like HTML, CSS, and JavaScript. It’s used by applications like Slack, Discord, and Visual Studio Code.</li><li><strong>Tauri</strong>: Lightweight and faster than Electron, Tauri uses web technologies but is more resource-efficient.</li></ul><h3>3. Set Up Your Environment</h3><p>Start by setting up the necessary development environment for your chosen framework. For example, if you’re using Electron.js:</p><ol><li>Install Node.js</li><li>Install angular cli</li></ol><p><strong>npm install -g @angular/cli</strong></p><p>3. Install Electron</p><p><strong>npm install -g electron</strong></p><p>4. Initilise or create angular project</p><p>ng new hello-world-desktop</p><p>Go inside the project folder</p><p>5. Add electron to the angular project</p><p>npm install electron — save-dev</p><p>6. Create an Electron main process file at the root level (e.g., electron-main.js):</p><pre>const {app, BrowserWindow} = require(&#39;electron&#39;);  <br>const url = require(&#39;url&#39;);<br>const path = require(&#39;path&#39;);   <br> <br>function onReady () {     <br> win = new BrowserWindow({width: 900, height: 6700})    <br> win.loadURL(url.format({      <br>  pathname: path.join(<br>   __dirname,<br>   &#39;/dist/hello-world-desktop/index.html&#39;),     // Put the path of index.html file with dist <br>  protocol: &#39;file:&#39;,      <br>  slashes: true     <br> }))   <br>} <br><br>app.on(&#39;ready&#39;, onReady);</pre><p>7. Add Scripts and build to Package.json</p><pre> &quot;scripts&quot;: {<br>    &quot;ng&quot;: &quot;ng&quot;,<br>    &quot;start&quot;: &quot;ng serve&quot;,<br>    &quot;build&quot;: &quot;ng build&quot;,<br>    &quot;watch&quot;: &quot;ng build --watch --configuration development&quot;,<br>    &quot;test&quot;: &quot;ng test&quot;,<br>    &quot;electron&quot;: &quot;ng build &amp;&amp; electron .&quot;,<br>    &quot;package&quot;: &quot;electron-builder&quot;,<br>    &quot;package:all&quot;: &quot;electron-builder --mac --win --linux&quot;<br>  },<br>  &quot;build&quot;: {<br>    &quot;directories&quot;: {<br>      &quot;output&quot;: &quot;dist&quot;<br>    },<br>    &quot;files&quot;: [<br>     &quot;dist/**/*&quot;,         <br>      &quot;electron-main.js&quot;,   <br>      &quot;node_modules/**/*&quot;,<br>      &quot;package.json&quot;<br>    ]<br>  },</pre><p>8. Run the Desktop App</p><p>Build Angular Application</p><p>npm run build or npm run build &amp;&amp; npm run electron</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*thaqgpSHjyeuFsirbFP89A.png" /></figure><p>9- Find the desktop application(for window,mac,unix) from the Output Files .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-oNVL1crIv7yd-MSkmMuA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fb1664264c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>