|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> |
| 6 | + <title>Podman Desktop AI :: Podman Desktop Tutorial</title> |
| 7 | + <link rel="canonical" href="https://redhat-scholars.github.io/podman-desktop-tutorial/podman-desktop-tutorial/ai.html"> |
| 8 | + <link rel="prev" href="kubernetes-deploying.html"> |
| 9 | + <link rel="next" href="kubernetes-deploying.html"> |
| 10 | + <meta name="generator" content="Antora 3.0.0"> |
| 11 | + <link rel="stylesheet" href="../_/css/site.css"> |
| 12 | + </head> |
| 13 | + <body class="article"> |
| 14 | +<header class="header"> |
| 15 | + <nav class="navbar"> |
| 16 | + <div class="navbar-brand"> |
| 17 | + <a class="navbar-item" href="https://developers.redhat.com" target="_blank"><img src="../_/img/RHDLogo.svg" height="40px" alt="Red Hat Developer Program"></a> |
| 18 | + <a class="navbar-item" style="font-size: 24px; color: white" href="https://redhat-scholars.github.io/podman-desktop-tutorial">Podman Desktop Tutorial</a> |
| 19 | + <button class="navbar-burger" data-target="topbar-nav"> |
| 20 | + <span></span> |
| 21 | + <span></span> |
| 22 | + <span></span> |
| 23 | + </button> |
| 24 | + </div> |
| 25 | + <div id="topbar-nav" class="navbar-menu"> |
| 26 | + <div class="navbar-end"> |
| 27 | + <a class="navbar-item" href="https://developers.redhat.com/ebooks/" target="_blank">Books</a> |
| 28 | + <a class="navbar-item" href="https://developers.redhat.com/cheatsheets/" target="_blank">Cheat Sheets</a> |
| 29 | + <a class="navbar-item" href="https://developers.redhat.com/events/" target="_blank">Upcoming Events</a> |
| 30 | + <div class="navbar-item has-dropdown is-hoverable"> |
| 31 | + <a class="navbar-link" href="#">More Tutorials</a> |
| 32 | + <div class="navbar-dropdown"> |
| 33 | + <a class="navbar-item" href="https://redhat-developer-demos.github.io/kubernetes-tutorial/" target="_blank">Kubernetes</a> |
| 34 | + <a class="navbar-item" href="https://redhat-developer-demos.github.io/istio-tutorial/" target="_blank">Istio</a> |
| 35 | + <a class="navbar-item" href="https://redhat-developer-demos.github.io/quarkus-tutorial/" target="_blank">Quarkus</a> |
| 36 | + <a class="navbar-item" href="https://redhat-developer-demos.github.io/knative-tutorial/" target="_blank">Knative</a> |
| 37 | + <a class="navbar-item" href="https://redhat-developer-demos.github.io/tekton-tutorial/" target="_blank">Tekton</a> |
| 38 | + </div> |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + </div> |
| 42 | + </nav> |
| 43 | +</header> |
| 44 | +<div class="body"> |
| 45 | +<div class="nav-container" data-component="podman-desktop-tutorial" data-version="master"> |
| 46 | + <aside class="nav"> |
| 47 | + <div class="panels"> |
| 48 | +<div class="nav-panel-menu is-active" data-panel="menu"> |
| 49 | + <nav class="nav-menu"> |
| 50 | + <h3 class="title"><a href="index.html"></a></h3> |
| 51 | +<ul class="nav-list"> |
| 52 | + <li class="nav-item" data-depth="0"> |
| 53 | +<ul class="nav-list"> |
| 54 | + <li class="nav-item" data-depth="1"> |
| 55 | + <button class="nav-item-toggle"></button> |
| 56 | + <span class="nav-text">Podman Desktop Fundamentals</span> |
| 57 | +<ul class="nav-list"> |
| 58 | + <li class="nav-item" data-depth="2"> |
| 59 | + <a class="nav-link" href="env-setup.html">Environment Setup</a> |
| 60 | + </li> |
| 61 | + <li class="nav-item" data-depth="2"> |
| 62 | + <a class="nav-link" href="intro.html">Introduction to Containers</a> |
| 63 | + </li> |
| 64 | + <li class="nav-item" data-depth="2"> |
| 65 | + <a class="nav-link" href="podman-basics.html">Podman Desktop Interface & Essentials</a> |
| 66 | + </li> |
| 67 | +</ul> |
| 68 | + </li> |
| 69 | + <li class="nav-item" data-depth="1"> |
| 70 | + <button class="nav-item-toggle"></button> |
| 71 | + <span class="nav-text">Working with Podman Desktop</span> |
| 72 | +<ul class="nav-list"> |
| 73 | + <li class="nav-item" data-depth="2"> |
| 74 | + <a class="nav-link" href="building-images.html">Building Images in Podman Desktop</a> |
| 75 | + </li> |
| 76 | + <li class="nav-item" data-depth="2"> |
| 77 | + <a class="nav-link" href="running-containers.html">Running and Managing Containers</a> |
| 78 | + </li> |
| 79 | + <li class="nav-item" data-depth="2"> |
| 80 | + <a class="nav-link" href="pods.html">Working with Pods</a> |
| 81 | + </li> |
| 82 | +</ul> |
| 83 | + </li> |
| 84 | + <li class="nav-item" data-depth="1"> |
| 85 | + <button class="nav-item-toggle"></button> |
| 86 | + <span class="nav-text">Targeting Kubernetes</span> |
| 87 | +<ul class="nav-list"> |
| 88 | + <li class="nav-item" data-depth="2"> |
| 89 | + <a class="nav-link" href="kubernetes.html">Kubernetes Overview</a> |
| 90 | + </li> |
| 91 | + <li class="nav-item" data-depth="2"> |
| 92 | + <a class="nav-link" href="kubernetes-deploying.html">Deploying to Kubernetes</a> |
| 93 | + </li> |
| 94 | +</ul> |
| 95 | + </li> |
| 96 | + <li class="nav-item" data-depth="1"> |
| 97 | + <button class="nav-item-toggle"></button> |
| 98 | + <span class="nav-text">Podman Desktop AI Lab</span> |
| 99 | +<ul class="nav-list"> |
| 100 | + <li class="nav-item is-current-page" data-depth="2"> |
| 101 | + <a class="nav-link" href="ai.html">Podman Desktop AI</a> |
| 102 | + </li> |
| 103 | + <li class="nav-item" data-depth="2"> |
| 104 | + <a class="nav-link" href="kubernetes-deploying.html">Deploying to Kubernetes</a> |
| 105 | + </li> |
| 106 | +</ul> |
| 107 | + </li> |
| 108 | +</ul> |
| 109 | + </li> |
| 110 | + <li class="nav-item" data-depth="0"> |
| 111 | +<ul class="nav-list"> |
| 112 | + <li class="nav-item" data-depth="1"> |
| 113 | + <button class="nav-item-toggle"></button> |
| 114 | + <span class="nav-text">Resources</span> |
| 115 | +<ul class="nav-list"> |
| 116 | + <li class="nav-item" data-depth="2"> |
| 117 | + <a class="nav-link" href="resources.html">Conclusion & Resources</a> |
| 118 | + </li> |
| 119 | +</ul> |
| 120 | + </li> |
| 121 | +</ul> |
| 122 | + </li> |
| 123 | +</ul> |
| 124 | + </nav> |
| 125 | +</div> |
| 126 | + </div> |
| 127 | + </aside> |
| 128 | +</div> |
| 129 | +<main class="article"> |
| 130 | +<div class="toolbar" role="navigation"> |
| 131 | +<button class="nav-toggle"></button> |
| 132 | + <a href="index.html" class="home-link"></a> |
| 133 | +<nav class="breadcrumbs" aria-label="breadcrumbs"> |
| 134 | + <ul> |
| 135 | + <li><a href="index.html">Podman Desktop Tutorial</a></li> |
| 136 | + <li>Podman Desktop AI Lab</li> |
| 137 | + <li><a href="ai.html">Podman Desktop AI</a></li> |
| 138 | + </ul> |
| 139 | +</nav> |
| 140 | + <div class="edit-this-page"><a href="https://github.com/redhat-scholars/podman-desktop-tutorial/edit/master/documentation/modules/ROOT/pages/ai.adoc">Edit this Page</a></div> |
| 141 | + </div> |
| 142 | + <div class="content"> |
| 143 | +<article class="doc"> |
| 144 | +<h1 class="page">Podman Desktop AI</h1> |
| 145 | +<div id="preamble"> |
| 146 | +<div class="sectionbody"> |
| 147 | +<div class="paragraph"> |
| 148 | +<p>Podman AI Lab is an open-source extension for Podman Desktop to work with LLMs (Large Language Models) in a local environment. It provides key open-source technologies to start building on AI. A curated catalog of so-called recipes helps navigate the jungle of AI use cases and AI models. AI Lab further ships playgrounds: environments to experiment with and test AI models, such as a chatbot.</p> |
| 149 | +</div> |
| 150 | +</div> |
| 151 | +</div> |
| 152 | +<div class="sect1"> |
| 153 | +<h2 id="_installing_podman_ai_lab"><a class="anchor" href="#_installing_podman_ai_lab"></a>Installing Podman AI Lab</h2> |
| 154 | +<div class="sectionbody"> |
| 155 | +<div class="paragraph"> |
| 156 | +<p>To install Podman AI extension, click on extensions icon (placed at left of the screen) represented by a puzzle piece:</p> |
| 157 | +</div> |
| 158 | +<div class="imageblock unresolved"> |
| 159 | +<div class="content"> |
| 160 | +<img src="podman-desktop-ai-extension.png" alt="Podman Desktop Extension AI" width="600"> |
| 161 | +</div> |
| 162 | +</div> |
| 163 | +<div class="paragraph"> |
| 164 | +<p>If you already have the extension installed, you should see it there, if not, click on the <strong>Catalog</strong> section, search for the <strong>Podman AI Lab Extension</strong>, and push the install icon:</p> |
| 165 | +</div> |
| 166 | +<div class="imageblock"> |
| 167 | +<div class="content"> |
| 168 | +<img src="_images/podman-desktop-ai-catalog.png" alt="Podman Desktop Extension AI Catalog" width="600"> |
| 169 | +</div> |
| 170 | +</div> |
| 171 | +<div class="paragraph"> |
| 172 | +<p>When the extension is installed (you might restart Podman Desktop), you can see a new option in the left menu to enter the AI Lab extension:</p> |
| 173 | +</div> |
| 174 | +<div class="imageblock"> |
| 175 | +<div class="content"> |
| 176 | +<img src="_images/podman-desktop-ai-section.png" alt="Podman Desktop Robot Seal" width="600"> |
| 177 | +</div> |
| 178 | +</div> |
| 179 | +<div class="paragraph"> |
| 180 | +<p>Select <strong>Catalog</strong> option to see all the available models.</p> |
| 181 | +</div> |
| 182 | +<div class="sect2"> |
| 183 | +<h3 id="_inferencing_a_model"><a class="anchor" href="#_inferencing_a_model"></a>Inferencing a Model</h3> |
| 184 | +<div class="paragraph"> |
| 185 | +<p>In the catalog, find the <code>instructlab/granite-7b-lab-GGUF</code> model and download the model:</p> |
| 186 | +</div> |
| 187 | +<div class="imageblock"> |
| 188 | +<div class="content"> |
| 189 | +<img src="_images/podman-desktop-ai-download.png" alt="Podman Desktop Download Model" width="600"> |
| 190 | +</div> |
| 191 | +</div> |
| 192 | +<div class="paragraph"> |
| 193 | +<p>When the process finishes, you can deploy the model into a container by pushing the <strong>rocket</strong> icon:</p> |
| 194 | +</div> |
| 195 | +<div class="imageblock"> |
| 196 | +<div class="content"> |
| 197 | +<img src="_images/podman-desktop-ai-rocket.png" alt="Launch Service" width="600"> |
| 198 | +</div> |
| 199 | +</div> |
| 200 | +<div class="paragraph"> |
| 201 | +<p>This process creates a <em>service</em> composed of a container inferencing the model with an Open AI compatible API.</p> |
| 202 | +</div> |
| 203 | +<div class="paragraph"> |
| 204 | +<p>The following window shows you some information about the container that will be deployed, such as the copied model or the exposed port. |
| 205 | +Push the <strong>Create Service</strong> button to start the container:</p> |
| 206 | +</div> |
| 207 | +<div class="imageblock"> |
| 208 | +<div class="content"> |
| 209 | +<img src="_images/podman-desktop-ai-create.png" alt="Create Service" width="600"> |
| 210 | +</div> |
| 211 | +</div> |
| 212 | +<div class="paragraph"> |
| 213 | +<p>After a few seconds, the model is up and running, and the <strong>Open Service Details</strong> button is enabled.</p> |
| 214 | +</div> |
| 215 | +<div class="imageblock"> |
| 216 | +<div class="content"> |
| 217 | +<img src="_images/podman-desktop-ai-details.png" alt="Details Service" width="600"> |
| 218 | +</div> |
| 219 | +</div> |
| 220 | +<div class="paragraph"> |
| 221 | +<p>The details shown are:</p> |
| 222 | +</div> |
| 223 | +<div class="ulist"> |
| 224 | +<ul> |
| 225 | +<li> |
| 226 | +<p>The inferencing URL.</p> |
| 227 | +</li> |
| 228 | +<li> |
| 229 | +<p>A link to the Swagger API documentation for accessing the service.</p> |
| 230 | +</li> |
| 231 | +<li> |
| 232 | +<p>A code snippet to access the service.</p> |
| 233 | +</li> |
| 234 | +</ul> |
| 235 | +</div> |
| 236 | +<div class="paragraph"> |
| 237 | +<p>By default, it shows how to access the model using the <code>curl</code> command:</p> |
| 238 | +</div> |
| 239 | +<div class="imageblock"> |
| 240 | +<div class="content"> |
| 241 | +<img src="_images/podman-desktop-ai-info.png" alt="Details Service" width="600"> |
| 242 | +</div> |
| 243 | +</div> |
| 244 | +<div class="paragraph"> |
| 245 | +<p>Push the button from the right part of the <strong>Client Code</strong> section to copy the snippet, and paste the <code>curl</code> snippet to a terminal.</p> |
| 246 | +</div> |
| 247 | +<div class="listingblock console-input"> |
| 248 | +<div class="content"> |
| 249 | +<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">curl --location 'http://localhost:64803/v1/chat/completions' \ |
| 250 | +--header 'Content-Type: application/json' \ |
| 251 | +--data '{ |
| 252 | + "messages": [ |
| 253 | + { |
| 254 | + "content": "You are a helpful assistant.", |
| 255 | + "role": "system" |
| 256 | + }, |
| 257 | + { |
| 258 | + "content": "What is the capital of France?", |
| 259 | + "role": "user" |
| 260 | + } |
| 261 | + ] |
| 262 | +}'</code></pre> |
| 263 | +</div> |
| 264 | +</div> |
| 265 | +<div class="paragraph"> |
| 266 | +<p>And after a few seconds, you’ll see the response from the model:</p> |
| 267 | +</div> |
| 268 | +<div class="listingblock console-output"> |
| 269 | +<div class="content"> |
| 270 | +<pre class="highlightjs highlight"><code class="language-json hljs" data-lang="json">{"id":"chatcmpl-7ec86649-1eb9-4736-81c3-2919576d2963","object":"chat.completion","created":1732302279,"model":"/models/granite-7b-lab-Q4_K_M.gguf","choices":[{"index":0,"message":{"content":"The capital of France is Paris.","role":"assistant"},"logprobs":null,"finish_reason":"stop"}],"usage":{"prompt_tokens":66,"completion_tokens":15,"total_tokens":81}}</code></pre> |
| 271 | +</div> |
| 272 | +</div> |
| 273 | +<div class="paragraph"> |
| 274 | +<p>Don’t stop the model yet. In the following section, you’ll modify the previous Quarkus example to integrate it with this inference model.</p> |
| 275 | +</div> |
| 276 | +</div> |
| 277 | +</div> |
| 278 | +</div> |
| 279 | +<nav class="pagination"> |
| 280 | + <span class="prev"><a href="kubernetes-deploying.html">Deploying to Kubernetes</a></span> |
| 281 | + <span class="next"><a href="kubernetes-deploying.html">Deploying to Kubernetes</a></span> |
| 282 | +</nav> |
| 283 | +</article> |
| 284 | +<aside class="toc sidebar" data-title="Contents" data-levels="2"> |
| 285 | + <div class="toc-menu"></div> |
| 286 | +</aside> |
| 287 | + </div> |
| 288 | +</main> |
| 289 | +</div> |
| 290 | +<footer class="footer"> |
| 291 | + <a class="rhd-logo" href="https://developers.redhat.com" target="_blank"></div> |
| 292 | +</footer> |
| 293 | +<script src="../_/js/vendor/clipboard.js"></script> |
| 294 | +<script src="../_/js/site.js"></script> |
| 295 | +<script async src="../_/js/vendor/highlight.js"></script> |
| 296 | + </body> |
| 297 | +</html> |
0 commit comments