Skip to content

Commit

Permalink
feat: add optional language and frameworks fields to recpies
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Martin <[email protected]>
  • Loading branch information
feloy committed Dec 24, 2024
1 parent 358fc37 commit c51c8a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/backend/src/utils/catalogUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ describe('sanitize', () => {
readme: '',
recommended: ['hf.instructlab.granite-7b-lab-GGUF', 'hf.instructlab.merlinite-7b-lab-GGUF'],
backend: 'llama-cpp',
language: 'lang1',
frameworks: ['fw1'],
},
],
models: [
Expand All @@ -168,6 +170,8 @@ describe('sanitize', () => {
expect(catalog.version).equals(CatalogFormat.CURRENT);
expect(catalog.models[0].backend).toBeUndefined();
expect(catalog.models[0].name).equals('Mistral-7B-Instruct-v0.3-Q4_K_M');
expect(catalog.recipes[0].language).equals('lang1');
expect(catalog.recipes[0].frameworks).toStrictEqual(['fw1']);
});
});

Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/utils/catalogUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ export function sanitizeRecipe(recipe: unknown): Recipe {
basedir: 'basedir' in recipe && typeof recipe.basedir === 'string' ? recipe.basedir : undefined,
recommended: 'recommended' in recipe && isStringArray(recipe.recommended) ? recipe.recommended : undefined,
backend: 'backend' in recipe && typeof recipe.backend === 'string' ? recipe.backend : undefined,
language: 'language' in recipe && typeof recipe.language === 'string' ? recipe.language : undefined,
frameworks: 'frameworks' in recipe && isStringArray(recipe.frameworks) ? recipe.frameworks : undefined,
};
throw new Error('invalid recipe format');
}
Expand Down

0 comments on commit c51c8a0

Please sign in to comment.