Skip to content

feat: mutiple backends for recipes#3114

Open
jeffmaury wants to merge 4 commits intocontainers:mainfrom
jeffmaury:GH-3006
Open

feat: mutiple backends for recipes#3114
jeffmaury wants to merge 4 commits intocontainers:mainfrom
jeffmaury:GH-3006

Conversation

@jeffmaury
Copy link
Copy Markdown
Collaborator

Fixes #3006

Signed-off-by: Jeff MAURY jmaury@redhat.com

What does this PR do?

Allow association from recipe to multiple backends

Screenshot / video of UI

N/A

What issues does this PR fix or reference?

#3006

How to test this PR?

Start recipes. You should be a able to start recipes with an OpenVINO model

jeffmaury added 2 commits May 28, 2025 14:23
Fixes containers#3006

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
Fixes containers#3006

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
@jeffmaury jeffmaury requested review from a team and benoitf as code owners June 2, 2025 15:16
@jeffmaury jeffmaury requested review from cdrage, dgolovin and gastoner June 2, 2025 15:16
Copy link
Copy Markdown
Contributor

@gastoner gastoner left a comment

Choose a reason for hiding this comment

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

I've tried 2 recipes (with backend and backends):
backends: all works as expected ✔️

When selecting recipe with just "backed"

Screencast_20250603_080529.webm

I'm unable to see any models (guessing that backend should be backends)

basedir: 'recipes/natural_language_processing/chatbot',
readme: '',
recommended: ['hf.instructlab.granite-7b-lab-GGUF', 'hf.instructlab.merlinite-7b-lab-GGUF'],
backend: 'llama-cpp',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldnt this be also backends: ['llama-cpp'] ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not mandatory because it will be parsed but updated for consistency

"hf.lmstudio-community.granite-3.0-8b-instruct-GGUF"
],
"backend": "llama-cpp",
"backend": ["llama-cpp", "openvino"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldnt there be also backends like if I have an array -> backedns

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
@jeffmaury jeffmaury requested a review from gastoner June 3, 2025 07:20
Copy link
Copy Markdown
Contributor

@gastoner gastoner left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +333 to 336
.flatMap(r => r.backends)
.filter(b => b !== undefined)
.filter((value, index, array) => array.indexOf(value) === index)
.sort((a, b) => a.localeCompare(b))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remark (non-blocking): non related to this PR, but this filtering chain is unreadable, what is r ? what is b?, what is the type of value, what is the type of a and b? :/

Comment on lines +293 to +297
let res: Recipe[] = [];
for (const value of values) {
res = [...res, ...result.filter(r => r.backends?.includes(value))];
}
result = res;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: I don't understand what this code is doing? can we add a comment? filtering result? shallow copy?

// Filter all models based on backend property
let models: ModelInfo[] = $derived(
$modelsInfo.filter(model => (model.backend ?? InferenceType.NONE) === (recipe?.backend ?? InferenceType.NONE)),
$modelsInfo.filter(model => recipe?.backends?.includes(model.backend ?? InferenceType.NONE)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: I would be more confortable adding an unit test in StartRecipe.spec.ts where we have a recipe with several backends, to ensure we properly display all models matching the backends listed.

@@ -42,7 +42,7 @@ let startedContainerProviderConnectionInfo: ContainerProviderConnectionInfo[] =
let localPath: LocalRepository | undefined = $derived(findLocalRepositoryByRecipeId($localRepositories, recipe?.id));
// Filter all models based on backend property
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

update comment?

Copy link
Copy Markdown
Contributor

@axel7083 axel7083 left a comment

Choose a reason for hiding this comment

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

Left some comment, currently trying it locally on Windows 11, good job otherwise 👍

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
@benoitf benoitf removed their request for review April 2, 2026 11:50
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.

A recipe shoud be associated with several backends

3 participants