Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Getting started with Podman AI Lab

Integrate generative AI in your applications

April 24, 2024
Stevan Le Meur Cedric Clyburn
Related topics:
Artificial intelligenceContainersDeveloper Tools
Related products:
Podman Desktop

Share:

    Podman AI Lab is an open source extension for Podman Desktop that lets you work with large language models (LLMs) on a local environment. From getting started with artificial intelligence (AI) and experimenting with models and prompts to model serving and playgrounds for common generative AI use cases, Podman AI Lab enables you to easily bring AI into your applications without depending on infrastructure beyond your laptop. 

    In this article, we’ll take a tour of the extension and walk you through each of the different capabilities provided by Podman AI Lab. Discover how you can start integrating generative AI in new and existing applications.

    Podman Desktop installation and setup 

    As a developer working on building an application that will eventually be deployed on Kubernetes, you'll likely need a container development solution for your local environment. One option that is free and open source is Podman Desktop.

    Podman Desktop provides a graphical interface that makes it easy to work with containers and even bridges with Kubernetes. This means that you can easily develop and test your application in a containerized environment without having to worry about the underlying infrastructure. Additionally, the graphical interface makes it easy for you to manage your containers and see what's happening in real time, with functionality to easily SSH into your containers, debug, and deploy to local and remote Kubernetes clusters.

    Podman Desktop is available on macOS, Windows, and Linux. To download it, you can go to the website podman-desktop.io/downloads and follow the instructions for your system, as shown in Figure 1.

    Download Podman Desktop
    Figure 1: Podman Desktop download page.

    Once installed, you’ll get an onboarding sequence in Podman Desktop, which will help to configure your environment with the different tools you might need, from installing and keeping the Podman engine updated, to Kubernetes command-line tools such as kubectl, minikube, and more.

    Install the Podman AI Lab extension

    After installing Podman Desktop, you’ll notice a small “puzzle piece” icon on the left sidebar—this is where all the dedicated extensions for Podman Desktop can be accessed and installed. You can easily extend the functionality of Podman Desktop for your specific use case—for example, working with AI for your application development with the Podman AI Lab extension. See Figure 2.

    catalog-extensions
    Figure 2: Podman Desktop extensions.

    Here, you can install the Podman AI Lab extension by clicking the icon on the right of the Podman AI Lab card or the Red Hat Extension Pack. Feel free to view more details about the extension, and check out the documentation as you begin to learn about Podman AI Lab’s recipes catalog, built-in models, and more.

    Alternatively, on the dashboard of Podman Desktop you’ll notice the banner featuring Podman AI Lab extension. See Figure 3.

    welcome-screen
    Figure 3: Podman Desktop dashboard featuring Podman AI Lab banner.

    Discover the Podman AI Lab extension

    When you open Podman AI Lab for the first time, you'll be greeted with a dashboard that provides an overview of what the extension offers, as shown in Figure 4. This includes the recipes catalog for common AI use cases and examples, ready-to-use open source models, a dashboard for inferencing models, playgrounds to fine-tune and customize your model, and much more. 

    Podman AI Lab is your starting point for AI application development from your desktop. Learn more about its key features in the following sections.

    dashboard-ai-lab
    Figure 4: Podman AI Lab dashboard.

    Recipes Catalog

    One of the most important features of the Podman AI Lab extension is the curated catalog of open source recipes that enable you to navigate common AI use cases and solutions. To begin, click the top left option in the sidebar to open the Recipes Catalog, as shown in Figure 5. This catalog is organized by categories of example use cases that can inspire you on how to infuse your app with AI, with pre-selected models (and the ability to swap), example code, and easy access to your IDE. Browse through the list and find the recipe that best suits your needs.

    recipe-list
    Figure 5: The Podman AI Lab Recipes Catalog.

    With Podman AI Lab, you have access to a wide range of tools and resources that can help you begin infusing AI into your own applications. The catalog of recipes is provided to provide the best practices and inspire you with use cases you can eventually benefit from in your applications. 

    Once you've selected a recipe from the Recipes Catalog, you'll be able to see a summary of what the recipe does and how it works. This will give you a better understanding of the recipe's capabilities and help you decide if it's right for your application. You’ll also find handy links to the application source code and the recommended model, as well as the ability to select other compatible models (curated from Hugging Face’s open source community). Figure 6 depicts this.

    chat-app
    Figure 6: Recipe details view.

    When you're ready to see the application live and running, you can start it by clicking the Start AI App button on the upper right-hand side. As the application starts, you'll be able to see the model it uses and where the source code of the application is located (Figure 7). In the background, Podman is running an inference server for the downloaded model within a container using the freely redistributable Red Hat Enterprise Linux Universal Base Image.

    loading-ai-app
    Figure 7: AI app details.

    During the startup process, you'll be shown a few steps that will be completed before the application is ready to use. These steps might include downloading the model, building the container images with the model and the application, etc. See Figure 8.

    ai-application-ready
    Figure 8: AI app startup process steps.

    Once the application has started, you can open it from the UI and use it from your web browser. In the chatbot example (Figure 9), we’re able to interact with the front end application, which is inferencing the model server, the selected Mistral-7B model. It’s this easy to set up a model server and start integrating generative AI in your applications.

    chatbot-app
    Figure 9: Interacting with the frontend application.

    As you work in other areas of Podman Desktop for your container workflow, you’ll always be able to see your running AI apps (i.e., the recipes you started) in the dedicated Running section for Podman AI Lab. Figure 10 depicts this.

    ai-app-running
    Figure 10: Viewing your running AI apps in Podman AI Lab.

    Model swapping with recipes

    One of the pain points that you might face when building applications with AI is navigating the jungle of models. With so many different models available, it can be difficult to know which one is best suited for a particular use case. Setting things up and comparing how different models work can be a time-consuming and complex process. In Podman AI Lab, you can actually use the pre-built recipes to quickly compare different models and their behaviors, as Figure 11 depicts.

    model-swapping
    Figure 11: Comparing different compatible models.

    On the AI Apps Details side panel, you can select a different model for the recipe and relaunch the application with this new model by clicking the swapping model button or on the Models tab from the recipe screen.

    Once you've selected a new model, you can play with the recipe using the new model and compare it to the one you were just running. To try out a different model, you'll need to stop the current AI app and recreate it with the desired model. See Figure 12.

    model-swapping-ai-app
    Figure 12: Trying out different models

    Application details and Pod view

    You might be wondering how the application works and has been packaged all together with the model. If you want, you can see the application’s details by going to the Pods list in Podman Desktop. You’ll notice the started pod associated with the recipe (Figure 14).

    pod-ai-app
    Figure 13: Viewing application details from the Pods list.

    From there, you can see the details, logs, and outputs of each container of the application and if needed, you can also get a terminal to SSH directly into those.

    Browse source code and learn best practices

    When you see a recipe related to a specific use case, such as text summarization, you might think about how this functionality could improve your pre-existing app's user experience. To learn more about the recipe and its implementation, you can simply select it and open its source code in VS Code, or select the Local clone folder to view the directory in your file explorer, as shown in Figure 14.

    ai-app-source-code-ide
    Figure 14: Open a recipe's source code in VS Code or clone it locally.

    When you view the recipe, you'll be provided with a link to a Git repo containing the source code for the recipe. By examining the source code, you'll be able to learn how the recipe is interacting with the model to provide the summarization functionality. This will give you a better understanding of best practices for integrating AI into your app. 

    Catalog of open source models

    Podman AI Lab provides a catalog of curated open source models (Figure 15), but navigating through the license aspects of the models can be a challenge. Before starting to bring new capabilities and rely on third-party components for your application, you need to validate the legal requirements of using the models you might find from different providers. The Apache 2.0 license is a widely recognized open source license, as well as MIT. The models available in Podman AI Lab have been checked to ensure compatibility and adherence to legal requirements.

    catalog-models
    Figure 15: Podman AI Lab's catalog of open source models.

    By selecting any of the available models, you can understand some critical information about the model. For each of the models, you’ll find an indication on the provider, the license, release notes, etc. To download a model and make it available locally, click the Download action icon on the right side of the model item in the list. By clicking on the model, you’ll get information about the model and be able to learn more about how it has been built, as shown in Figure 16.

    model-details
    Figure 16: Select a model to view its details.

    If you're interested in contributing to and extending the catalog, feel free to propose a pull request to the following repository: https://github.com/containers/ai-lab-recipes

    Bring your own model

    In some cases, you might want to experiment with your own model, whether it's a model that you crafted or a model that you tuned. Podman AI Lab supports importing your own model in common formats such as GGUF. See Figure 17.

    bring-your-own-model
    Figure 17: Importing your own models to Podman AI Lab.

    In order to import your own model, from the catalog of models, click the Import button in the top right corner. You’ll have a new screen from which you can select the file from your local environment. Once imported, you can start a model server or a playground environment to experiment with your own model.

    Experimenting with models in a playground environment

    Testing and experimenting with models is an essential part of the development process. However, it can be challenging to test your models in a safe environment where you can interact with them and observe their behavior. With the built-in playground environments from Podman AI Lab, you can test, experiment, and prototype with models. An intuitive user prompt helps in exploring the capabilities and accuracy of various models and aids in finding the best model and settings for the use case you have in your application. Figure 18 shows the playground environment.

    playground-ai-model
    Figure 18: The built-in playground environment.

    To create a new playground environment, simply click the New Playground environment button and fill out a form with their desired name and selected model. The list of models displayed in the form will only include models that have been previously downloaded. 

    After clicking the Create playground environment button, the playground environment will start and a user prompt will be displayed (Figure 20). In the background, an inference server is running in a container and exposing the model.

    playground-example
    Figure 19: User prompt in the running playground environment.

    Once the playground environment is started, you will have the ability to interact with the model, and define system prompts for your specific application’s use case. You can use the graphical interface to explore the capabilities of the model, test your prompts, and experiment with different behavior to optimize performance and results. The answers from the model will be streamed natively in the user interface.

    If you are interested in comparing two different models, you can create a new playground for another model and ask the same questions. By comparing the differences between the behaviors of the two models, you can gain valuable insights into how the models are performing and identify any issues or errors that might arise.

    In the playground environment, you’ll also find some settings that you can configure (Figure 21):

    • Temperature: Controls the randomness of the model's output, affecting creativity and predictability.  
    • Max tokens: Sets the maximum length of the model's response in terms of tokens (words or word pieces).
    • Top-p: Restricts the model's word choice to the most likely candidates, ensuring coherence and relevance.
    playground-settings
    Figure 20: Configuring the model parameters.

    You can use those parameters to change the way the model behaves and answers, as shown in Figure 22. 

    define-system-prompt
    Figure 21: Defining a system prompt to change the model's behavior.

    We touched on this earlier, but you might want to consider defining a system prompt that will be used to define general context, instructions, and guidelines to be used with each query to the model. Overall, the playground environment is excellent when you want to test models locally in a safe and controlled environment.

    Local model serving

    As a developer, containers have always been an easy way to run databases locally. They provide an isolated environment that allows us to easily set up and manage databases without worrying about conflicts or compatibility issues. However, with LLMs, we can now apply container technology’s same simplicity and ease of use when it comes to running AI models locally.

    To do that, Podman AI Lab provides the ability to spin up local inference servers using llama.cpp within containers. It’s now easy to run a model locally, establish an endpoint, and start writing code to wrap new application capabilities around the model.

    To create a model server, go to the Services page and click the Create Model service button (Figure 23). If your environment does not have sufficient memory, you’ll get a notification indicating that you need to increase the available memory, which can easily be updated from Podman Desktop’s Settings page. Here, you can select the desired model you want to serve and define the port you want to use. The list of models displayed in the form will only include models that have been previously downloaded. 

    local-model-service
    Figure 22: Creating a model service.

    Once the model service has been started, you can open its detail page. This helps you understand the details of the model-service endpoint and see a number of code snippets that help you learn how to interact with the model service from your application; for instance, an application written in Python and using LangChain. See Figure 24.

    local-model-service-detail-page
    Figure 23: Model service details page.

    As AI continues to grow in popularity, there has been an increase in the number of AI services, tools, and applications that are available. The technology behind Podman AI Lab model serving relies on llama.ccp as an inference server for models and provides Open AI-compatible APIs to simplify adding new AI capabilities into your applications and services.

    Accessing the model server container

    Interested in exploring the model server container and checking its state? That's easy! Podman AI Lab runs on top of Podman Desktop and its components are running as containers. Simply access the list of containers and click on the container to get into its details, as shown in Figure 24.

    model-server-container
    Figure 24: Click on the model server container to view its details.

    The model serving page simplifies the process of getting your models up and running, allowing you to concentrate on writing the application's code rather than setting up the infrastructure. You are in a safe zone and your data will remain private. It provides you a user-friendly interface to interact with the model, and code snippets to ease the integration of models in your application. By using the model serving page, you can be confident that your model is functioning correctly. This streamlined approach saves time and effort, enabling you to focus on developing your application and enhancing its functionality.

    Final words

    With Podman AI Lab, you have access to a wide range of tools and resources that can help you start infusing AI into your applications. Try it out today to embrace the full potential of open source LLMs and generative AI Podman AI Lab has everything you need to create powerful and innovative applications. 

    Start by exploring the catalog of recipes and finding the perfect use case for your app. Leverage the open source LLMs and start experimenting with the playground environment and model serving. With Podman AI Lab, you'll be able to take your app to the next level and create something truly remarkable. 

    Download Podman Desktop today, and adopt a seal. :) 

    Last updated: May 7, 2024

    Related Posts

    • Introducing Podman AI Lab: Developer tooling for working with LLMs

    • Podman Desktop 1.0: Local container development made easy

    • Working with Kubernetes in Podman Desktop

    • Containerize a Spring Boot application with Podman Desktop

    • How to use LLMs in Java with LangChain4j and Quarkus

    • AI Lab Recipes

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    What’s up next?

    Download the Podman Cheat Sheet and explore basic commands for managing images, containers, and container resources.

    Podman Cheat Sheet
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue