MCPcopy
hub / github.com/simstudioai/sim / buildPiFallbackModel

Function buildPiFallbackModel

apps/sim/executor/handlers/pi/local-backend.ts:82–92  ·  view source on GitHub ↗

* Builds a model definition for a provider Pi supports but whose bundled catalog * doesn't list this exact id (e.g. a newer model Pi wires to a different * provider). Mirrors the cloud CLI's passthrough: clone one of the provider's * models as a template, swap in the requested id, and force reaso

(
  modelRegistry: ModelRegistry,
  provider: string,
  modelId: string,
  thinkingLevel: ReturnType<typeof mapThinkingLevel>
)

Source from the content-addressed store, hash-verified

80 * models at all, so even passthrough can't route it.
81 */
82function buildPiFallbackModel(
83 modelRegistry: ModelRegistry,
84 provider: string,
85 modelId: string,
86 thinkingLevel: ReturnType<typeof mapThinkingLevel>
87) {
88 const providerModels = modelRegistry.getAll().filter((m) => m.provider === provider)
89 if (providerModels.length === 0) return undefined
90 const fallback = { ...providerModels[0], id: modelId, name: modelId }
91 return thinkingLevel && thinkingLevel !== 'off' ? { ...fallback, reasoning: true } : fallback
92}
93
94export const runLocalPi: PiBackendRun<PiLocalRunParams> = async (params, context) => {
95 // Isolate Pi resource discovery: an empty cwd/agentDir keeps DefaultResourceLoader

Callers 1

runLocalPiFunction · 0.85

Calls 1

getAllMethod · 0.80

Tested by

no test coverage detected