Skip to content

feat: start a recipe with llama-stack backend #3016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

feloy
Copy link
Contributor

@feloy feloy commented May 15, 2025

Signed-off-by: Philippe Martin phmartin@redhat.com

What does this PR do?

This PR is a first step towards being able to run a recipe using llama stack as backend.

This PR covers:

  • AI Lab supports recipes with backend="llama-stack"
  • for such recipe, no model is asked in the "Start Recipe" form
  • when AI Lab deploys a recipe with llama-stack backend, it does not deploy any inference server
  • the MODEL_ENDPOINT passed to the recipe is the endpoint of Llama Stack
  • all models served by Llama stack are accessible to the app. It is the responsability of the app to choose with which model to work

Screenshot / video of UI

llama-stack-recipe-2.mp4

What issues does this PR fix or reference?

Fixes #2625

How to test this PR?

  1. Add this recipe to your ~/.local/share/containers/podman-desktop/extensions-storage/redhat.ai-lab/user-catalog.json file:
{
  "version": "1.0",
  "recipes": [
    {
      "id": "chatbot-llama-stack",
      "description": "This recipe provides a blueprint for developers to create their own AI-powered chat applications using Streamlit and llama-stack.",
      "name": "ChatBot using Llama Stack",
      "repository": "https://github.com/feloy/chatbot-llama-stack-recipe",
      "ref": "main",
      "icon": "natural-language-processing",
      "categories": ["natural-language-processing"],
      "basedir": "/",
      "readme": "# Chat Application using Llama Stack\n",
      "backend": "llama-stack",
      "languages": ["python"],
      "frameworks": ["streamlit", "llama-stack"]
    }
  ],
  "models": [],
  "categories": []
}
  1. The app will work with the first model listed by llama stack: be sure to have only models compatible with chat served by Llama stack
  2. Go to the Recipes catalog and start the "ChatBot using Llama Stack" recipe
  3. Go to the running application details and open the app url

@feloy feloy requested review from benoitf, jeffmaury and a team as code owners May 15, 2025 11:58
@feloy feloy requested review from cdrage and SoniaSandler May 15, 2025 11:58
@jeffmaury jeffmaury requested a review from slemeur May 15, 2025 12:20
@feloy feloy force-pushed the feat-2624/llama-stack-recipes branch from 6954ab1 to a5f9985 Compare May 16, 2025 07:54
Comment on lines 207 to 209
if (model) {
// upload model to podman machine if user system is supported
if (!recipeComponents.inferenceServer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: use a single if model && !recipeComponents.inferenceServer

labels: Record<string, string> = {},
): Promise<PodInfo> {
const modelId = model ? model.id : '0';
Copy link
Contributor

@axel7083 axel7083 May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like that, use something more understandable like <none> or none

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, me neither:

Note: I'm not very happy with the way the applicationManager functions accept an optional model, depending on if we want to use llama-stack or not. Let's first discuss the high-level architecture of this solution, I can change these implementation details when we agree on the architecture

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I went to code too fast 🙏

Let's first discuss the high-level architecture of this solution,

What depends on the modelId? We use it for operation like hasApplicationPod & removeApplication. Maybe we should only use the recipeId as key?

Copy link
Contributor Author

@feloy feloy May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very comfortable changing the labels, as the model label is also used for the tasks (the user can start the same recipe with different models, and we want to differentiate the tasks for them).

I have pushed a new commit changing how the parameters are passed: having explicit options inferModel / startLlamaStack, which enforce the other parameters (the model parameter for the moment). I also changed this arbitrary 0 model Id to <none>

@axel7083 WDYT?

feloy added 4 commits May 19, 2025 09:38
Signed-off-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>
@feloy feloy force-pushed the feat-2624/llama-stack-recipes branch from a6227e1 to 49e4639 Compare May 19, 2025 08:38
@feloy feloy requested a review from axel7083 May 19, 2025 08:44
@gastoner
Copy link
Contributor

Please add "llama-stack" here https://github.com/containers/podman-desktop-extension-ai-lab/blob/main/packages/frontend/src/lib/RecipeCardTags.ts#L25 so it works with other tags (I think this should be only change to make it work)

labels?: { [key: string]: string },
): Promise<RecipeComponents> {
const localFolder = path.join(this.appUserDirectory, recipe.id);
public async buildRecipe(options: ApplicationOptions, labels?: { [key: string]: string }): Promise<RecipeComponents> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not including the labels in the options? feel weird to move everything inside ApplicationOptions but the labels?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First reason is because labels is not part of the parameters of requestPullApplication, and I would like to keep the same options structure everywhere

Signed-off-by: Philippe Martin <phmartin@redhat.com>
@feloy feloy force-pushed the feat-2624/llama-stack-recipes branch from 8608fe7 to ce79877 Compare May 19, 2025 12:03
@feloy feloy marked this pull request as draft May 19, 2025 12:15
feloy added 2 commits May 19, 2025 14:27
Signed-off-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>
@feloy feloy force-pushed the feat-2624/llama-stack-recipes branch from c22c5d9 to 7db6fe5 Compare May 19, 2025 13:54
@feloy feloy requested a review from axel7083 May 19, 2025 13:59
@feloy feloy marked this pull request as ready for review May 19, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a llama-stacked version of the Summarizer recipe
3 participants