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
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import {
MODEL_CATALOG_PROVIDERS,
} from '@/app/(landing)/models/utils'

/** Providers that host other providers' models - deprioritized to avoid duplicates. */
const RESELLER_PROVIDERS = new Set(
MODEL_CATALOG_PROVIDERS.flatMap((p) => (p.isReseller ? [p.id] : []))
)
/** Flagship providers featured in the landing-page comparison, in display order. */
const FEATURED_COMPARISON_PROVIDER_IDS = ['anthropic', 'openai', 'google']

/** Max latest models pulled from each featured provider. */
const MAX_MODELS_PER_PROVIDER = 4

const PROVIDER_ICON_MAP: Record<string, ComponentType<{ className?: string }>> = (() => {
const map: Record<string, ComponentType<{ className?: string }>> = {}
Expand All @@ -27,22 +28,22 @@ function selectComparisonModels(models: CatalogModel[]): CatalogModel[] {
const seen = new Set<string>()
const result: CatalogModel[] = []

const sorted = [...models].sort((a, b) => {
const score = (m: CatalogModel) => {
const reseller = RESELLER_PROVIDERS.has(m.providerId) ? -50 : 0
const reasoning = m.capabilities.reasoningEffort || m.capabilities.thinking ? 10 : 0
const context = (m.contextWindow ?? 0) / 100000
return reseller + reasoning + context
for (const providerId of FEATURED_COMPARISON_PROVIDER_IDS) {
const providerModels = models
.filter((model) => model.providerId === providerId && !model.deprecated)
.sort((a, b) => (b.releaseDate ?? '').localeCompare(a.releaseDate ?? ''))

let takenForProvider = 0
for (const model of providerModels) {
if (takenForProvider >= MAX_MODELS_PER_PROVIDER) break

const nameKey = model.displayName.toLowerCase()
if (seen.has(nameKey)) continue

seen.add(nameKey)
result.push(model)
takenForProvider += 1
}
return score(b) - score(a)
})

for (const model of sorted) {
if (result.length >= 10) break
const nameKey = model.displayName.toLowerCase()
if (seen.has(nameKey)) continue
seen.add(nameKey)
result.push(model)
}

return result
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/(landing)/models/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export interface CatalogModel {
providerSlug: string
contextWindow: number | null
releaseDate: string | null
deprecated: boolean
pricing: PricingInfo
capabilities: ModelCapabilities
capabilityTags: string[]
Expand Down Expand Up @@ -482,6 +483,7 @@ const rawProviders = Object.values(PROVIDER_DEFINITIONS).map((provider) => {
providerSlug,
contextWindow: model.contextWindow ?? null,
releaseDate: model.releaseDate ?? null,
deprecated: model.deprecated ?? false,
pricing: model.pricing,
capabilities: mergedCapabilities,
capabilityTags,
Expand Down
Loading