<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Julia Zhou</title>
    <description>The latest articles on DEV Community by Julia Zhou (@jjuliazhou).</description>
    <link>https://dev.to/jjuliazhou</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1768232%2Ffeb2179b-f9cb-4c73-ba74-a5ff0f1dbf44.jpg</url>
      <title>DEV Community: Julia Zhou</title>
      <link>https://dev.to/jjuliazhou</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jjuliazhou"/>
    <language>en</language>
    <item>
      <title>Integrating Microsoft Foundry Local into LLMWare Model HQ</title>
      <dc:creator>Julia Zhou</dc:creator>
      <pubDate>Fri, 07 Aug 2026 18:01:39 +0000</pubDate>
      <link>https://dev.to/llmware/integrating-microsoft-foundry-local-into-llmware-model-hq-ahe</link>
      <guid>https://dev.to/llmware/integrating-microsoft-foundry-local-into-llmware-model-hq-ahe</guid>
      <description>&lt;p&gt;&lt;strong&gt;Model HQ by &lt;a href="https://llmware.ai/" rel="noopener noreferrer"&gt;LLMWARE&lt;/a&gt;&lt;/strong&gt; runs powerful AI Agent workflows on your device or private infrastructure with 250+ models, no cloud dependency, no token costs, and no coding required.&lt;/p&gt;

&lt;p&gt;For a more detailed overview, check out LLMWare's blog post introducing Model HQ.  &lt;/p&gt;


&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/llmware/how-to-run-ai-models-privately-on-your-ai-pc-with-model-hq-no-cloud-no-code-3o9k" class="crayons-story__hidden-navigation-link"&gt;How to Run AI Models Privately on Your AI PC with Model HQ; No Cloud, No&amp;nbsp;Code&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;
          &lt;a class="crayons-logo crayons-logo--l" href="/llmware"&gt;
            &lt;img alt="LLMWare logo" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F8208%2F4bf5768d-460d-460b-9ccc-a80499ca040e.png" class="crayons-logo__image" width="430" height="435"&gt;
          &lt;/a&gt;

          &lt;a href="/rohan_sharma" class="crayons-avatar  crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1936949%2Fa1fd5434-8c99-4531-9491-2d117d2e6996.jpg" alt="rohan_sharma profile" class="crayons-avatar__image" width="800" height="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/rohan_sharma" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Rohan Sharma
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Rohan Sharma
                &lt;a href="/++"&gt;&lt;img alt="Subscriber" class="subscription-icon" src="https://assets.dev.to/assets/subscription-icon-805dfa7ac7dd660f07ed8d654877270825b07a92a03841aa99a1093bd00431b2.png" width="166" height="102"&gt;&lt;/a&gt;
              
              &lt;div id="story-author-preview-content-2629400" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/rohan_sharma" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1936949%2Fa1fd5434-8c99-4531-9491-2d117d2e6996.jpg" class="crayons-avatar__image" alt="" width="800" height="800"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Rohan Sharma&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

            &lt;span&gt;
              &lt;span class="crayons-story__tertiary fw-normal"&gt; for &lt;/span&gt;&lt;a href="/llmware" class="crayons-story__secondary fw-medium"&gt;LLMWare&lt;/a&gt;
            &lt;/span&gt;
          &lt;/div&gt;
          &lt;a href="https://dev.to/llmware/how-to-run-ai-models-privately-on-your-ai-pc-with-model-hq-no-cloud-no-code-3o9k" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jun 27 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/llmware/how-to-run-ai-models-privately-on-your-ai-pc-with-model-hq-no-cloud-no-code-3o9k" id="article-link-2629400"&gt;
          How to Run AI Models Privately on Your AI PC with Model HQ; No Cloud, No&amp;nbsp;Code
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag crayons-tag--filled  " href="/t/showdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;showdev&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/ai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;ai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/security"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;security&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/nocode"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;nocode&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/llmware/how-to-run-ai-models-privately-on-your-ai-pc-with-model-hq-no-cloud-no-code-3o9k" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;80&lt;span class="hidden s:inline"&gt;&amp;nbsp;reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/llmware/how-to-run-ai-models-privately-on-your-ai-pc-with-model-hq-no-cloud-no-code-3o9k#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              19&lt;span class="hidden s:inline"&gt;&amp;nbsp;comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            5 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial crayons-icon c-btn__icon"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success crayons-icon c-btn__icon"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


&lt;p&gt;Integrating &lt;strong&gt;Microsoft Foundry Local&lt;/strong&gt; into Model HQ gives users the ability to utilize these models completely on their own computers, allowing for offline working and keeping sensitive data private. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Foundry Local is an end-to-end local AI solution for shipping applications that run entirely on the user's device. It provides an easy-to-use SDK (C#, JavaScript, Rust, and Python), a curated catalog of optimized models, and automatic hardware acceleration—all in a lightweight package.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To learn more, check out Microsoft's article on Foundry Local.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://learn.microsoft.com/en-us/azure/foundry-local/what-is-foundry-local" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fmedia%2Fopen-graph-image.png" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://learn.microsoft.com/en-us/azure/foundry-local/what-is-foundry-local" rel="noopener noreferrer" class="c-link"&gt;
            What is Foundry Local? - Foundry Local | Microsoft Learn
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Foundry Local is an end-to-end local AI solution that handles model acquisition, hardware acceleration, and inference—all shipped inside your app.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
          learn.microsoft.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  1. Installing and Integrating Model HQ
&lt;/h2&gt;

&lt;p&gt;First, download Model HQ from &lt;a href="https://llmware.ai/" rel="noopener noreferrer"&gt;&lt;u&gt;llmware.ai/checkout&lt;/u&gt;&lt;/a&gt;. We offer different versions for AMD, Apple, Intel, NVIDIA, and Qualcomm processors. &lt;/p&gt;

&lt;p&gt;After downloading Model HQ, download Foundry Local from terminal if you have not already installed it.&lt;/p&gt;

&lt;p&gt;For AMD, Intel, NVIDIA, and Qualcomm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;&lt;span class="kd"&gt;winget&lt;/span&gt; &lt;span class="kd"&gt;install&lt;/span&gt; &lt;span class="kd"&gt;Microsoft&lt;/span&gt;.FoundryLocal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Apple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;foundry-local 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Head to the "&lt;strong&gt;Integrations&lt;/strong&gt;" page. Click "Test" to try out Microsoft Foundry Local. You should see a message bar with a successful test outcome. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2bhi467m2jf8ax9v71z2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2bhi467m2jf8ax9v71z2.gif" alt="Demo 1" width="600" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the test is unsuccessful, try reinstalling Foundry Local. If the issue persists, please contact Microsoft for additional support. &lt;/p&gt;

&lt;h2&gt;
  
  
  3. Downloading models
&lt;/h2&gt;

&lt;p&gt;Head to the "&lt;strong&gt;Models&lt;/strong&gt;" page, click "&lt;strong&gt;All&lt;/strong&gt;", and you'll see a dropdown menu of models to choose from, including Foundry models. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frreg8xmal44sm2ccwms5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frreg8xmal44sm2ccwms5.png" alt="Models page" width="799" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fikh20y5vfwzcdedwm1ty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fikh20y5vfwzcdedwm1ty.png" alt="Dropdown menu pointing to Foundry models" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the desired model from the dropdown menu and click download button. The download should take a while (around 2-3 minutes depending on your internet speed).  &lt;/p&gt;

&lt;h2&gt;
  
  
  3. Testing models
&lt;/h2&gt;

&lt;p&gt;Now, we can test the downloaded model. &lt;/p&gt;

&lt;h3&gt;
  
  
  3.1 Testing Foundry Local models using Model HQ's Chatbot
&lt;/h3&gt;

&lt;p&gt;One way to do so is using our Chatbot. Head over to the "&lt;strong&gt;Chat&lt;/strong&gt;" section of Model HQ, then click "&lt;strong&gt;Model&lt;/strong&gt;" to select the Foundry model you want to test. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fctnu669diijl9v02cxqo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fctnu669diijl9v02cxqo.png" alt="Chat page" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hit the next arrow, and like before, another successful loading message box should appear. If the load was unsuccessful, try redownloading the Foundry model. &lt;/p&gt;

&lt;p&gt;As an example, I chose the &lt;code&gt;qwen2.5-1.5b-instruct-qnn-npu:2-foundry&lt;/code&gt; model and asked "Where is Paris". &lt;/p&gt;

&lt;p&gt;Here is the response I received:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv5hqx8mssysyoindxrby.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv5hqx8mssysyoindxrby.png" alt="Chatbot response" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3.2 Testing Foundry Local models using Model HQ's agents
&lt;/h3&gt;

&lt;p&gt;A second test you can perform is in the "&lt;strong&gt;Agents&lt;/strong&gt;" page of Model HQ - Agents are able to complete multi-step tasks and make decisions autonomously to accomplish a goal. &lt;/p&gt;

&lt;p&gt;I have selected the Contract Analyzer agent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa4kdcfip1r74qmphbtpe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa4kdcfip1r74qmphbtpe.png" alt="Agent page" width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click next to see a flow of multiple nodes containing contract-related questions the agent will answer. Many are &lt;strong&gt;RAG (Retrieval Augmented Generation)&lt;/strong&gt; questions, meaning the agent will retrieve information from the input document, likely a contract, to answer the question.&lt;/p&gt;

&lt;p&gt;To switch the RAG model to the one you want to test, select your chosen model from the dropdown menu labeled "RAG Model". You can also switch the Chat model the same way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqevh275rc9c5v6x3ezl0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqevh275rc9c5v6x3ezl0.png" alt="Contract Analyzer agent page" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have chosen the &lt;code&gt;phi-3-mini-4k-instruct-qnn-npu:3-foundry&lt;/code&gt; model, which is a model that runs on NPU (Neural Processing Unit). &lt;/p&gt;

&lt;p&gt;Once the model is selected, click next, then click "&lt;strong&gt;Run (Demo)&lt;/strong&gt;".&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Quick tip: &lt;/p&gt;

&lt;p&gt;For Windows users, you can view your GPU, CPU, and NPU usage as the model does its work by opening &lt;strong&gt;Task Manager&lt;/strong&gt; and heading to the &lt;strong&gt;Performance&lt;/strong&gt; tab. Since I chose a model that runs on NPU, I can see my NPU in use as the model answers the RAG questions. &lt;/p&gt;

&lt;p&gt;For Mac users, open Activity Monitor to monitor CPU and system resource usage.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is the output, along with my computer's NPU in use. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcrys5vl3vt846gr6tupr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcrys5vl3vt846gr6tupr.png" alt="Contract Analyzer answers" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;We have seen how to integrate &lt;a href="https://ai.azure.com/home" rel="noopener noreferrer"&gt;Microsoft Foundry Local&lt;/a&gt; into &lt;a href="https://llmware.ai/" rel="noopener noreferrer"&gt;LLMWare&lt;/a&gt;'s Model HQ, and we have tested these Foundry models using LLMWare's Chatbot and Contract Analyzer agent. &lt;/p&gt;

&lt;p&gt;For another example workflow on using Foundry Local models, see LLMWare's &lt;a href="https://www.qualcomm.com/developer/blog/2026/05/local-agentic-ai-with-llmware-on-pcs-with-snapdragon-x-series" rel="noopener noreferrer"&gt;Qualcomm Developers Blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="mailto:support@aibloks.com" class="crayons-btn crayons-btn--primary"&gt;Try Model HQ for Free&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;Email us with the subject line "Request for Model HQ Free Trial". &lt;/p&gt;

</description>
      <category>ai</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>news</category>
    </item>
    <item>
      <title>How I Learned Generative AI in Two Weeks (and You Can Too): Part 3 - Prompts &amp; Models</title>
      <dc:creator>Julia Zhou</dc:creator>
      <pubDate>Wed, 14 May 2025 12:05:49 +0000</pubDate>
      <link>https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-3-prompts-models-dd7</link>
      <guid>https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-3-prompts-models-dd7</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;It's been a few months since the last iteration in this series, but new year, more LLMWare Fast Start to RAG examples! In the previous articles, we covered creating libraries and transforming this information into embeddings. Now that we have done the heavy lifting, so to speak, we are ready to begin writing prompts and getting responses. This will be the focus of today's article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extra resources
&lt;/h2&gt;

&lt;p&gt;A few notes before we start! In case you missed them, I will link the previous articles in this series. This example will build upon &lt;a href="https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-1-libraries-215h"&gt;example 1&lt;/a&gt; and &lt;a href="https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-2-embeddings-2ppc"&gt;example 2&lt;/a&gt; and will assume prior understanding of these topics.  &lt;/p&gt;

&lt;p&gt;For visual learners, here is a video that works through example 3. Feel free to watch the video before following the steps in this article. Also, here is a Python Notebook that breaks down this example's code alongside the output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware/blob/cbed79d0c185ab2626a2c53fe20c262734d4e7f5/examples/Notebooks/fast_start_examples/example_3_prompts_and_models_version_1.ipynb" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Notebook for example 3: prompts and models&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/swiu4oBVfbA"&gt;
  &lt;/iframe&gt;
 &lt;/p&gt;
&lt;h2&gt;
  
  
  The code
&lt;/h2&gt;

&lt;p&gt;Now, we are ready to take a look at the example's code! This LLMWare Faststart example can be run in the same way as the previous ones, but instructions can be found in our &lt;a href="https://github.com/llmware-ai/llmware/blob/main/fast_start/README.md" rel="noopener noreferrer"&gt;README file&lt;/a&gt; if needed. Example 3 is directly copy-paste ready!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware/blob/main/fast_start/rag/example-3-prompts_and_models.py" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Code for example 3: prompts and models&lt;/a&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1 - What are prompts?
&lt;/h2&gt;

&lt;p&gt;While working through this example, I read a MIT Sloan Teaching &amp;amp; Learning Technologies article titled "Effective Prompts for AI: The Essentials". The entire article is definitely worth a read, but I wanted to share a quote that summarizes what &lt;strong&gt;prompts&lt;/strong&gt; are in the AI world. To read the whole article, check out &lt;a href="https://mitsloanedtech.mit.edu/ai/basics/effective-prompts/" rel="noopener noreferrer"&gt;this link&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Prompts are your input into the AI system to obtain specific results. In other words, prompts are conversation starters: what and how you tell something to the AI for it to respond in a way that generates useful responses for you ... It’s like having a conversation with another person, only in this case the conversation is text-based, and your interlocutor is AI.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In other words, the prompt you provide determines how the AI responds. To create the most effective prompts, use specific wording and consider providing context, including in the form of additional text paragraphs. &lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2 - Which model should I use?
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;model catalog&lt;/strong&gt; is a list of all the models LLMWare has registered. Like a dictionary, each model in the catalog is automatically linked with configuration data and implementation classes for easy use. The goal of this catalog is exactly this: ease of use. When provided with only the model's name, if it is present in the catalog, it should be able to run without any other information. &lt;/p&gt;

&lt;p&gt;The following lines of code provide lists of models included in the catalog. More information about the capabilities and performances of these models is included as comments in the Python code file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#   all generative models
llm_models = ModelCatalog().list_generative_models()

#   if you only want to see the local models
llm_local_models = ModelCatalog().list_generative_local_models()

#   to see only the open source models
llm_open_source_models = ModelCatalog().list_open_source_models()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following line of code selections a model by index. To choose a different model, simply replace the index value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;model_name = gguf_generative_models[0]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, we can choose a specific model by name. For those interested in exploring RAG through &lt;strong&gt;OpenAI&lt;/strong&gt;, all of the LLMWare examples are ready to use. In this particular example, uncomment the following lines and insert the necessary information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#   model_name = "gpt-4"
#   os.environ["USER_MANAGED_OPENAI_API_KEY"] = "&amp;lt;insert-your-openai-key&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, these examples also encourage the use of &lt;strong&gt;open-source&lt;/strong&gt;, models. These are locally deployed models that produce top-notch quality right on your laptop. The developments in regards to open-source over the past few years cannot be overstated. The future of AI is here in these small, specialized models optimized for a specific purpose. &lt;/p&gt;

&lt;p&gt;For example, the LLMWare &lt;strong&gt;Bling 1B&lt;/strong&gt; is a small, fast model fine-tuned to RAG that runs on your local machine. &lt;/p&gt;

&lt;p&gt;To learn more about LLMWare's &lt;strong&gt;Bling&lt;/strong&gt; and &lt;strong&gt;Dragon&lt;/strong&gt; models, consider visiting their &lt;a href="https://huggingface.co/models?other=llmware-rag" rel="noopener noreferrer"&gt;Hugging Face&lt;/a&gt; page!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbjR3NmsxcnR0am1jN3BxNzdoM3hqMGF1ZnU1cTZmOXF5amIxOGU1cSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FHzPtbOKyBoBFsK4hyc%2Fgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img width="50%" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbjR3NmsxcnR0am1jN3BxNzdoM3hqMGF1ZnU1cTZmOXF5amIxOGU1cSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FHzPtbOKyBoBFsK4hyc%2Fgiphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3 - Main example script
&lt;/h2&gt;

&lt;p&gt;Now, we can head to the main example script, &lt;code&gt;fast_start_prompting&lt;/code&gt;. We will follow four general steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pull sample questions&lt;/li&gt;
&lt;li&gt;Load the model&lt;/li&gt;
&lt;li&gt;Prompt the model&lt;/li&gt;
&lt;li&gt;Get results&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The sample questions (each with query, answer, and context) are found at the top of the Python file. They cover a variety of fields with a little extra emphasis on business, financial, and legal applications. However, it is always encouraged to change these questions or add to them to better suit your interests and needs! All of the questions will be pulled in through the &lt;code&gt;test_list&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;To use the model, we create a &lt;strong&gt;prompt object&lt;/strong&gt;. Prompts are what we do to a model: we use them when we have a question in context and want to pass it to the model to receive a response. This line of code loads the model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;prompter = Prompt().load_model(model_name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first time we load the model, it needs to "move" from the LLMWare Hugging Face repository to your local system, which can take a few minutes. However, once that is complete, all the work the model does will happen locally on your computer!&lt;/p&gt;

&lt;p&gt;Now, we loop through our list of questions. The key method &lt;code&gt;.prompt_main&lt;/code&gt; in the prompt class causes inference on the model. The  mandatory parameter for this method is the query. Optionally, &lt;code&gt;context&lt;/code&gt;, &lt;code&gt;prompt_name&lt;/code&gt;, and &lt;code&gt;temperature&lt;/code&gt; can also be passed in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;output = prompter.prompt_main(entries["query"],
                                      context=entries["context"],
                                      prompt_name="default_with_context",
                                      temperature=0.30)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;context&lt;/strong&gt; is a passage of information we want the model to read before answering the question. This allows us to explain what we want the model to consider in its answer, and it will answer based on the passage. &lt;/p&gt;

&lt;p&gt;The prompt catalog supports a range of &lt;strong&gt;prompt names&lt;/strong&gt;. The code uses &lt;code&gt;default_with_context&lt;/code&gt;, which tells the model to read the provided context and answer the question. &lt;/p&gt;

&lt;p&gt;Adjusting the temperature will change the results of the query. In general, a lower temperature will yield more factual responses directly relating to the context. Higher temperatures are more appropriate when we require a more creative response from the model. For RAG based applications, we set the temperature comparatively low to yield the the most consistency and quality. &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;output&lt;/code&gt; is a dictionary with two keys: &lt;code&gt;llm_response&lt;/code&gt; and &lt;code&gt;usage&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZWZ3cjk3ejJjZnd4Zzc1OGpsYTR2em5za3dyamY3cjluc2gxOHN5YyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2F8bE0EERrvXkq5S9BCa%2Fgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img width="50%" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZWZ3cjk3ejJjZnd4Zzc1OGpsYTR2em5za3dyamY3cjluc2gxOHN5YyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2F8bE0EERrvXkq5S9BCa%2Fgiphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 4 - Running the model
&lt;/h2&gt;

&lt;p&gt;Once you run the code, you will see the queries being iterated through and printed out. Each of these print-outs has an &lt;strong&gt;LLM Response&lt;/strong&gt; and a &lt;strong&gt;Gold Answer&lt;/strong&gt;. The &lt;strong&gt;LLM Response&lt;/strong&gt; is the model's response while the &lt;strong&gt;Gold Answer&lt;/strong&gt; is an "answer key" we created that the model does not see. This allows us to quickly compare the two answers and check for the model's accuracy. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;LLM Usage&lt;/strong&gt; line provides additional information about how the model formulated its response. In particular, you can see the "processing_time" for each query, which showcases the model's speed. Of course, the computer you run the models on will also cause speed to vary - the amount of RAM available is especially impactful for efficiency.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Query: What is the total amount of the invoice?
LLM Response: 22,500.00
Gold Answer: $22,500.00
LLM Usage: {'input': 209, 'output': 9, 'total': 218, 'metric': 'tokens', 'processing_time': 2.0669240951538086}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above output is a sample response. The LLM correctly responded to the query since its response matches the gold answer. &lt;/p&gt;

&lt;p&gt;We have successfully received answers to our questions! Congrats on reaching the end of this example. Here is a link to the full working code!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware/blob/cbed79d0c185ab2626a2c53fe20c262734d4e7f5/fast_start/rag/example-3-prompts_and_models.py" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;FULL CODE&lt;/a&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 5 - Further exploration
&lt;/h2&gt;

&lt;p&gt;To experiment more with this example, consider changing out the &lt;code&gt;model_name&lt;/code&gt; for other models! How does the LLMWare Bling model compare to the LLMWare Dragon model or OpenAI? Will these models generate the same response when provided the same queries and context? Once you try out these questions, let us know what you think!&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this example about prompts and models! The next example will be about &lt;strong&gt;RAG text query&lt;/strong&gt;, stay tuned for the article. &lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZHZnd2pleXYzeHYzMTdpeDZtdnoxbWp0c2h2YmVhNm0ycXUzaWU2byZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FAdX5dZF7LjigSMZZMm%2Fgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img width="50%" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZHZnd2pleXYzeHYzMTdpeDZtdnoxbWp0c2h2YmVhNm0ycXUzaWU2byZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FAdX5dZF7LjigSMZZMm%2Fgiphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  To see more ...
&lt;/h2&gt;

&lt;p&gt;Please join our LLMWare community on discord to learn more about RAG / LLMs and share your thoughts! &lt;a href="https://discord.gg/5mx42AGbHm" rel="noopener noreferrer"&gt;https://discord.gg/5mx42AGbHm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Visit LLMWare's Website&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Explore LLMWare on GitHub&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.freepik.com/free-vector/personal-computer-screen-with-old-software-windows_36102472.htm#fromView=image_search_similar&amp;amp;page=1&amp;amp;position=49&amp;amp;uuid=6524a515-1b2e-441e-8993-357233bf186d&amp;amp;query=cute+coding" rel="noopener noreferrer"&gt;Image from Freepik&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>ai</category>
      <category>learning</category>
      <category>python</category>
    </item>
    <item>
      <title>How I Learned Generative AI in Two Weeks (and You Can Too): Part 2 - Embeddings</title>
      <dc:creator>Julia Zhou</dc:creator>
      <pubDate>Fri, 11 Oct 2024 11:41:08 +0000</pubDate>
      <link>https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-2-embeddings-2ppc</link>
      <guid>https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-2-embeddings-2ppc</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;A few weeks ago, I shared my experience learning about Generative AI Libraries through LLMWare's Fast Start to RAG example 1. Today, I will continue this series by taking you through example 2. This is personally one of my favorite "lessons" in this LLMWare series, so I hope you will find it thought-provoking as well! This example will focus on &lt;strong&gt;embeddings and vectors&lt;/strong&gt;. Let us start by exploring what exactly these terms mean! &lt;/p&gt;

&lt;h2&gt;
  
  
  How do embedding models work?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Embeddings models&lt;/strong&gt; are trained on large amounts of language tokens to either predict the next token or fill in missing tokens. In either case, these models learn how to represent language! They take in large chunks of text as input and processes it through tokenization (breaking down into smaller pieces), conversion into numbers, and various layers of transformations. These steps build a representation of the input text to help formulate the output: vectors. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vectors&lt;/strong&gt; are created when the input text is translated into the language through which the model sees the world. Geometrically speaking, they are n-dimensional shapes where "n" is the number of embedding dimensions (typically, n is 768). The dimensions are represented by n floats, usually ranging between 0 and 1 or -1 and 1. Converting the text to numbers allows the model to more easily compare the similarity of two texts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/i1xNYj8xdUmR7z3CrH/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img width="480" src="https://i.giphy.com/media/i1xNYj8xdUmR7z3CrH/giphy.gif" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try thinking back to high school geometry! You might remember that two points (or shapes) that are close to each other are considered more similar to one another than two far away points. This process is exactly what the model performs to compare texts and is known as a &lt;strong&gt;semantic search&lt;/strong&gt;. Once a query is converted to a vector, that vector is compared to all the other vectors in the database. The ones that are the most similar are returned. &lt;/p&gt;

&lt;p&gt;Now, we are ready to take a look at the example's code! This LLMWare Faststart example can be run in the same way as example 1, but instructions can be found in our &lt;a href="https://github.com/llmware-ai/llmware/blob/main/fast_start/README.md" rel="noopener noreferrer"&gt;README file&lt;/a&gt; if needed. Example 2 is directly copy-paste ready!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware/blob/main/fast_start/rag/example-2-build_embeddings.py" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Example 2: Embeddings&lt;/a&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Extra resources
&lt;/h2&gt;

&lt;p&gt;In case you missed it, I will link my previous article in this series since this example will continue building on the foundation we built in example 1. The same process for creating libraries is utilized in example 2, so I will skip over it here. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-1-libraries-215h" class="crayons-btn crayons-btn--primary"&gt;Article - Example 1: Libraries&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;For visual learners, here is a video that works through example 2. Feel free to watch the video before following the steps in this article. Also, here is a Python Notebook that breaks down this example's code alongside the output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware/blob/main/examples/Notebooks/fast_start_examples/example_2_build_embeddings_version_1.ipynb" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Example 2 Notebook&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/2xDefZ4oBOM"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1 - Creating embeddings &amp;amp; storing vectors
&lt;/h2&gt;

&lt;p&gt;As mentioned above, we will not cover the library building process in this article and will move directly into embedding models. For this demo, we will use the "mini-lm-sbert" model, which is efficient and is included in the default LLMWare package. Feel free to experiment with different models, including the OpenAI Text Embedding Ada!&lt;/p&gt;

&lt;p&gt;Recall that in example 1, we not only created our library but also added our documents into a database. This database will make it extremely convenient to access test chunks that we can give to the embedding model. &lt;/p&gt;

&lt;p&gt;Once the library has been created, let us focus our attention on the most important line of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;library.install_new_embedding(embedding_model_name=embedding_model, vector_db=vector_db,batch_size=100)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This line calls the &lt;code&gt;install_new_embedding&lt;/code&gt; function and passes in the embedding model and vector names as parameters. The final parameter &lt;code&gt;batch_size&lt;/code&gt; determines how many text chunks will be processed at a time. Considerations like efficiency, memory, model capability, and database size all factor into choosing the most appropriate batch size. &lt;/p&gt;

&lt;p&gt;We can confirm that our embedding creation and vector storage was a success!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;update = Status().get_embedding_status(library_name, embedding_model)
print("update: Embeddings Complete - Status() check at end of embedding - ", update)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Part 2 - Queries
&lt;/h2&gt;

&lt;p&gt;Now that we have the vector database, we can begin running queries on it! We will begin by creating a very simple query before passing it into the library and running a &lt;strong&gt;semantic query model&lt;/strong&gt; on it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sample_query = "incentive compensation"
query_results = Query(library).semantic_query(sample_query, result_count=20)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will use the following portion of code to iterate through the query results to view them, and we will especially look at the &lt;code&gt;distance&lt;/code&gt; parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for i, entries in enumerate(query_results):
  text = entries["text"]
  document_source = entries["file_source"]
  page_num = entries["page_num"]
  vector_distance = entries["distance"]

  if len(text) &amp;gt; 125: text = text[0:125] + " ... "

  print("\nupdate: query results - {} - document - {} - page num - {} distance - {} ".format(i, document_source, page_num, vector_distance))

  print("update: text sample - ", text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us run the example to see the results in action!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/nFLW7PNGgN3lI68rdv/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img width="480" src="https://i.giphy.com/media/nFLW7PNGgN3lI68rdv/giphy.gif" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3 - The results
&lt;/h2&gt;

&lt;p&gt;Through the output, we can see that at first, we have no embeddings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;embedding record - before embedding  [{'embedding_status': 'no', 'embedding_model': 'none', 'embedding_db': 'none', 'embedded_blocks': 0, 'embedding_dims': 0, 'time_stamp': 'NA'}]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, there are a series of outputs showing that we are creating embeddings in batches of 100, as expected. By the end, all of the text chunks will be converted to vectors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;update: Embeddings Complete - Status() check at end of embedding -  [{'_id': 2, 'key': 'example2_library_embedding_mini-lm-sbert', 'summary': '2211 of 2211 blocks', 'start_time': '1717690179.087806', 'end_time': '1717690199.5373614', 'total': 2211, 'current': 2211, 'units': 'blocks'}]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we have arrived back at the query result for-loop mentioned above. Looking at the first result, we can see that one, among many, of the outputted metadata points is distance. This distance value can be considered the distance between the vector for our query ("incentive compensation") and the vector for this sample block.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;update: query results - 0 - document - Artemis Poseidon EXECUTIVE EMPLOYMENT AGREEMENT.pdf - page num - 4 distance - 0.24837934970855713 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query results are sorted from lowest to highest distance - that is, from most to least similar. For comparison, we can see that the tenth query result returned has a higher distance than the first one!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;update: query results - 10 - document - Eileithyia EXECUTIVE EMPLOYMENT AGREEMENT.pdf - page num - 3 distance - 0.27305811643600464 
update: text sample -  in Employer's annual cash incentive   bonus plan (the “Plan”), based on the same terms and conditions as in existence for oth ... 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Part 4 - Further exploration
&lt;/h2&gt;

&lt;p&gt;For this example, we used the "faiss" vector database, but I encourage you to experiment with others as well. &lt;/p&gt;

&lt;p&gt;Similarly, try using different embedding models to see how their  characteristics might be optimized for certain types of inputs! A series of examples involving embeddings can be found on the LLMWare Github page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware%20ai/llmware/tree/main/examples/Embedding" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Embeddings Examples&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this example about embeddings and vectors! The next example will be about &lt;strong&gt;prompts and models&lt;/strong&gt;, stay tuned for the article. &lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

&lt;h2&gt;
  
  
  To see more ...
&lt;/h2&gt;

&lt;p&gt;Please join our LLMWare community on discord to learn more about RAG and LLMs! &lt;a href="https://discord.gg/5mx42AGbHm" rel="noopener noreferrer"&gt;https://discord.gg/5mx42AGbHm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Visit LLMWare's Website&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Explore LLMWare on GitHub&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.freepik.com/free-photo/view-adorable-3d-cat_45138549.htm#fromView=search&amp;amp;page=1&amp;amp;position=1&amp;amp;uuid=c7c3603a-a846-4ddf-8a71-b0346612cef6" rel="noopener noreferrer"&gt;Image from Freepik&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>ai</category>
      <category>learning</category>
      <category>python</category>
    </item>
    <item>
      <title>How I Learned Generative AI in Two Weeks (and You Can Too): Part 1 - Libraries</title>
      <dc:creator>Julia Zhou</dc:creator>
      <pubDate>Thu, 12 Sep 2024 21:54:51 +0000</pubDate>
      <link>https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-1-libraries-215h</link>
      <guid>https://dev.to/llmware/how-i-learned-generative-ai-in-two-weeks-and-you-can-too-part-1-libraries-215h</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;For reference, prior to this journey, I barely had more knowledge about AI than the average person. Sure, I fired off the occasional ChatGPT request for one task or another, but I was always more focused on coding than AI, having picked up Python and Java during quarantine.  &lt;/p&gt;

&lt;p&gt;Despite my initial skepticism at being able to successfully understand the examples, particularly in a short time frame, I found LLMWare's "Fast Start to RAG" series highly accessible. I will cover example one of the course in this article - hopefully it can help you as well! If you are interested in learning more about LLMWare, feel free to check out our &lt;a href="https://llmware.ai/" rel="noopener noreferrer"&gt;website&lt;/a&gt; as well as another &lt;a href="https://dev.to/llmware/become-a-rag-professional-in-2024-go-from-beginner-to-expert-41mg"&gt;DEV article&lt;/a&gt; outlining the Fast Start to RAG examples. &lt;/p&gt;

&lt;p&gt;To clarify, extensive knowledge of coding, specifically Python 3, is not necessarily a prerequisite for the examples that I used to get my start in AI and RAG. However, basic understanding is certainly helpful in comprehending content and parsing code. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/CuuSHzuc0O166MRfjt/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img width="480" src="https://i.giphy.com/media/CuuSHzuc0O166MRfjt/giphy.gif" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;To run these examples, you will need to install the LLMWare package by running &lt;code&gt;pip3 install llmware&lt;/code&gt; in the command line. Further instructions can be found in our &lt;a href="https://github.com/llmware-ai/llmware/blob/main/fast_start/README.md" rel="noopener noreferrer"&gt;README file&lt;/a&gt;. Then, you will be able to run &lt;a href="https://github.com/llmware-ai/llmware/blob/main/fast_start/example-1-create_first_library.py" rel="noopener noreferrer"&gt;example 1&lt;/a&gt;, which is directly copy-paste ready.  &lt;/p&gt;

&lt;p&gt;I will also point out that the AI community tends to use acronyms (like AI itself!) and technical language extending beyond the scope of everyday conversation. The acronym "RAG" stands for Retrieval Augmented Generation, which enhances outputs of LLMs (Large Language Models) using external knowledge. In Example 1, we will be focusing on the first step in RAG - converting a pile of files into an AI ready knowledge base.    &lt;/p&gt;

&lt;h2&gt;
  
  
  Extra resources
&lt;/h2&gt;

&lt;p&gt;For visual learners, here is a video that works through example 1. Feel free to watch the video before following the steps in this article. Also, here is a Python Notebook that breaks down this example's code alongside the output: &lt;a href="https://github.com/llmware-ai/llmware/blob/main/examples/Notebooks/NoteBook_Examples/example_1_create_first_library.ipynb" rel="noopener noreferrer"&gt;Example 1 Notebook&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/2xDefZ4oBOM"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1 - Execution configuration
&lt;/h2&gt;

&lt;p&gt;By default, the active database being used is called "mongo", but we will select "sqlite" since it does not require a separate installation. &lt;/p&gt;

&lt;p&gt;Additionally, we can use different debug mode options to see more or less information as it is processed. We can set &lt;code&gt;debug_mode&lt;/code&gt; to 2 for more detailed outputs compared to 0, the default. &lt;/p&gt;

&lt;p&gt;For this example, sample data sets are imported through &lt;code&gt;from llmware.setup import Setup&lt;/code&gt; and are stored in &lt;code&gt;sample_folders&lt;/code&gt;. These sets include documents of different subject matters and sizes, but you will be able to replace them with your own data as well. We can choose a name for our library (go ahead and customize!) and select a folder from the samples before running the main script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LLMWareConfig().set_active_db("sqlite")

LLMWareConfig().set_config("debug_mode", 2)

sample_folders = ["Agreements", "Invoices", "UN-Resolutions-500", "SmallLibrary", "FinDocs", "AgreementsLarge"]
library_name = "example1_library"
selected_folder = sample_folders[0]     # e.g., "Agreements"

output = parsing_documents_into_library(library_name, selected_folder)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/ua7vVw9awZKWwLSYpW/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img width="480" src="https://i.giphy.com/media/ua7vVw9awZKWwLSYpW/giphy.gif" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2 - Main body
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Now, we can create our library! This line of code will set up the database tables as well as supporting file repositories to store information about the library.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;library = Library().create_new_library(library_name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Steps 2 and 3:&lt;/strong&gt; However, our library is still completely empty, so we need to fill it up. To do so, we will load in the LLMWare sample files and save them in &lt;code&gt;sample_files_path&lt;/code&gt;. If you are using your own data sets, you will need to point to a local folder path with your documents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sample_files_path = Setup().load_sample_files(over_write=False)
ingestion_folder_path = os.path.join(sample_files_path, sample_folder)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; While adding files to a library, LLMWare performs parsing, text chunking, and indexing in the sqlite database. It will automatically choose the correct parser based on a file's extension type. This parser will extract information to store in database text chunks. Although this may seem like a lot of steps, it all happens incredibly quickly behind the scenes!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;parsing_output = library.add_files(ingestion_folder_path)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; To check our progress, we can look at the &lt;code&gt;updated_library_card&lt;/code&gt;, which contains key metadata, counting data, and other important information. This &lt;code&gt;.get_library_card()&lt;/code&gt; method can be called at any time to retrieve information about your library,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;updated_library_card = library.get_library_card()
doc_count = updated_library_card["documents"]
block_count = updated_library_card["blocks"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Steps 6 and 7:&lt;/strong&gt; We can check the library's main folder structure, but the library is ready to start running queries! We will do this by instantiating a Query object and passing it to the library. This &lt;code&gt;test_query&lt;/code&gt; may need to be adjusted to best suit the data set. For this example, we chose the "Agreements" sample set, so we can use "base salary" as a "hello world"-esque query. &lt;/p&gt;

&lt;p&gt;Now, a text query is going to be run to look at every chunk of text to find the ones that contain "base salary" to return. The Query class contains many methods for different Query types. Today, we will use the simplest &lt;code&gt;text_query&lt;/code&gt; method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query_results = Query(library).text_query(test_query, result_count=10)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can print out our results, giving us a look at the metadata and attributes of the individual text blocks we created!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for i, result in enumerate(query_results):
        #   here are a few useful attributes
        text = result["text"]
        file_source = result["file_source"]
        page_number = result["page_num"]
        doc_id = result["doc_ID"]
        block_id = result["block_ID"]
        matches = result["matches"]

        print("query results: ", i, result)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/Z3VgQu8hkVeB1bakS9/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img width="480" src="https://i.giphy.com/media/Z3VgQu8hkVeB1bakS9/giphy.gif" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3 - The results
&lt;/h2&gt;

&lt;p&gt;The outputted summary will include key information such as &lt;code&gt;total pdf files processed&lt;/code&gt;, &lt;code&gt;total blocks created&lt;/code&gt;, &lt;code&gt;total pages added&lt;/code&gt;, and &lt;code&gt;time elapsed&lt;/code&gt;. Try and see if you can find all of them! &lt;/p&gt;

&lt;p&gt;In particular, the LLMWare package includes "C based parsers" that are able to quickly and efficiently parse files. Once completed, the parsed information will be outputted as a dictionary. You will see the results of your work in the previous steps!&lt;/p&gt;

&lt;p&gt;To summarize, we took our documents and broke them down into thousands of blocks. Then, we extracted text information and put it into the sqlite database. Lastly, we ran a text search against that data to retrieve our results (including details as small as pixel coordinates and character level matches!).&lt;/p&gt;

&lt;p&gt;You just completed your first example, but there is so much more for you to explore! I would suggest rerunning this example with varied data sets to tap into the true potential of this technology, and of course, continue onto example 2 about &lt;a href="https://github.com/llmware-ai/llmware/blob/main/fast_start/example-2-build_embeddings.py" rel="noopener noreferrer"&gt;building embeddings&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 4 - To see more ...
&lt;/h2&gt;

&lt;p&gt;Please join our LLMWare community on discord to learn more about RAG and LLMs! &lt;a href="https://discord.gg/5mx42AGbHm" rel="noopener noreferrer"&gt;https://discord.gg/5mx42AGbHm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Visit LLMWare's Website&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/llmware-ai/llmware" class="crayons-btn crayons-btn--primary" rel="noopener noreferrer"&gt;Explore LLMWare on GitHub&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.freepik.com/free-photo/computer-scientist-updating-ai-systems_237235999.htm#fromView=image_search_similar&amp;amp;page=1&amp;amp;position=3&amp;amp;uuid=0b4ac661-5087-4321-a5cf-0838108d5997" rel="noopener noreferrer"&gt;Image by DC Studio on Freepik&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>ai</category>
      <category>learning</category>
      <category>python</category>
    </item>
  </channel>
</rss>
