resolvePiBackend extracts the provider prefix from the engine model (if any) and maps it to the matching UniversalLLMBackend. A model without a slash (e.g. "claude-sonnet-4") defaults to the GitHub (Copilot) backend for backward compatibility. "github-copilot/" is accepted as an alias for "copilot
(workflowData *WorkflowData)
| 70 | // "github-copilot/" is accepted as an alias for "copilot/" since that is the |
| 71 | // provider name used by Pi CLI's built-in model registry. |
| 72 | func resolvePiBackend(workflowData *WorkflowData) UniversalLLMBackend { |
| 73 | if workflowData == nil || workflowData.EngineConfig == nil || workflowData.EngineConfig.Model == "" { |
| 74 | return UniversalLLMBackendCopilot |
| 75 | } |
| 76 | model := workflowData.EngineConfig.Model |
| 77 | if !strings.Contains(model, "/") { |
| 78 | // No provider prefix — default to Copilot (backward compatibility). |
| 79 | return UniversalLLMBackendCopilot |
| 80 | } |
| 81 | // "github-copilot" is Pi CLI's internal name for GitHub Copilot. Accept it as |
| 82 | // an alias so workflows can use either "copilot/..." or "github-copilot/...". |
| 83 | backend, err := resolveBackendWithAliases(model, map[string]UniversalLLMBackend{ |
| 84 | "github-copilot": UniversalLLMBackendCopilot, |
| 85 | }) |
| 86 | if err != nil { |
| 87 | piLog.Printf("Could not resolve backend for Pi model %q, defaulting to copilot: %v", model, err) |
| 88 | return UniversalLLMBackendCopilot |
| 89 | } |
| 90 | return backend |
| 91 | } |
| 92 | |
| 93 | // extractPiModelID returns the model ID portion of a provider/model string. |
| 94 | // For "copilot/claude-sonnet-4" it returns "claude-sonnet-4". |
no test coverage detected