Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions clients/ui/bff/internal/mocks/static_data_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func GetCatalogModelMocks() []models.CatalogModel {
Description: stringToPointer("Granite-8B-Code-Instruct is a 8B parameter model fine tuned from\nGranite-8B-Code-Base on a combination of permissively licensed instruction\ndata to enhance instruction following capabilities including logical\nreasoning and problem-solving skills."),
Provider: stringToPointer("provider1"),
Tasks: []string{"text-generation", "image-to-text"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
LicenseLink: stringToPointer("https://www.apache.org/licenses/LICENSE-2.0.txt"),
Maturity: stringToPointer("Technology preview"),
Language: []string{"ar", "cs", "de", "en", "es", "fr", "it", "ja", "ko", "nl", "pt", "zh"},
Expand Down Expand Up @@ -716,7 +716,7 @@ Granite 3.1 Instruct Models are primarily finetuned using instruction-response p
Description: stringToPointer("Granite 8B Code Instruct - INT4 quantized variant for efficient inference"),
Provider: stringToPointer("Provider one"),
Tasks: []string{"text-generation", "image-text-to-text"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
Maturity: stringToPointer("Generally Available"),
Language: []string{"en"},
SourceId: stringToPointer("sample-source"),
Expand All @@ -729,7 +729,7 @@ Granite 3.1 Instruct Models are primarily finetuned using instruction-response p
Description: stringToPointer("Granite 8B Code Instruct - INT8 quantized variant for balanced performance"),
Provider: stringToPointer("IBM"),
Tasks: []string{"audio-to-text", "text-to-text", "video-to-text"},
License: stringToPointer("mit"),
License: stringToPointer("MIT"),
Maturity: stringToPointer("Generally Available"),
Language: []string{"en"},
SourceId: stringToPointer("sample-source"),
Expand All @@ -742,7 +742,7 @@ Granite 3.1 Instruct Models are primarily finetuned using instruction-response p
Description: stringToPointer("Granite 8B Code Instruct - BF16 variant for high precision"),
Provider: stringToPointer("IBM"),
Tasks: []string{"text-generation", "code-generation"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
Maturity: stringToPointer("Generally Available"),
Language: []string{"en"},
SourceId: stringToPointer("sample-source"),
Expand All @@ -755,7 +755,7 @@ Granite 3.1 Instruct Models are primarily finetuned using instruction-response p
Description: stringToPointer("BERT base model (uncased) - Pretrained model on English language"),
Provider: stringToPointer("Google"),
Tasks: []string{"audio-to-text", "text-to-text"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
Maturity: stringToPointer("Generally Available"),
Language: []string{"en"},
SourceId: stringToPointer("huggingface"),
Expand Down Expand Up @@ -796,7 +796,7 @@ python -c "from transformers import pipeline; nlp = pipeline('fill-mask', model=
Description: stringToPointer("GPT-2 is a transformers model pretrained on a very large corpus of English data"),
Provider: stringToPointer("provider3"),
Tasks: []string{"video-to-text"},
License: stringToPointer("mit"),
License: stringToPointer("MIT"),
Maturity: stringToPointer("Generally Available"),
Language: []string{"en"},
SourceId: stringToPointer("huggingface"),
Expand All @@ -808,7 +808,7 @@ python -c "from transformers import pipeline; nlp = pipeline('fill-mask', model=
Description: stringToPointer("DistilBERT base model (uncased) - A smaller, faster version of BERT"),
Provider: stringToPointer("Hugging Face"),
Tasks: []string{"fill-mask", "text-classification"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
Maturity: stringToPointer("Generally Available"),
Language: []string{"en"},
SourceId: stringToPointer("huggingface"),
Expand All @@ -820,7 +820,7 @@ python -c "from transformers import pipeline; nlp = pipeline('fill-mask', model=
Description: stringToPointer("sample description"),
Provider: stringToPointer("Admin model 1"),
Tasks: []string{"code-generation", "instruction-following"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
Maturity: stringToPointer("Generally Available"),
Language: []string{"en"},
SourceId: stringToPointer("adminModel2"),
Expand All @@ -831,7 +831,7 @@ python -c "from transformers import pipeline; nlp = pipeline('fill-mask', model=
Description: stringToPointer("sample description"),
Provider: stringToPointer("Admin model 2"),
Tasks: []string{"text-generation", "conversational"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
Maturity: stringToPointer("Generally Available"),
Language: []string{"en"},
SourceId: stringToPointer("adminModel1"),
Expand All @@ -842,7 +842,7 @@ python -c "from transformers import pipeline; nlp = pipeline('fill-mask', model=
Description: stringToPointer("Model without performance data"),
Provider: stringToPointer("Test Provider"),
Tasks: []string{"text-generation"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
Language: []string{"en"},
SourceId: stringToPointer("no-perf-source"),
}
Expand All @@ -855,7 +855,7 @@ python -c "from transformers import pipeline; nlp = pipeline('fill-mask', model=
Description: stringToPointer("Granite-8B-Code-Instruct is a 8B parameter model fine tuned from\nGranite-8B-Code-Base on a combination of permissively licensed instruction\ndata to enhance instruction following capabilities including logical\nreasoning and problem-solving skills."),
Provider: stringToPointer("provider1"),
Tasks: []string{"text-generation"},
License: stringToPointer("apache-2.0"),
License: stringToPointer("Apache 2.0"),
LicenseLink: stringToPointer("https://www.apache.org/licenses/LICENSE-2.0.txt"),
Maturity: stringToPointer("Technology preview"),
Language: []string{"ar", "cs", "de", "en", "es", "fr", "it", "ja", "ko", "nl", "pt", "zh"},
Expand Down Expand Up @@ -1711,7 +1711,7 @@ func GetFilterOptionMocks() map[string]models.FilterOption {
Values: []interface{}{
"Apache 2.0", "Gemma License", "Llama 3.1 Community License",
"Llama 3.3 Community License", "Llama 4 Community License", "MIT",
"NVIDIA Open Model License", "modified-mit",
"NVIDIA Open Model License", "Modified MIT",
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { CatalogFilterOptionsList, NamedQuery, FilterOperator } from '~/app/mode
import {
ModelCatalogStringFilterKey,
ModelCatalogNumberFilterKey,
ModelCatalogLicense,
ModelCatalogProvider,
ModelCatalogTask,
AllLanguageCode,
Expand Down Expand Up @@ -70,7 +69,7 @@ export const mockCatalogFilterOptionsList = (
},
[ModelCatalogStringFilterKey.LICENSE]: {
type: 'string',
values: [ModelCatalogLicense.APACHE_2_0, ModelCatalogLicense.MIT],
values: ['Apache 2.0', 'MIT'],
},
[ModelCatalogStringFilterKey.TASK]: {
type: 'string',
Expand Down
5 changes: 2 additions & 3 deletions clients/ui/frontend/src/app/modelCatalogTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { APIOptions } from 'mod-arch-core';
import {
ModelCatalogTask,
ModelCatalogProvider,
ModelCatalogLicense,
AllLanguageCode,
ModelCatalogStringFilterKey,
ModelCatalogNumberFilterKey,
Expand Down Expand Up @@ -283,7 +282,7 @@ export type { ModelCatalogFilterKey };
export type ModelCatalogStringFilterValueType = {
[ModelCatalogStringFilterKey.TASK]: ModelCatalogTask;
[ModelCatalogStringFilterKey.PROVIDER]: ModelCatalogProvider;
[ModelCatalogStringFilterKey.LICENSE]: ModelCatalogLicense;
[ModelCatalogStringFilterKey.LICENSE]: string;
[ModelCatalogStringFilterKey.LANGUAGE]: AllLanguageCode;
[ModelCatalogStringFilterKey.TENSOR_TYPE]: ModelCatalogTensorType;
[ModelCatalogStringFilterKey.HARDWARE_TYPE]: string;
Expand Down Expand Up @@ -349,7 +348,7 @@ export type ComputedPerformanceProperties = {
export type ModelCatalogFilterStates = {
[ModelCatalogStringFilterKey.TASK]: ModelCatalogTask[];
[ModelCatalogStringFilterKey.PROVIDER]: ModelCatalogProvider[];
[ModelCatalogStringFilterKey.LICENSE]: ModelCatalogLicense[];
[ModelCatalogStringFilterKey.LICENSE]: string[];
[ModelCatalogStringFilterKey.LANGUAGE]: AllLanguageCode[];
[ModelCatalogStringFilterKey.TENSOR_TYPE]: ModelCatalogTensorType[];
[ModelCatalogStringFilterKey.HARDWARE_TYPE]: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import { ModelCatalogContext } from '~/app/context/modelCatalog/ModelCatalogCont
import {
ModelCatalogStringFilterKey,
MODEL_CATALOG_PROVIDER_NAME_MAPPING,
MODEL_CATALOG_LICENSE_NAME_MAPPING,
MODEL_CATALOG_TASK_NAME_MAPPING,
AllLanguageCodesMap,
MODEL_CATALOG_FILTER_CATEGORY_NAMES,
MODEL_CATALOG_FILTER_CHIP_PREFIXES,
ModelCatalogProvider,
ModelCatalogLicense,
ModelCatalogTask,
AllLanguageCode,
ModelCatalogNumberFilterKey,
Expand Down Expand Up @@ -97,9 +95,7 @@ const ModelCatalogActiveFilters: React.FC<ModelCatalogActiveFiltersProps> = ({ f
: valueStr;
}
case ModelCatalogStringFilterKey.LICENSE: {
return isEnumMember(valueStr, ModelCatalogLicense)
? MODEL_CATALOG_LICENSE_NAME_MAPPING[valueStr]
: valueStr;
return valueStr;
}
case ModelCatalogStringFilterKey.TASK: {
return isEnumMember(valueStr, ModelCatalogTask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ function isFilterMappingKey<K extends string>(obj: Partial<Record<K, string>>, s
type ModelCatalogStringFilterProps<K extends ModelCatalogStringFilterKey> = {
title: string;
filterKey: K;
filterToNameMapping: Partial<Record<ModelCatalogStringFilterValueType[K], string>>;
filterToNameMapping?: Partial<Record<ModelCatalogStringFilterValueType[K], string>>;
filters: ModelCatalogStringFilterOptions[K];
};

const ModelCatalogStringFilter = <K extends ModelCatalogStringFilterKey>({
title,
filterKey,
filterToNameMapping,
filterToNameMapping = {},
filters,
}: ModelCatalogStringFilterProps<K>): JSX.Element => {
const { filterData } = React.useContext(ModelCatalogContext);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import * as React from 'react';
import { Divider, StackItem } from '@patternfly/react-core';
import ModelCatalogStringFilter from '~/app/pages/modelCatalog/components/ModelCatalogStringFilter';
import {
ModelCatalogStringFilterKey,
MODEL_CATALOG_LICENSE_NAME_MAPPING,
} from '~/concepts/modelCatalog/const';
import { ModelCatalogStringFilterKey } from '~/concepts/modelCatalog/const';
import { CatalogFilterOptions, ModelCatalogStringFilterOptions } from '~/app/modelCatalogTypes';

const filterKey = ModelCatalogStringFilterKey.LICENSE;
Expand All @@ -26,7 +23,6 @@ const LicenseFilter: React.FC<LicenseFilterProps> = ({ filters }) => {
<ModelCatalogStringFilter<ModelCatalogStringFilterKey.LICENSE>
title="License"
filterKey={filterKey}
filterToNameMapping={MODEL_CATALOG_LICENSE_NAME_MAPPING}
filters={license}
/>
</StackItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from '~/app/modelCatalogTypes';
import {
AllLanguageCode,
ModelCatalogLicense,
ModelCatalogNumberFilterKey,
ModelCatalogProvider,
ModelCatalogStringFilterKey,
Expand Down Expand Up @@ -52,7 +51,7 @@ describe('filtersToFilterQuery', () => {
ttft_mean = undefined,
}: {
tasks?: ModelCatalogTask[];
license?: ModelCatalogLicense[];
license?: string[];
provider?: ModelCatalogProvider[];
language?: AllLanguageCode[];
hardware_type?: string[];
Expand Down Expand Up @@ -107,16 +106,7 @@ describe('filtersToFilterQuery', () => {
},
[ModelCatalogStringFilterKey.LICENSE]: {
type: 'string',
values: [
ModelCatalogLicense.APACHE_2_0,
ModelCatalogLicense.GEMMA,
ModelCatalogLicense.LLLAMA_3_3,
ModelCatalogLicense.LLLAMA_3_1,
ModelCatalogLicense.LLLAMA_3_3_ALTERNATE,
ModelCatalogLicense.LLLAMA_4,
ModelCatalogLicense.MIT,
ModelCatalogLicense.MODIFIED_MIT,
],
values: ['Apache 2.0', 'Gemma', 'Llama 3.3', 'Llama 3.1', 'Llama 4', 'MIT', 'Modified MIT'],
},
[ModelCatalogStringFilterKey.LANGUAGE]: {
type: 'string',
Expand Down Expand Up @@ -233,11 +223,8 @@ describe('filtersToFilterQuery', () => {
),
).toBe("provider='Google'");
expect(
filtersToFilterQuery(
mockFormData({ license: [ModelCatalogLicense.APACHE_2_0] }),
mockFilterOptions,
),
).toBe("license='apache-2.0'");
filtersToFilterQuery(mockFormData({ license: ['Apache 2.0'] }), mockFilterOptions),
).toBe("license='Apache 2.0'");
expect(
filtersToFilterQuery(mockFormData({ language: [AllLanguageCode.CA] }), mockFilterOptions),
).toBe("language='ca'");
Expand All @@ -260,11 +247,11 @@ describe('filtersToFilterQuery', () => {
filtersToFilterQuery(
mockFormData({
tasks: [ModelCatalogTask.TEXT_TO_TEXT],
license: [ModelCatalogLicense.APACHE_2_0],
license: ['Apache 2.0'],
}),
mockFilterOptions,
),
).toBe("tasks='text-to-text' AND license='apache-2.0'");
).toBe("tasks='text-to-text' AND license='Apache 2.0'");
expect(
filtersToFilterQuery(
mockFormData({ provider: [ModelCatalogProvider.GOOGLE], language: [AllLanguageCode.CA] }),
Expand All @@ -287,11 +274,8 @@ describe('filtersToFilterQuery', () => {
),
).toBe("provider IN ('Google','DeepSeek')");
expect(
filtersToFilterQuery(
mockFormData({ license: [ModelCatalogLicense.APACHE_2_0, ModelCatalogLicense.MIT] }),
mockFilterOptions,
),
).toBe("license IN ('apache-2.0','mit')");
filtersToFilterQuery(mockFormData({ license: ['Apache 2.0', 'MIT'] }), mockFilterOptions),
).toBe("license IN ('Apache 2.0','MIT')");
expect(
filtersToFilterQuery(
mockFormData({ language: [AllLanguageCode.CA, AllLanguageCode.PT] }),
Expand Down Expand Up @@ -330,7 +314,7 @@ describe('filtersToFilterQuery', () => {
mockFormData({
tasks: [ModelCatalogTask.TEXT_TO_TEXT, ModelCatalogTask.IMAGE_TO_TEXT],
provider: [ModelCatalogProvider.GOOGLE],
license: [ModelCatalogLicense.MIT],
license: ['MIT'],
language: [
AllLanguageCode.CA,
AllLanguageCode.PT,
Expand All @@ -341,7 +325,7 @@ describe('filtersToFilterQuery', () => {
mockFilterOptions,
),
).toBe(
"tasks IN ('text-to-text','image-to-text') AND provider='Google' AND license='mit' AND language IN ('ca','pt','vi','zsm')",
"tasks IN ('text-to-text','image-to-text') AND provider='Google' AND license='MIT' AND language IN ('ca','pt','vi','zsm')",
);
});

Expand Down Expand Up @@ -385,13 +369,13 @@ describe('filtersToFilterQuery', () => {
// mockFormData({
// ttft_mean: 100,
// tasks: [ModelCatalogTask.TEXT_TO_TEXT],
// license: [ModelCatalogLicense.APACHE_2_0, ModelCatalogLicense.MIT],
// license: ['Apache 2.0', 'MIT'],
// rps_mean: 3,
// }),
// mockFilterOptions,
// ),
// ).toBe(
// "tasks='text-to-text' AND license IN ('apache-2.0','mit') AND ttft_mean < 100 AND rps_mean > 3",
// "tasks='text-to-text' AND license IN ('Apache 2.0','MIT') AND ttft_mean < 100 AND rps_mean > 3",
// );
// });
// });
Expand Down Expand Up @@ -815,7 +799,7 @@ describe('hasFiltersApplied', () => {
ttft_mean = undefined,
}: {
tasks?: ModelCatalogTask[];
license?: ModelCatalogLicense[];
license?: string[];
provider?: ModelCatalogProvider[];
language?: AllLanguageCode[];
hardware_type?: string[];
Expand Down Expand Up @@ -870,7 +854,7 @@ describe('hasFiltersApplied', () => {
expect(hasFiltersApplied(mockFormData({ provider: [ModelCatalogProvider.GOOGLE] }))).toBe(
true,
);
expect(hasFiltersApplied(mockFormData({ license: [ModelCatalogLicense.MIT] }))).toBe(true);
expect(hasFiltersApplied(mockFormData({ license: ['MIT'] }))).toBe(true);
expect(hasFiltersApplied(mockFormData({ language: [AllLanguageCode.EN] }))).toBe(true);
expect(hasFiltersApplied(mockFormData({ hardware_type: ['GPU'] }))).toBe(true);
expect(hasFiltersApplied(mockFormData({ use_case: [UseCaseOptionValue.CHATBOT] }))).toBe(
Expand Down
Loading
Loading