<?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 Swetha Vimalathithan on Medium]]></title>
        <description><![CDATA[Stories by Swetha Vimalathithan on Medium]]></description>
        <link>https://medium.com/@vimalathithanswetha?source=rss-9ab6a159f95b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*v2p4nqp9HP8mpIslnR102A@2x.jpeg</url>
            <title>Stories by Swetha Vimalathithan on Medium</title>
            <link>https://medium.com/@vimalathithanswetha?source=rss-9ab6a159f95b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 00:06:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vimalathithanswetha/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[Understanding Deep Agents]]></title>
            <link>https://medium.com/@vimalathithanswetha/understanding-deep-agents-d4ffa480625e?source=rss-9ab6a159f95b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4ffa480625e</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Swetha Vimalathithan]]></dc:creator>
            <pubDate>Wed, 07 Jan 2026 16:00:17 GMT</pubDate>
            <atom:updated>2026-01-07T16:00:17.778Z</atom:updated>
            <content:encoded><![CDATA[<p>When most people think of an AI agent, they picture a simple, repetitive process: a Large Language Model (LLM) calling tools in a loop. This common architecture, often called a “shallow” agent, is great for simple tasks but quickly breaks down when faced with real-world complexity. It struggles to plan over long time horizons, manage large amounts of context from tool outputs, or execute complex, multi-step projects.</p><p>To overcome these limitations, a more powerful paradigm has emerged: the “deep agent.” These agents are designed from the ground up to handle long-running tasks, reason about complex plans, and intelligently manage their memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pYAuBnZ01W1fiuHPUX8OVA.png" /></figure><p><strong>1. What Are “Shallow Agents”?</strong></p><p>A “shallow agent” is an agent that operates in a simple, direct loop. It takes a query, calls a tool if necessary, and generates an output without engaging in complex planning or reasoning.</p><p>The two most common shallow architectures are:</p><p>• <strong>The Basic Agent:</strong> The LLM receives an input, calls a single tool once, and then generates a final output. The process is linear and does not loop.</p><p>• <strong>The ReAct Agent:</strong> This is a more advanced shallow agent that can loop. The LLM can <strong>reason</strong> about a task, choose a tool to <strong>act</strong>, observe the result, and then repeat the cycle. While it can handle more steps, it still lacks an explicit, structured planning mechanism.</p><p>These simple architectures, while useful, have significant weaknesses when faced with complex problems, which necessitates a more sophisticated architecture.</p><p>Limitations of Shallow Agents:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*HBzMiEq9pJSDVzb3h_kmoA.png" /></figure><p><strong>2. The Anatomy of a “Deep Agent”</strong></p><p>A deep agent is best understood as an “agent harness.” It uses the same core tool-calling loop as a shallow agent but enhances it with a set of built-in capabilities that enable more complex and robust work. This architecture emerged from observing successful patterns in advanced applications like Claude Code and Deep Research, which all independently developed similar solutions to overcome the limitations of simple loops.</p><p>Think of it like the difference between a bare engine (the LLM) and a complete car. The harness adds the chassis, steering, and dashboard (planning, memory, delegation) needed to undertake a real journey.</p><p>The four core characteristics that differentiate deep agents from shallow ones are:</p><p>• A detailed system prompt</p><p>• A planning tool</p><p>• A file system</p><p>• Sub-agents</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DXmVFZC4JvAjxGi_.png" /></figure><p>Let’s explore each of these four pillars to understand how they work together to create a more capable agent.</p><p><strong>3. The Four Pillars of a Deep Agent</strong></p><p>3.1. Pillar 1: The Detailed System Prompt</p><p>The system prompt in a deep agent is not just a simple instruction but a comprehensive manual for the agent’s behavior. Inspired by applications like Claude Code, these prompts are long and contain detailed instructions on how to use tools, how to behave in certain situations, and even examples of desired actions. This provides the agent with a robust strategic framework, directly addressing the lack of a strategic approach seen in simpler agents.</p><p>A detailed system prompt provides the foundational strategy and rules the agent needs to tackle complex tasks effectively.</p><p>3.2. Pillar 2: The Planning Tool</p><p>Deep agents are equipped with a planning tool, often named write_todos, which allows the agent to create and track a to-do list for a given task. As noted in the analysis of applications like Claude Code, this tool is often a &quot;no-op,&quot; meaning it doesn&#39;t perform an external action.</p><p>Its true function is as a context engineering strategy. It forces the agent to stop and think, breaking down a complex problem into a structured, step-by-step plan. The detailed system prompt (Pillar 1) is what instructs the agent how and when to use this tool, creating a symbiotic relationship between strategy and execution. This directly counteracts the “No Explicit Planning” limitation of shallow agents, which often get lost in multi-step tasks.</p><p>The planning tool enables agents to decompose complex tasks into manageable steps, creating a structured plan before execution.</p><p>3.3. Pillar 3: The File System for Memory</p><p>A primary challenge for agents is context window saturation. Tools like a web search can return thousands of tokens of text, quickly filling up the agent’s limited short-term memory. This is a primary cause of the “Limited Context Retention” weakness in shallow agents.</p><p>A file system solves this by giving the agent a persistent workspace to offload information. Instead of holding large tool outputs in its immediate context, the agent can write them to a file and read them back as needed. The core file system tools include ls (list files), read_file, write_file, edit_file, glob (find files matching patterns), and grep (search file contents).</p><p>3.4. Pillar 4: Sub-agents for Delegation</p><p>Sub-agents provide a mechanism for delegation that solves the context bloat problem by enabling a strategy called “context isolation” or “context quarantine.” When a main agent performs a complex, multi-step task, its context window becomes cluttered with intermediate tool calls and results. This pillar directly solves that issue.</p><p>The main agent uses a task tool to spawn a specialized, ephemeral sub-agent. This sub-agent performs the deep work in its own isolated context and returns only a single, concise final report to the main agent.</p><p>Key benefits of this approach include:</p><p>• Context Isolation: The main agent’s context window remains clean and focused on high-level coordination, as it doesn’t see the sub-agent’s intermediate steps.</p><p>• Specialization: Sub-agents can be configured with different tools, prompts, or even different LLM models tailored to a specific job (e.g., a “code-reviewer” or “web-researcher”).</p><p>• Token Efficiency: A large, multi-step task that might consume thousands of tokens is compressed into a single, concise result for the main agent.</p><p>Sub-agents allow a main agent to act as a high-level coordinator, delegating deep work to specialists without getting bogged down in the details.</p><p><strong>4. Conclusion</strong></p><p>Deep agents are not a fundamentally different algorithm but rather a more powerful and thoughtful architecture. The core is still an LLM in a loop calling tools. However, by building an “agent harness” that combines a detailed strategic prompt, a tool for explicit planning, a file system for robust memory management, and sub-agents for delegation, they can successfully plan and execute complex, long-running tasks that are far beyond the reach of their simpler, “shallow” counterparts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4ffa480625e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PandasAI: A Step Towards Smarter Data Analysis]]></title>
            <link>https://medium.com/@vimalathithanswetha/pandasai-a-step-towards-smarter-data-analysis-dea434419650?source=rss-9ab6a159f95b------2</link>
            <guid isPermaLink="false">https://medium.com/p/dea434419650</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Swetha Vimalathithan]]></dc:creator>
            <pubDate>Sun, 01 Sep 2024 17:42:47 GMT</pubDate>
            <atom:updated>2024-09-01T17:42:47.683Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJz7jfNm2eS6Fy0ebG7mhQ.png" /></figure><h3>What is PandasAI?</h3><p>Data analysis has always been at the heart of decision-making in businesses and research. While libraries like pandas have significantly streamlined the process of data manipulation and analysis in Python, there is a growing need for more intuitive and intelligent data interaction methods. Enter <strong>PandasAI</strong> — a revolutionary new tool that brings artificial intelligence into the realm of pandas.</p><p>PandasAI is an innovative library designed to integrate AI capabilities directly into your dataframes. Built to work seamlessly with the widely used pandas library, PandasAI allows users to perform complex data operations using natural language queries. This is a game-changer for data analysts, enabling them to bypass traditional coding and leverage conversational AI to interact with their data.</p><h3>Why PandasAI?</h3><p>Traditional data analysis with pandas requires a good understanding of Python programming, data structures, and the specific methods available in the pandas library. While powerful, this approach can be a barrier to entry for non-programmers and can sometimes be time-consuming, even for seasoned analysts.</p><p>PandasAI simplifies this process by integrating with Large Language Models (LLMs) like OpenAI’s GPT or BambooLLM, allowing users to query their dataframes using plain English.</p><h3>Features</h3><ul><li>Natural language querying: Ask questions to your data in natural language.</li><li>Data visualization: Generate graphs and charts to visualize your data.</li><li>Data cleansing: Cleanse datasets by addressing missing values.</li><li>Feature generation: Enhance data quality through feature generation.</li><li>Data connectors: Connect to various data sources like CSV, XLSX, PostgreSQL, MySQL, BigQuery, Databrick, Snowflake, etc.</li></ul><h3>Getting Started with PandasAI</h3><p>Getting started with PandasAI is straightforward. After installing the library and setting up your BambooLLM API key at <a href="https://pandabi.ai/">https://pandabi.ai</a>, you can start performing AI-driven data analysis with just a few lines of code.</p><p>You can opt to use OpenAI, HuggingFace, Cohere or any other model API here.</p><pre>import os<br>import pandas as pd<br>from pandasai import Agent<br><br># Load your dataset<br>df = pd.DataFrame({<br>    &quot;country&quot;: [&quot;United States&quot;, &quot;United Kingdom&quot;, &quot;France&quot;, &quot;Germany&quot;, &quot;Italy&quot;],<br>    &quot;sales&quot;: [5000, 3200, 2900, 4100, 2300]<br>})<br><br># Initialize PandasAI Agent<br>os.environ[&quot;PANDASAI_API_KEY&quot;] = &quot;YOUR_API_KEY&quot;<br>agent = Agent(df)<br><br># Perform a natural language query<br>response = agent.chat(&quot;Which are the top 3 countries by sales?&quot;)<br>print(response)</pre><h3>Creating an application with PandasAI</h3><p>I’ve created a demo web app using Streamlit, ydata-profiling and PandasAI. The app will allow users to upload Excel or csv files, generate insights and chat with the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MtBAHHws_2XZKFC5gpNQnQ.png" /></figure><h3>What is ydata-profiling?</h3><p><strong>ydata-profiling</strong> (formerly known as <strong>pandas-profiling</strong>) is a Python library used to generate comprehensive exploratory data analysis (EDA) reports from a DataFrame.</p><p>It is so <strong>simple to use</strong> — a single line of code is what you need to get you started.</p><pre>import pandas as pd<br>from ydata_profiling import ProfileReport<br><br>df = pd.read_csv(&#39;data.csv&#39;)<br>profile = ProfileReport(df, title=&quot;Profiling Report&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XuHF7qH6-fFCs2UOrhXOLQ.gif" /><figcaption>EDA report generated by ydata-profiling</figcaption></figure><h4>1. Setting Up the API Key</h4><p>When users first visit the application, they are prompted to enter their BambooLLM API Key. This is managed through a sidebar form. This allows users to submit their API Key, which is then stored securely in the session state for use in data analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*mA-aUjdfIqVAHuiyg6WN6w.png" /></figure><p>Here’s how the sidebar is implemented:</p><pre>def sidebar_api_key_form():<br>    st.sidebar.header(&quot;API Key Setup&quot;)<br>    if &#39;api_key&#39; not in st.session_state:<br>        st.session_state.api_key = None<br><br>    with st.sidebar.form(key=&#39;api_key_form&#39;):<br>        st.session_state.api_key = st.text_input(&quot;Enter your BambooLLM API Key&quot;, type=&quot;password&quot;)<br>        submit_button = st.form_submit_button(&quot;Submit API Key&quot;)<br>        <br>        if submit_button:<br>            if st.session_state.api_key:<br>                os.environ[&quot;PANDASAI_API_KEY&quot;] = st.session_state.api_key<br>                st.sidebar.success(&quot;API Key set successfully!&quot;)<br>            else:<br>                st.sidebar.error(&quot;Please enter an API Key.&quot;)</pre><h4>2. Uploading Files</h4><p>Users can upload Excel or CSV files through a streamlit file uploader widget. Once a file is uploaded, it’s processed, and the data is prepared for analysis. Here’s the file upload section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*nmvxBsahWqoRirfdoWAFaw.png" /></figure><pre>def handle_file_upload(uploaded_file):<br>    st.session_state.uploaded_file = uploaded_file<br>    st.session_state.df = pd.read_csv(uploaded_file) if uploaded_file.name.endswith(&#39;.csv&#39;) else pd.read_excel(uploaded_file)<br>    st.session_state.agent = Agent(st.session_state.df)<br>    st.session_state.file_uploaded = True<br>    st.success(&quot;File uploaded successfully! You can now generate a report or chat with the data.&quot;)<br><br>uploaded_file = st.file_uploader(&quot;Upload your Excel or CSV file&quot;, type=[&quot;xlsx&quot;, &quot;csv&quot;], key=&quot;file_uploader&quot;)<br><br>if st.button(&quot;Upload File&quot;, help=&quot;Click to upload the file&quot;):<br>    if uploaded_file is not None:<br>        handle_file_upload(uploaded_file)<br>    else:<br>        st.write(&quot;Please upload a file.&quot;)</pre><h4>3. Generating Reports</h4><p>After uploading the file, users can choose to generate a data profiling report. The report is generated using YData Profiling, which provides a detailed analysis of the data. The report can also be downloaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*OXw4yyrr6Bk2ZwCsTqSwEA.png" /></figure><pre>def generate_profiling_report():<br>    try:<br>        df = st.session_state.df<br>        profile = ProfileReport(df, title=&quot;EDA Report&quot;, explorative=True)<br>        report_file = &quot;profiling_report.html&quot;<br>        profile.to_file(report_file)<br><br>        st.markdown(get_download_link(report_file), unsafe_allow_html=True)<br><br>        with open(report_file, &quot;r&quot;) as f:<br>            report_html = f.read()<br><br>        st.components.v1.html(report_html, height=800, scrolling=True)<br>        os.remove(report_file)<br><br>    except Exception as e:<br>        st.error(f&quot;Error generating report: {e}&quot;)<br><br>if st.session_state.get(&#39;file_uploaded&#39;, False):<br>    if st.button(&quot;Generate Report&quot;, help=&quot;Click to generate a report for the uploaded dataset.&quot;, use_container_width=True):<br>        with st.spinner(&quot;Generating report...&quot;):<br>            generate_profiling_report()</pre><h4>4. Interacting with Data</h4><p>The application includes a chat interface where users can ask questions about the data. The responses are generated using BambooLLM, and users can interactively ask questions and get answers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*q8svKVwIidQ-u6tgeEGrbw.png" /></figure><pre>st.subheader(&quot;Ask your question:&quot;)<br>user_input = st.text_input(&quot;Type your question here:&quot;)<br><br>if st.button(&quot;Submit Question&quot;):<br>    if user_input:<br>        with st.spinner(&quot;Generating response...&quot;):<br>            response = st.session_state.agent.chat(user_input)<br>            st.write(f&quot;**Question:** {user_input}&quot;)<br>            st.write(f&quot;**Answer:** {response}&quot;)<br>    else:<br>        st.write(&quot;Please enter a question.&quot;)</pre><p><strong>And that’s it! </strong>— PandasAI represents a transformative tool for data analysis, bridging the gap between traditional data manipulation and advanced AI-driven insights.</p><p><strong>Thanks a lot for reading!</strong></p><p>Github repo: <a href="https://github.com/swethavimalathithan/AI-Data-Analyst">https://github.com/swethavimalathithan/AI-Data-Analyst</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dea434419650" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MobiLlama: A Small Language Model with Big Potential]]></title>
            <link>https://medium.com/@vimalathithanswetha/mobillama-a-small-language-model-with-big-potential-2de2399cb862?source=rss-9ab6a159f95b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2de2399cb862</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[mls]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Swetha Vimalathithan]]></dc:creator>
            <pubDate>Mon, 04 Mar 2024 18:55:58 GMT</pubDate>
            <atom:updated>2024-03-04T18:55:58.272Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQLsveNINmGva2874kAYjQ.jpeg" /></figure><p>In the realm of Artificial Intelligence (AI), size often equates to power. Think of massive language models like GPT4 and Gemini, capable of complex tasks but requiring significant resources and raising privacy concerns. But what if I told you a tiny newcomer is challenging the status quo, offering a glimpse into a future where <strong>big things come in small packages</strong>? Enter <strong>MobiLlama</strong>, a <strong>Small Language Model (SLM)</strong> that’s making waves not for its size, but for its <strong>potential to revolutionize the way we interact with technology</strong>.</p><p><strong>So, what exactly are SLMs?</strong> Unlike their larger LLM counterparts, these <strong>compact and efficient models</strong> are designed to operate directly on <strong>edge devices</strong> like smartphones, wearables, and even smart home gadgets. SLMs are built with <strong>fewer parameters</strong>, making them <strong>smaller in size and requiring less computational power</strong>. This allows them to operate directly on devices with limited resources, offering several advantages:</p><ul><li><strong>Enhanced Privacy:</strong> By processing data on the device itself, SLMs minimize the need for data transmission to remote servers, potentially offering greater privacy compared to cloud-based AI models.</li><li><strong>Improved Accessibility:</strong> SLMs can function offline, empowering users in areas with limited or unreliable internet connectivity to access powerful AI tools, bridging the digital divide.</li><li><strong>Faster Response Times:</strong> Local processing translates to quicker response times, leading to a smoother and more efficient user experience.</li></ul><p>MobiLlama is an open-source 0.5 billion (0.5B) parameter SLM, catering to the specific needs of resource-constrained computing with an emphasis on enhanced performance with reduced resource demands. It is a SLM design that initiates from a larger model and applies a careful parameter sharing scheme to reduce both the pre-training and the deployment cost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UJfmQjFVOL8C_EVSnu7PEg.gif" /></figure><p>MobiLlama is more than just a model; it’s a game-changer. In a world obsessed with bigger AI models, MobiLlama proves that smaller, efficient systems can be just as innovative. By being open-source and prioritizing transparency, MobiLlama bridges the gap in available tools for researchers and developers. This paves the way for a future where AI applications are judged by their capabilities, not their size.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2de2399cb862" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ollama: Unleash the Power of Large Language Models on Your Local Machine]]></title>
            <link>https://medium.com/@vimalathithanswetha/ollama-unleash-the-power-of-large-language-models-on-your-local-machine-df8907e13580?source=rss-9ab6a159f95b------2</link>
            <guid isPermaLink="false">https://medium.com/p/df8907e13580</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Swetha Vimalathithan]]></dc:creator>
            <pubDate>Sat, 02 Mar 2024 15:31:00 GMT</pubDate>
            <atom:updated>2024-03-02T15:31:00.007Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y9SSSndILwrO3Dm4" /><figcaption>Photo by <a href="https://unsplash.com/@ronwhitaker?utm_source=medium&amp;utm_medium=referral">Ron Whitaker</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Large language models (LLMs) have become a game-changer, capable of generating human-quality text, translating languages, and writing different kinds of creative content. However, their traditional use required access to powerful cloud resources, keeping them out of reach for many individuals.</p><p>Ollama, an open-source framework, shatters this barrier by allowing you to run these powerful models directly on your local machine. This opens up a world of possibilities, empowering you to:</p><ul><li><strong>Boost creativity:</strong> Generate ideas, brainstorm content, write different creative formats like poems or scripts, and even translate existing content. Struggling for a catchy headline or an engaging opening? Ollama can help you overcome writer’s block and spark new inspiration.</li><li><strong>Enhance writing quality:</strong> Fact-check information, ensure factual accuracy, rephrase sentences for improved clarity, and generate alternative phrasings to make your writing flow more smoothly. Ollama can be your personal editor, helping you refine your work and polish your writing style.</li><li><strong>Automate tasks:</strong> Tired of summarizing long articles or creating outlines? Ollama can handle these repetitive tasks for you, freeing up your time to focus on more creative aspects of your work. Additionally, you can generate different versions of your content tailored for specific audiences, streamlining your content creation process.</li></ul><p><strong>Getting started with Ollama:</strong></p><p><strong>1. Installation:</strong></p><p>Ollama requires Python and a few additional libraries. The official documentation <a href="https://github.com/ollama/ollama">https://github.com/ollama/ollama</a> provides detailed installation instructions, guiding you through the setup process.</p><p><strong>2. Choosing your model:</strong></p><p>Ollama offers a library of pre-trained models, each with different capabilities and strengths. The popular Llama-2 model is a good starting point, but exploring the available options on the Ollama website <a href="https://github.com/ollama/ollama">https://github.com/ollama/ollama</a> allows you to find the model best suited for your specific needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*WHkLmPUI4B25RgOjZ_9h4A.png" /></figure><p>Let’s explore how to use Ollama in interactive mode:</p><ul><li><strong>Download a model:</strong> Open your terminal and type the following command, replacing &lt;model_name&gt; with the name of the model you want to download (e.g., llama2):</li></ul><pre>ollama pull &lt;model_name&gt;</pre><ul><li><strong>Run the model:</strong> Once downloaded, use this command to start a conversation with the LLM:</li></ul><pre>ollama run &lt;model_name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CkNk_XgyoaYsFiSDB73plA.png" /><figcaption>llama2 on windows with ollama</figcaption></figure><ul><li><strong>Interact with the LLM:</strong> You can now type prompts and receive responses from the model. For example, try typing “Write a poem about a cat.” The LLM will generate a creative text response based on your prompt.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*04sQjILHJJnQrN06uoxw5g.png" /></figure><p>Ollama, besides its interactive mode, also offers programmatic interaction through code integration, allowing you to directly send prompts to LLMs and receive responses within your code. Here’s an overview of code integration with Ollama:</p><p><strong>Requirements:</strong></p><ul><li><strong>Python:</strong> Ollama’s code integration relies on Python. Make sure you have Python 3.7 or later installed on your system.</li><li><strong>Ollama Library:</strong> You’ll need the Ollama library installed. This can be done using pip install ollama.</li></ul><p><strong>Basic Integration:</strong></p><pre>import ollama<br>response = ollama.chat(model=&#39;llama2&#39;, messages=[<br>  {<br>    &#39;role&#39;: &#39;user&#39;,<br>    &#39;content&#39;: &#39;Why is the sky blue?&#39;,<br>  },<br>])<br>print(response[&#39;message&#39;][&#39;content&#39;])</pre><p><strong>Advantages:</strong></p><ul><li><strong>Accessibility:</strong> Ollama removes the barrier of entry for individuals who may not have access to expensive cloud resources or the technical expertise required to use cloud-based LLMs. This opens doors for exploration and experimentation with LLMs for a broader audience.</li><li><strong>Customization:</strong> Ollama allows you to choose from a variety of pre-trained models or even fine-tune them for specific tasks. This level of customization empowers users to tailor the LLM’s capabilities to their unique needs and preferences.</li><li><strong>Control:</strong> With local execution, you have complete control over the LLM’s operation. This means you can adjust settings, experiment with different configurations, and fine-tune the model’s behavior to your liking.</li></ul><p><strong>Disadvantages:</strong></p><ul><li><strong>Computational Requirements:</strong> While Ollama allows local LLM usage, these models still require significant computational resources, especially for larger and more complex models. This can be a limiting factor for users with limited hardware capabilities, potentially leading to performance issues like slow response times or even model crashes.</li><li><strong>Limited Functionality:</strong> Compared to cloud-based LLM solutions, Ollama might offer a more limited set of features and functionalities. This is because local machines typically have fewer resources available compared to powerful cloud servers.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df8907e13580" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>