MCPcopy Create free account
hub / github.com/github/gh-aw / resolveBackendWithAliases

Function resolveBackendWithAliases

pkg/workflow/universal_llm_consumer_engine.go:183–196  ·  view source on GitHub ↗

resolveBackendWithAliases is like resolveUniversalLLMBackendFromModel but also recognises extra provider name prefixes before falling back to the standard lookup. extraAliases maps lowercased provider names (the prefix before the first "/") to the corresponding UniversalLLMBackend. This lets engines

(model string, extraAliases map[string]UniversalLLMBackend)

Source from the content-addressed store, hash-verified

181// UniversalLLMBackend. This lets engines that expose their own provider naming (e.g. Pi's
182// "github-copilot") reuse the shared backend resolution logic without special-casing.
183func resolveBackendWithAliases(model string, extraAliases map[string]UniversalLLMBackend) (UniversalLLMBackend, error) {
184 if len(extraAliases) > 0 {
185 model = strings.TrimSpace(model)
186 parts := strings.SplitN(model, "/", 2)
187 if len(parts) == 2 {
188 provider := strings.ToLower(strings.TrimSpace(parts[0]))
189 if backend, ok := extraAliases[provider]; ok {
190 universalLLMConsumerLog.Printf("Resolved backend via alias %q → %s", provider, backend)
191 return backend, nil
192 }
193 }
194 }
195 return resolveUniversalLLMBackendFromModel(model)
196}
197
198// UniversalCLIEngineExecutionConfig holds the engine-specific parameters for
199// BuildCLIEngineExecutionSteps. Engines that share the same execution pattern

Callers 1

resolvePiBackendFunction · 0.85

Calls 3

ToLowerMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected