MCPcopy Create free account
hub / github.com/simstudioai/sim / buildProviderFaqs

Function buildProviderFaqs

apps/sim/app/(landing)/models/utils.ts:658–716  ·  view source on GitHub ↗
(provider: CatalogProvider)

Source from the content-addressed store, hash-verified

656}
657
658export function buildProviderFaqs(provider: CatalogProvider): CatalogFaq[] {
659 const cheapestModel = getCheapestProviderModel(provider)
660 const largestContextModel = getLargestContextProviderModel(provider)
661
662 const toolUseModels = provider.models.filter(
663 (m) =>
664 m.capabilities.toolUsageControl !== undefined ||
665 provider.providerCapabilityTags.includes('Tool Use')
666 )
667
668 const faqs: CatalogFaq[] = [
669 {
670 question: `What ${provider.name} models are available in Sim?`,
671 answer: `Sim currently tracks ${provider.modelCount} ${provider.name} model${provider.modelCount === 1 ? '' : 's'} including ${provider.models
672 .slice(0, 6)
673 .map((model) => model.displayName)
674 .join(', ')}${provider.modelCount > 6 ? ', and more' : ''}.`,
675 },
676 {
677 question: `What is the default ${provider.name} model in Sim?`,
678 answer: provider.defaultModel
679 ? `${provider.defaultModelDisplayName} is the default ${provider.name} model in Sim.`
680 : `${provider.name} does not have a fixed default model in the public catalog because models are loaded dynamically.`,
681 },
682 {
683 question: `What is the cheapest ${provider.name} model tracked in Sim?`,
684 answer: cheapestModel
685 ? `${cheapestModel.displayName} currently has the lowest listed input price at ${formatPrice(
686 cheapestModel.pricing.input
687 )}/1M tokens.`
688 : `Sim does not currently expose a fixed public pricing table for ${provider.name} models on this page.`,
689 },
690 {
691 question: `Which ${provider.name} model has the largest context window?`,
692 answer: largestContextModel?.contextWindow
693 ? `${largestContextModel.displayName} currently has the largest listed context window at ${formatTokenCount(
694 largestContextModel.contextWindow
695 )} tokens.`
696 : `Context window details are not fully available for every ${provider.name} model in the public catalog.`,
697 },
698 ]
699
700 if (toolUseModels.length > 0) {
701 faqs.push({
702 question: `Which ${provider.name} models support tool use and function calling in Sim?`,
703 answer:
704 toolUseModels.length === provider.modelCount
705 ? `All ${provider.name} models in Sim support tool use and function calling, allowing agents to invoke external APIs, query databases, and run custom actions.`
706 : `${toolUseModels
707 .slice(0, 5)
708 .map((m) => m.displayName)
709 .join(
710 ', '
711 )}${toolUseModels.length > 5 ? ', and others' : ''} support tool use and function calling in Sim, enabling agents to invoke external APIs and run custom actions.`,
712 })
713 }
714
715 return faqs

Callers 2

generateMetadataFunction · 0.90
ProviderModelsPageFunction · 0.90

Calls 6

getCheapestProviderModelFunction · 0.85
formatPriceFunction · 0.85
joinMethod · 0.80
formatTokenCountFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected