MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / newProvider

Function newProvider

main.go:272–283  ·  view source on GitHub ↗

newProvider picks the initial provider at startup, honoring $LLM_PROVIDER and $LLM_MODEL as optional defaults. Mid-session swaps go through the provider slash command instead.

(sysPrompt string)

Source from the content-addressed store, hash-verified

270// and $LLM_MODEL as optional defaults. Mid-session swaps go through the
271// /provider slash command instead.
272func newProvider(sysPrompt string) provider.Provider {
273 name := os.Getenv("LLM_PROVIDER")
274 if name == "" {
275 name = "anthropic"
276 }
277 p, err := newProviderByName(name, os.Getenv("LLM_MODEL"), sysPrompt)
278 if err != nil {
279 fmt.Fprintf(os.Stderr, "provider: %v (falling back to anthropic)\n", err)
280 p, _ = newProviderByName("anthropic", "", sysPrompt)
281 }
282 return p
283}
284
285// newProviderByName constructs a provider by short name. An empty model
286// string falls back to that provider's default. Unknown names error.

Callers 1

mainFunction · 0.85

Calls 1

newProviderByNameFunction · 0.85

Tested by

no test coverage detected