<?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 Subtain Malik on Medium]]></title>
        <description><![CDATA[Stories by Subtain Malik on Medium]]></description>
        <link>https://medium.com/@sbmalik?source=rss-6458082b57d1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IuGhLt-y05VRRuQ8_ZKCog.jpeg</url>
            <title>Stories by Subtain Malik on Medium</title>
            <link>https://medium.com/@sbmalik?source=rss-6458082b57d1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:32:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sbmalik/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[MCP Tutorial]]></title>
            <link>https://medium.com/@sbmalik/mcp-tutorial-53200b08347a?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/53200b08347a</guid>
            <category><![CDATA[mcp-client]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Wed, 23 Apr 2025 07:37:56 GMT</pubDate>
            <atom:updated>2025-04-23T07:37:56.220Z</atom:updated>
            <content:encoded><![CDATA[<p>A demonstration of connecting multiple MCP Servers to an AI agent using LangGraph and Groq’s LLaMA3 model. This project showcases how to create modular AI tool services that can be queried by an agent to solve problems.</p><h3>Workflow Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/0*frS7a7pV0wbOedRW.png" /><figcaption>workflow diagram</figcaption></figure><h3>📋 Prerequisites</h3><ul><li>Python 3.10+</li><li><a href="https://github.com/astral-sh/uv">uv</a> package manager</li><li>Groq API key (get it from <a href="https://console.groq.com/keys">https://console.groq.com/keys</a>)</li><li>Basic understanding of async Python</li></ul><h3>⚙️ Setup Instructions</h3><h3>1. Initialize the Project</h3><p>Use uv to set up a new Python project:</p><pre>uv init mcp_exp</pre><h3>2. Install Dependencies</h3><pre>uv add langchain-mcp-adapters langgraph langchain-groq python-dotenv<br>uv sync</pre><h3>🛠️ Create MCP Tools</h3><h3>1. Create Server Files</h3><pre>mkdir mcp_servers<br>touch mcp_servers/calculator_server.py<br>touch mcp_servers/weather_server.py</pre><h3>2. Calculator Server (calculator_server.py)</h3><pre>from typing import List<br>from mcp.server.fastmcp import FastMCP<br><br>mcp = FastMCP(&quot;Calculator&quot;, port=8001)<br><br><br>@mcp.tool()<br>async def add(a: int, b: int) -&gt; int:<br>    &quot;&quot;&quot;Add two numbers.&quot;&quot;&quot;<br>    return a + b<br><br><br>@mcp.tool()<br>async def subtract(a: int, b: int) -&gt; int:<br>    &quot;&quot;&quot;Subtract two numbers.&quot;&quot;&quot;<br>    return a - b<br><br><br>@mcp.tool()<br>async def multiply(a: int, b: int) -&gt; int:<br>    &quot;&quot;&quot;Multiply two numbers.&quot;&quot;&quot;<br>    return a * b<br><br><br>@mcp.tool()<br>async def divide(a: int, b: int) -&gt; float:<br>    &quot;&quot;&quot;Divide two numbers.&quot;&quot;&quot;<br>    return a / b<br><br><br>@mcp.tool()<br>async def power(a: int, b: int) -&gt; int:<br>    &quot;&quot;&quot;Raise a number to the power of another number.&quot;&quot;&quot;<br>    return a**b<br><br><br>if __name__ == &quot;__main__&quot;:<br>    mcp.run(transport=&quot;sse&quot;)</pre><h3>3. Weather Server (weather_server.py)</h3><pre>from typing import List<br>from mcp.server.fastmcp import FastMCP<br><br>mcp = FastMCP(&quot;Weather&quot;, port=8000)<br><br><br>@mcp.tool()<br>async def get_weather(location: str) -&gt; str:<br>    &quot;&quot;&quot;Get weather for location.&quot;&quot;&quot;<br>    return &quot;It&#39;s always sunny in New York&quot;<br><br><br>if __name__ == &quot;__main__&quot;:<br>    mcp.run(transport=&quot;sse&quot;)</pre><h3>▶️ Run MCP Servers</h3><p>Run each server in a separate terminal:</p><pre>uv run mcp_servers/calculator_server.py</pre><pre>uv run mcp_servers/weather_server.py</pre><h3>🤖 Create the MCP Client</h3><h3>Client Code (main.py)</h3><pre>from langchain_mcp_adapters.client import MultiServerMCPClient<br>from langgraph.prebuilt import create_react_agent<br>import asyncio<br>from langchain_groq import ChatGroq<br>from langchain_core.messages import (<br>    HumanMessage,<br>    AIMessage,<br>    ToolMessage,<br>)<br>from typing import List<br>from dotenv import load_dotenv<br><br>load_dotenv()<br><br>model = ChatGroq(model=&quot;llama3-70b-8192&quot;)<br><br><br>async def show_weather_response(agent, message: str):<br>    weather_response = await agent.ainvoke({&quot;messages&quot;: message})<br>    for message in weather_response[&quot;messages&quot;]:<br>        if isinstance(message, HumanMessage):<br>            print(f&quot;HumanMessage: {message.content}&quot;)<br>        elif isinstance(message, AIMessage):<br>            print(f&quot;AIMessage: {message.content}&quot;)<br>        elif isinstance(message, ToolMessage):<br>            print(f&quot;ToolMessage: {message.content}&quot;)<br><br><br>async def show_calculator_response(agent, message: str):<br>    calculator_response = await agent.ainvoke({&quot;messages&quot;: message})<br>    for message in calculator_response[&quot;messages&quot;]:<br>        if isinstance(message, HumanMessage):<br>            print(f&quot;HumanMessage: {message.content}&quot;)<br>        elif isinstance(message, AIMessage):<br>            print(f&quot;AIMessage: {message.content}&quot;)<br>        elif isinstance(message, ToolMessage):<br>            print(f&quot;ToolMessage: {message.content}&quot;)<br><br><br>async def main():<br>    async with MultiServerMCPClient(<br>        {<br>            &quot;calculator&quot;: {<br>                &quot;url&quot;: &quot;http://localhost:8001/sse&quot;,<br>                &quot;transport&quot;: &quot;sse&quot;,<br>            },<br>            &quot;weather&quot;: {<br>                &quot;url&quot;: &quot;http://localhost:8000/sse&quot;,<br>                &quot;transport&quot;: &quot;sse&quot;,<br>            },<br>        },<br>    ) as client:<br>        agent = create_react_agent(model, client.get_tools())<br>        await show_weather_response(agent, &quot;what is the weather in nyc?&quot;)<br>        await show_calculator_response(<br>            agent,<br>            &quot;when I add 2 and 2, what do I get after dividing the answer with 4&quot;,<br>        )<br><br><br>if __name__ == &quot;__main__&quot;:<br>    asyncio.run(main())</pre><h3>🔐 .env Configuration</h3><p>Create a .env file in the root of your project and add your Groq API key:</p><pre>GROQ_API_KEY=your_groq_api_key_here</pre><p>Get your API key from: <a href="https://console.groq.com/keys">https://console.groq.com/keys</a></p><h3>🚀 Run the Client</h3><p>Once your servers are running, launch the main client:</p><pre>uv run main.py<br><br># OUTPUT<br>HumanMessage: what is the weather in nyc?<br>AIMessage: <br>ToolMessage: It&#39;s always sunny in New York<br>AIMessage: It&#39;s always sunny in New York.<br><br>HumanMessage: when I add 2 and 2, what do I get after dividing the answer with 4<br>AIMessage: <br>ToolMessage: 4<br>AIMessage: <br>ToolMessage: 1.0<br>AIMessage: The answer is 1.0.</pre><h3>🔍 How It Works</h3><ol><li><strong>MCP Servers:</strong> Each server exposes a set of tools as API endpoints using Server-Sent Events (SSE)</li><li><strong>MultiServer MCPClient: </strong>Connects to multiple MCP servers and aggregates their tools</li><li><strong>LangGraph Agent: </strong>Uses the ReAct pattern to:</li></ol><p>Analyze the user’s query → Determine which tool to use → Call the appropriate tool → Process the results → Formulate a response</p><h3>🔗 References</h3><ul><li><a href="https://github.com/langchain-ai/langchain-mcp-adapters">LangChain MCP Adapters</a></li><li><a href="https://python.langchain.com/docs/langgraph">LangGraph Documentation</a></li><li><a href="https://console.groq.com/docs/quickstart">Groq API Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53200b08347a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LLMs and the Path to AGI: How Close Are We? ]]></title>
            <link>https://medium.com/@sbmalik/llms-and-the-path-to-agi-how-close-are-we-f8c4305791c5?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8c4305791c5</guid>
            <category><![CDATA[agi]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Mon, 09 Dec 2024 06:47:49 GMT</pubDate>
            <atom:updated>2024-12-09T06:47:49.330Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="llm going to agi" src="https://cdn-images-1.medium.com/max/498/1*7Drg6DwBcE6dPQMn43FlRQ.jpeg" /></figure><h3>Chris (A Parent) Chats with Mr. LLM</h3><p>Imagine two persons sitting in a room, Chris and Mr. LLM. Chris wants Mr. LLM to teach his kid about car driving. When Chris asks about this, Mr. LLM agrees and begins explaining:</p><p><em>A car has four main systems. The powertrain includes the engine, transmission, and drivetrain, which work together to move the vehicle. The suspension system helps absorb shock and maintain stability. The steering system lets you control direction through the rack-and-pinion mechanism. And the braking system uses hydraulic pressure to slow the car through friction.</em></p><p>Chris asks about parking, and Mr. LLM confidently states, “<em>Tell them to always turn the wheel towards the curb when parking on a hill. It’s universal.</em>”</p><p>“Wait, isn’t it away from the curb when uphill without a curb?” Chris questions.</p><p>“<em>No, no, always towards</em>,” Mr. LLM insists, wrong again. ( 🛑 <strong>Hallucinations</strong>)</p><p>When Chris asks what to do if his kid panics while driving, Mr. LLM takes too long to respond, then launches into a <em>lengthy explanation</em> about <em>stress psychology</em> that misses the point of immediate action. ( <strong>🛑 Real Time Inference</strong>)</p><p>Things get worse when Chris shows a traffic light picture. “How would you explain this?”</p><p>Mr. LLM admits, “<em>I can’t see that. Describe it to me.</em>”</p><p>“You can’t process images?” Chris sighs. “What about reviewing video of their driving practice?”</p><p>“<em>I can’t help with that either,</em>” Mr. LLM concedes. ( <strong>🛑 Multi Modality</strong>)</p><p>The final straw comes when Chris asks about brake failure on a downhill slope.</p><p>“<em>Engage the air brakes,</em>” Mr. LLM replies confidently.</p><p>Chris stares in disbelief. “Air brakes? It’s a family sedan, not a truck. You have no idea how real emergencies work!” ( <strong>🛑 Physics of the World</strong>)</p><p>This concludes our story, but it also sparks a discussion about how far we are from achieving AGI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*lV3AEg3sS4wacwv1Yr1dOQ.jpeg" /></figure><h4>💭🤖 Hallucinations</h4><p>Current LLMs struggle with factual consistency because they lack true understanding, instead relying on text generation from training data. This isn’t just about text generation — it’s about developing systems that can build reliable knowledge representations and know their own limitations. For AGI, we need AI that can distinguish fact from fiction and acknowledge uncertainty.</p><h4>⏱️⚡ Real-Time Inference</h4><p>The delayed response in emergency situations highlights a key weakness. While LLMs can process information quickly, they struggle with real-time inference, and achieving that requires very high computational power, which is another challenge. AGI requires not just responses, but intelligent and real-time reactions to handle situations.</p><h4>👁️👂Multi-Modality</h4><p>The inability to process images and videos reveals a fundamental gap. Human intelligence naturally integrates multiple information types. Although there has been significant progress in this area, LLMs still struggle with multi-modality, as evidenced by the image attached below. AGI needs seamless processing of visual, auditory, and other sensory inputs — not as separate capabilities, but as a unified system understanding the world through multiple channels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*WUdZZ9L2lL2cacbrD03Lgw.jpeg" /></figure><h4>🌍⚖️ Physics of the World</h4><p>The air brakes suggestion demonstrates the most basic flaw: lack of real-world understanding. AGI requires more than information processing — it needs fundamental comprehension of physical reality, causality, and practical constraints. Without this grounding, AI systems remain disconnected from the real world they’re meant to operate in</p><p>These aren’t just technical hurdles — they’re fundamental gaps in our approach to AI. While current LLMs excel at text generation, true AGI requires a revolutionary leap in how machines understand and interact with reality. Progress demands not just scaling existing systems, but reimagining how we create AI that genuinely comprehends the world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8c4305791c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MultiModal ML03: Similarity Measures]]></title>
            <link>https://medium.com/@sbmalik/multimodal-ml03-similarity-measures-3de1ab56dc5b?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/3de1ab56dc5b</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Fri, 29 Dec 2023 06:51:58 GMT</pubDate>
            <atom:updated>2023-12-29T06:51:58.355Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UmH6veoXlldqaOedFnr0Qg.png" /></figure><p>In ML 02, we delved into how embeddings convert complex data into numerical vectors, bridging the understanding gap for AI models.</p><p>The true power of embeddings lies in understanding their similarities and differences.</p><p>1️⃣ 𝗖𝗼𝘀𝗶𝗻𝗲 𝗦𝗶𝗺𝗶𝗹𝗮𝗿𝗶𝘁𝘆: is all about the angle between vectors. Perfectly aligned vectors (with no angle) score 1, indicating identical direction or complete similarity. It’s essential in text embeddings, where the direction of vectors matters more than their size.</p><p>2️⃣ 𝗘𝘂𝗰𝗹𝗶𝗱𝗲𝗮𝗻 𝗗𝗶𝘀𝘁𝗮𝗻𝗰𝗲: takes a straightforward approach — it’s the straight-line distance between two points in a space. In machine learning, this measure helps in clustering and organizing lower-dimensional data, but its effectiveness can diminish in high-dimensional spaces due to complexity.</p><p>3️⃣ 𝗠𝗮𝗻𝗵𝗮𝘁𝘁𝗮𝗻 𝗗𝗶𝘀𝘁𝗮𝗻𝗰𝗲: offers a different perspective by measuring the sum of absolute differences along each dimension, akin to walking through city blocks. This method is particularly useful in certain types of clustering and optimization problems, especially when dealing with grid-like data structures.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3de1ab56dc5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MultiModal ML02: Embeddings]]></title>
            <link>https://medium.com/@sbmalik/multimodal-ml02-embeddings-ee781d26c705?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee781d26c705</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Thu, 28 Dec 2023 07:15:58 GMT</pubDate>
            <atom:updated>2023-12-28T07:15:58.457Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eSEUj6yASZKDTQMXd-E4CA.jpeg" /></figure><p>🌟 𝗧𝗵𝗲 𝗣𝗼𝘄𝗲𝗿 𝗼𝗳 𝗘𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴𝘀: At the heart of multimodal ML lies the concept of embeddings, the magical process of converting diverse unstructured data — like text, images, and audio — into a numerical format that computers can understand and process.</p><p>🔍 𝗘𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴 𝗶𝘀 𝗮 𝗡𝘂𝗺𝗯𝗲𝗿: In the world of AI, everything boils down to numbers. Embeddings are these numbers, representing complex data as n-dimensional vectors in a vector space.</p><p>👩‍🔬 𝗦𝗶𝗺𝗶𝗹𝗮𝗿𝗶𝘁𝘆 𝗶𝗻 𝗦𝗽𝗮𝗰𝗲: A fascinating aspect of embeddings is their spatial nature. Similar items are closer in the vector space, while distinct ones are farther apart. This spatial arrangement allows AI models to understand and process data with nuanced understanding.</p><p>🧠 𝗩𝗮𝗿𝗶𝗲𝘁𝘆 𝗼𝗳 𝗘𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴𝘀: There are many types of embeddings, each serving a unique purpose. For text, we have Word2Vec and BERT embeddings, which capture the essence of words and sentences. For images, CNN-based embeddings are common, translating pixels into comprehensive data. And for audio, spectrogram embeddings translate sounds into analyzable patterns.</p><p>🤖 𝗠𝗼𝗱𝗲𝗹𝘀 𝗕𝗲𝗵𝗶𝗻𝗱 𝗘𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴𝘀: Extracting these embeddings is no small feat. It involves sophisticated neural networks trained to distill the essence of data into vectors. Each type of data — text, image, audio — requires a different neural network architecture, fine-tuned for optimal performance.</p><p>🌐 𝗠𝘂𝗹𝘁𝗶𝗺𝗼𝗱𝗮𝗹 𝗦𝘆𝗺𝗽𝗵𝗼𝗻𝘆: The true beauty of embeddings in multimodal ML is how they enable different data types to be processed and understood in a unified manner. They are the foundation that allows models like GPT-4 and DALL-E to understand and generate complex content, bridging the gap between different forms of human expression.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee781d26c705" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MultiModal ML01: Introduction]]></title>
            <link>https://medium.com/@sbmalik/multimodal-ml01-introduction-acf5f8a73cb2?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/acf5f8a73cb2</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Wed, 27 Dec 2023 11:02:23 GMT</pubDate>
            <atom:updated>2023-12-27T11:03:57.680Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pww42aQMtJbF8Dllr1OOjA.jpeg" /></figure><p>𝗠𝘂𝗹𝘁𝗶-𝗠𝗼𝗱𝗮𝗹𝗶𝘁𝘆 𝗗𝗲𝗳𝗶𝗻𝗲𝗱: It’s the ability of AI to understand and process different data types in one go. Think of it as a multi-talented artist who can paint, write, sing, and film all at once!</p><p>𝗧𝗲𝘅𝘁 𝘁𝗼 𝗜𝗺𝗮𝗴𝗲 𝗠𝗼𝗱𝗲𝗹𝘀: Models like DALL-E transform text descriptions into vivid images, showcasing the power of AI creativity.</p><p>𝗘𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴 𝗠𝗼𝗱𝗲𝗹𝘀: These are the core of multi-modality. They convert text and images into vectors, forming a common language for different data types. DALL-E 2, for instance, uses CLIP to train its embedders.</p><p>𝗧𝗵𝗲 𝗠𝗮𝗴𝗶𝗰 𝗼𝗳 𝗖𝗟𝗜𝗣: This training involves feeding pairs of images and captions into text and image encoders, creating vector representations that are fine-tuned to increase similarity between related pairs and decrease it for unrelated ones.</p><p>𝗠𝘂𝗹𝘁𝗶𝗺𝗼𝗱𝗮𝗹 𝗜𝗻𝘁𝗲𝗿𝗳𝗮𝗰𝗲𝘀: Imagine telling your device to “draw me a tiger,” and it understands your speech, converts it to text, processes the instruction, and then DALL-E 3 creates the image. This seamless integration of multiple modalities, from speech to text to image, is the pinnacle of AI’s versatility.</p><p><strong>Resource:</strong> An introductory video 💡 by AssemblyAI: <a href="https://www.youtube.com/watch?v=WkoytlA3MoQ">https://www.youtube.com/watch?v=WkoytlA3MoQ</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acf5f8a73cb2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conversational Agents: The Next Big Thing After Chatbots]]></title>
            <link>https://medium.com/@sbmalik/conversational-agents-the-next-big-thing-after-chatbots-8640bc7535fd?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8640bc7535fd</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Wed, 13 Dec 2023 04:27:01 GMT</pubDate>
            <atom:updated>2023-12-13T04:27:01.732Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*FM3rjodZ-fDVDf8HrZ2feQ.jpeg" /></figure><p>Conversational agents represent the next significant advancement following chatbots. These agents uniquely integrate custom functionalities and APIs with the sophisticated language understanding capabilities of LLMs. <a href="https://www.linkedin.com/feed/#">Harrison Chase</a> offers a comprehensive guide on constructing these advanced agents in his course with <a href="https://www.linkedin.com/feed/#">DeepLearning.AI</a>. For a detailed overview and link to the course, see the information provided below.</p><p>🚀 𝗢𝗽𝗲𝗻𝗔𝗜 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻 𝗖𝗮𝗹𝗹𝗶𝗻𝗴: Learn the art of effective message writing for function calls in OpenAI. It’s a manual process but crucial for leveraging the model’s full potential, especially as function calls are more token-intensive.</p><p>🧬 𝗟𝗮𝗻𝗴𝗖𝗵𝗮𝗶𝗻 𝗘𝘅𝗽𝗿𝗲𝘀𝘀𝗶𝗼𝗻 𝗟𝗮𝗻𝗴𝘂𝗮𝗴𝗲 (𝗟𝗖𝗘𝗟): LCEL streamlines working with OpenAI functions. It’s all about chaining prompts, models, and parsers for efficient processing. Plus, discover fallbacks for model inefficiencies and batching/streaming methods for optimal performance.</p><p>🔗 𝗢𝗽𝗲𝗻𝗔𝗜 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀 + 𝗟𝗮𝗻𝗴𝗖𝗵𝗮𝗶𝗻: Dive into PyDantic for robust data types and validations, and explore how to bind multiple functions with LCEL for more dynamic applications.</p><p>🏷️ 𝗧𝗮𝗴𝗴𝗶𝗻𝗴 𝗮𝗻𝗱 𝗘𝘅𝘁𝗿𝗮𝗰𝘁𝗶𝗼𝗻: Master structuring data from unstructured text and extracting specific entities. A key reminder: always split larger documents for better processing.</p><p>🔀 𝗧𝗼𝗼𝗹𝘀 𝗮𝗻𝗱 𝗥𝗼𝘂𝘁𝗶𝗻𝗴: Integrate external tools and APIs with OpenAI functions for enhanced capabilities. Examples include weather data and Wikipedia search functionalities, along with converting OpenAPISpecs to OpenAI function formats.</p><p>🗣️ 𝗖𝗼𝗻𝘃𝗲𝗿𝘀𝗮𝘁𝗶𝗼𝗻𝗮𝗹 𝗔𝗴𝗲𝗻𝘁: A mix of LLM decision-making and coded actions leads to innovative conversational agents. Employ iterative processes and use scratchpads for context-aware interactions.</p><p>Course Link: <a href="https://learn.deeplearning.ai/functions-tools-agents-langchain/">https://learn.deeplearning.ai/functions-tools-agents-langchain/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8640bc7535fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chat with Your Data]]></title>
            <link>https://medium.com/@sbmalik/chat-with-your-data-6653d7bc91a7?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6653d7bc91a7</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Mon, 11 Dec 2023 08:05:12 GMT</pubDate>
            <atom:updated>2023-12-11T08:05:12.372Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*OukfeiPb3r2dXPB-UpzGyw.png" /></figure><p>In today’s tech industry, dominated by large language models (LLMs), a common question from recruiters is about your ability to chat with custom data. Here’s a concise summary of a comprehensive course by LangChain and <a href="https://medium.com/u/5d4101757bbb">DeepLearning.AI</a> that elegantly explains how to do just that.</p><p>📄 𝗗𝗼𝗰𝘂𝗺𝗲𝗻𝘁 𝗟𝗼𝗮𝗱𝗶𝗻𝗴: Over 80 loaders including YoutubeAudioLoader with OpenAIWhisper, WebBaseLoader, and NotionDirectoryLoader. Imagine loading content from websites, CSVs, PDFs, and even your favorite YouTube videos directly into memory!</p><p>✂️ 𝗗𝗼𝗰𝘂𝗺𝗲𝗻𝘁 𝗦𝗽𝗹𝗶𝘁𝘁𝗶𝗻𝗴: LangChain’s text_splitter allows efficient splitting of large documents into manageable chunks. Control the chunk size and overlap to tailor the splits perfectly.</p><p>🔍 𝗩𝗲𝗰𝘁𝗼𝗿𝘀𝘁𝗼𝗿𝗲𝘀 𝗮𝗻𝗱 𝗘𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴𝘀: Create and store document embeddings in a vector database, enabling semantic searches with over 30 different vector stores. Though watch out for duplication and document-specific instructions!</p><p>🔎 𝗥𝗲𝘁𝗿𝗶𝗲𝘃𝗮𝗹 𝗧𝗲𝗰𝗵𝗻𝗶𝗾𝘂𝗲𝘀: Dive into methods like MMR for document diversity, LLM-aided retrieval, Contextual Compression for crisp responses, and even Non-VectorDB-Retriever options like SVM and TFIDF.</p><p>🤖 𝗕𝘂𝗶𝗹𝗱𝗶𝗻𝗴 𝗮 𝗖𝗵𝗮𝘁𝗯𝗼𝘁: Map_reduce, refine, and map_rerank methods suit different needs. LangChain’s ConversationalBufferMemory and ConversationalRetrievalChain enable context-aware chat interactions, even showcased in a notebook UI.</p><p>Course Link: <a href="https://learn.deeplearning.ai/langchain-chat-with-your-data">https://learn.deeplearning.ai/langchain-chat-with-your-data</a></p><p>#llms #deeplearning</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6653d7bc91a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Only 3 Tips To Be Extraordinary]]></title>
            <link>https://medium.com/@sbmalik/the-only-3-tips-to-be-extraordinary-c2a984127725?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2a984127725</guid>
            <category><![CDATA[daily-life]]></category>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[self-awareness]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Wed, 19 Aug 2020 00:22:08 GMT</pubDate>
            <atom:updated>2020-08-19T00:22:08.103Z</atom:updated>
            <content:encoded><![CDATA[<p>We will look at three important things for a person to be extraordinary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bLriqGzh85a1y19hJJ0FvQ.gif" /><figcaption>Photo from <a href="https://www.gsb.stanford.edu/insights/skills-make-entrepreneurs-extraordinary">Stanford Business</a> by <a href="https://twitter.com/eilenez">Eilene</a></figcaption></figure><p>Nowadays, there is unlimited knowledge, and guides are available online. Everybody has its opinion about the rules and regulations for living a successful life. There are a lot of tutorials available that teach you “How To Become Rich in 15 Minutes?” or “How To Be Successful in 10 Minutes?” but this article is not about minutes, hours, days, or even weeks. This article is about habits and mindset, and I am sure if you add these habits in your daily routine, you will be transformed.</p><p>Either you will become successful, or not this thing will totally depend on your hard work and the choices you made in life. However, these things will help you in building the mindset of successful people regardless of their fields.</p><p>Let’s look at the only three things you need to add in your habits to be an extraordinary person.</p><h3>Believe Yourself</h3><p>The first and most important thing that will make you apart from the ordinary people is the level of self-esteem you have. In this era, there are various reasons you can lose the inner belief. There are various enemies of yourself that are hunting you to lower down your self-esteem.</p><p>They can either be the number of likes on any social media platform, or the people in your network telling you that you are useless. Never listen to them, never allow them to ruin your life as they are no ones to decide that either you are useless or useful. You may be useless right now, but the thinking of being useless forever will never let you grow.</p><p>The power of belief is the most useful superpower anyone can have. So do not lose this power; rather, use this power to be someone the world needs right now.</p><h3>Give Your 100%</h3><p>After you are able to believe yourself, you have to put everything you can for the purpose of your life. I am not telling you to buy a microscope and put your wheels on a long journey for “Finding the Purpose of Life.” The reason for your living will be visible to you at one point in life, so what will you do when you have a goal/ambition, and the man in you is not able to support your vision.</p><p>That’s why I encourage you to build a habit that can transform you into something unstoppable. I want you to keep doing what you are currently doing, but put your full efforts and devote all your attention.</p><blockquote>“Do it with passion or not at all.”</blockquote><p>Are you currently eating, stop reading this, and enjoy your meal like this is the last meal of your life. Are you talking with your partner, give him/her your full time and love. Have you come to bed to sleep, just switch your screen off and jump into the valley of your dreams. Do not try to do multi-task for any task. Multi-tasking can sometime destroy the enjoyment of a single thing.</p><h3>Work From a Calendar</h3><p>We usually as dreamers love our To-do lists, we love them so much that we are even afraid to change them. Mostly people prefer to make long-term goals, but sticking to these goals is really painful. Working on a long-term mission, and seeing yourself to progress slowly is very hard.</p><p>If you have developed the habit of putting your 100% in a task now you are ready to choose the task. Which task needs your attention most? Which task needs a priority? which task is striving for you to complete it? The answer of all these question is “the task in your calendar” (not in your to-do list).</p><p>This strategy will help you grow as an active person; it will also reduce the powers of a procrastinator in you. Try to make achievable goals, put them in your calendar, and start working them day by day. I also prefer to just make a list of today’s tasks in the morning or tomorrow’s task at night and ignore the rest. Grab your pen and a sheet of paper and make a list of those tasks, which cannot be ignored.</p><h3>Summary</h3><p>This article is about the three habits of an extraordinary person. The takeouts from this article are:</p><ul><li>First, believe in yourself — no matter how much you are currently ruined.</li><li>Build a habit of putting 100% devotions in the task you’re doing, and finally.</li><li>Pick this task from your calendar.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2a984127725" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Pandas’ DataFrame a 2D Numpy Array?]]></title>
            <link>https://medium.com/@sbmalik/is-pandas-dataframe-a-2d-numpy-array-6db8e4e36367?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6db8e4e36367</guid>
            <category><![CDATA[numpy]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[pandas-dataframe]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Tue, 18 Aug 2020 00:37:53 GMT</pubDate>
            <atom:updated>2020-08-18T00:37:53.153Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is a comparative analysis of Pandas’ DataFrame with Numpy Arrays.</p><figure><img alt="backgroun" src="https://cdn-images-1.medium.com/max/1024/1*JgzxYFiRMJ1WJZFCRFvZTQ.png" /><figcaption>Comparison of <a href="https://pandas.pydata.org/">Pandas</a> and <a href="https://numpy.org/">Numpy</a></figcaption></figure><p>Pandas and Numpy are two useful data science tools in python. Numpy, the numerical python, is a library used for fast and efficient manipulation of arrays with a lot of built-in functions. On the other hand, Pandas is used to handle the tabular (structural) data in python.</p><blockquote>If anyone wants to work in data science, Pandas and Numpy are the must-known libraries.</blockquote><h3>Why people think they are same</h3><p>Under the hood, everything in python is an object. DataFrame and Numpy arrays are also objects in python. Underlying DataFrame, the python stores the NumPy arrays in a fancy manner. So, every Numpy method is readily applicable to Pandas’ Series and DataFrame. This availability of functions makes people think that these are the same things, but this is not true. They have many notable dis-similarities that we are going to discuss in the next section.</p><h3>Notable Dissimilarities</h3><p>The Pandas’ DataFrame and Numpy arrays can be thought of as similar, but they have some dis-similarities, I like to mention the fave of them here as points.</p><ol><li>Numpy arrays can be n-dimensional, but DataFrame cannot go beyond the two dimensions.</li><li>DataFrame provides functionalities for handling the missing data.</li><li>DataFrame is similar to the SQL (a language for handling relational databases) Tables or Excel Spreadsheets.</li><li>In Numpy array, all values must have to homogenous; if not, the interpreter will convert them to have the same type. Unlike DataFrame, which have homogenous columns but can contain heterogeneous rows.</li><li>DataFrame assigns labels to both columns and rows, which Numpy doesn’t. These labels are far more advanced than indexing.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6db8e4e36367" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying the GAN using a 1D Function (Keras)]]></title>
            <link>https://medium.com/analytics-vidhya/demystifying-the-gan-using-a-1d-function-keras-bc7b861bb304?source=rss-6458082b57d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc7b861bb304</guid>
            <category><![CDATA[generative-adversarial]]></category>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[1d-gan]]></category>
            <dc:creator><![CDATA[Subtain Malik]]></dc:creator>
            <pubDate>Tue, 16 Jun 2020 15:59:18 GMT</pubDate>
            <atom:updated>2021-11-25T00:27:52.801Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>“Coolest idea in the field of deep learning in the last 20 years”.</blockquote><p>In this article, we will explore how to create a simple GAN (1DGAN) which will generate points in a plane. GANs stands for Generative Adversarial Networks, the name itself is describing it’s meaning. Let’s break this down.</p><blockquote><strong>Networks:</strong> means that a GAN is made up of multiple neural networks.</blockquote><blockquote><strong>Adversarial: </strong>means that these networks are competing with each other in an adversary manner (opposing each other).</blockquote><blockquote><strong>Generative: </strong>means they fall under the category of generative models in deep learning.</blockquote><p>GANs are used for generating beautiful images that are indistinguishable from the real world images. They do this by learning the probability distribution of images and then creating a data item in this distribution. This data item is a new image. However, understanding the functionality of GAN is a huge pain because of the high dimensionality of image data. We as humans cannot visualize the data with <strong><em>n </em></strong>dimensions. That’s why the BTS (Behind the Scenes) of GAN is a mystery. Let’s demystify it.</p><blockquote>— — — NOW ROLL YOUR SLEEVES UP — — —</blockquote><p>We will move towards the practical work and understand only that part which comes in our way. I encourage you to follow along using <a href="https://jupyter.org/"><strong><em>‘Jupyter Notebook’</em></strong></a><strong><em> </em></strong>because these code snippets are prepared on a notebook.</p><h3>Shoulders of Giants 🛠</h3><p>Start by using following imports</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8338140eeae443474192e0e051195a35/href">https://medium.com/media/8338140eeae443474192e0e051195a35/href</a></iframe><ul><li><strong>tensorflow:</strong> a deep learning library by <a href="http://www.google.com/">Google</a></li><li><strong>keras:</strong> API written on top of <a href="http://tensorflow.org/">TensorFlow</a></li><li><strong>numpy:</strong> for numerical work in python</li><li><strong>matplotlib:</strong> for drawing plots and saving images</li><li><strong>celluloid:</strong> useful for doing some animations with our results</li></ul><h3>I am The Mystery 🧰</h3><h4>1D Function</h4><p>After importing the required libraries we proceed towards the choice of 1D function. Here we are choosing the U-Shaped function which is a square function <strong><em>f(x)=x²</em></strong><em>. </em>However, you can choose any function you like.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7529a647b6d2780c81d8206de4325be/href">https://medium.com/media/b7529a647b6d2780c81d8206de4325be/href</a></iframe><p>Use this function to generate data points in a plane and plot them to see how your function looks like. Here we are using <strong>100</strong> points because it is very easy to visualize them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b44bd5c5b81c68f804a6f34f2873bf6f/href">https://medium.com/media/b44bd5c5b81c68f804a6f34f2873bf6f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*G3KSQcN1Xo_8aIYjK6RYag.png" /><figcaption><strong>Figure 1: </strong>Plot of square function</figcaption></figure><h3>COMPETITORS ARE HERE!!! ⚔️🛡</h3><p>After the confirmation of your function. Now it’s time to create deep learning models. We are following <a href="https://keras.io/examples/generative/dcgan_overriding_train_step/">official methodology for GAN </a>provided in <a href="https://keras.io/examples/">Code example</a>s of <a href="https://keras.io/">keras.</a></p><p><strong>Create Models (Discriminator and Generator):</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*ABqzJWDkqmzZSOhb_Rz66A.png" /><figcaption><strong>Figure 2:</strong> Architectures of our Models</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3d9d8dc47266a6c198fe91e1e5852fb/href">https://medium.com/media/c3d9d8dc47266a6c198fe91e1e5852fb/href</a></iframe><h3><strong>Hello Mister GAN ☎️</strong></h3><p>Now we will create a GAN model with a <strong>custom training function</strong> because the training of GAN is not like other deep learning models, those who train on <strong><em>x (data) and y (labels) </em></strong>for classification or regression of something.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30ffa4c04bb876e6d9fad90fe9ff4121/href">https://medium.com/media/30ffa4c04bb876e6d9fad90fe9ff4121/href</a></iframe><h3>Keep an Eye on Me 🧐🔍</h3><p>We have to build something which can store our results while training and that thing is known as a callback. Here we are creating a custom callback that will store results after every <strong>20</strong> epochs along with a <strong>list</strong> to store generated points. you can read about callbacks <a href="https://keras.io/api/callbacks/"><strong>here!</strong></a><strong>.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2e1df68d67378b5f2fb8fb7de5ad9db/href">https://medium.com/media/a2e1df68d67378b5f2fb8fb7de5ad9db/href</a></iframe><h3>Let the Game Begin 🎭 ▶️</h3><p>Train your GAN and plot loss results by using the following code. Note here that we are training our model for <strong>5000 </strong>epochs but his number depends on your <strong>PATIENCE. </strong>Neither our model has a lot of parameters nor our data is very big so it can run easily on your system (CPU).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b2e0f9d44b9c8a8c05e10e71010a253/href">https://medium.com/media/4b2e0f9d44b9c8a8c05e10e71010a253/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*JN_0RkCEF7uyobARc0DXoA.png" /><figcaption><strong>Figure 3: </strong>Loss w.r.t Epochs</figcaption></figure><h3>Show Us Magic 🎊</h3><p>Finally, we are ready to see the power of our generator to generate the points in the above <strong>function</strong> (which was calling itself a mystery 🙄). The following code will animate the generated points stored in the list.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc98e5e4e35bef72363b2f02af419737/href">https://medium.com/media/dc98e5e4e35bef72363b2f02af419737/href</a></iframe><p>Here are some results you can see how powerful our generator becomes after training. It is just mapping the points to original data distribution. Generator learns this without seeing original points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*JF4__I3dXlgHt4Ww1Uhu2Q.gif" /><figcaption><strong>Figure 4: </strong>Results</figcaption></figure><p><strong>Congratulation! </strong>we just built and train our 1D-GAN. I hope now you understand the basics behind the scene of GAN and ready to explore it further. Best of luck with your journey.</p><h3><strong>References:</strong></h3><ul><li><a href="https://machinelearningmastery.com/how-to-develop-a-generative-adversarial-network-for-a-1-dimensional-function-from-scratch-in-keras/">How to Develop a 1D Generative Adversarial Network From Scratch in Keras - Machine Learning Mastery</a></li><li><a href="https://keras.io/examples/generative/dcgan_overriding_train_step/">Keras documentation: GAN overriding `Model.train_step`</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc7b861bb304" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/demystifying-the-gan-using-a-1d-function-keras-bc7b861bb304">Demystifying the GAN using a 1D Function (Keras)</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>