Skip to content

v0.x: chat defaults in the manifest, and the fallback chain is the module's

Spec 0196 phase 1. Runtime behaviour changes for a tool that sets the affected keys; nothing changes for one that does not.

What changed

  • ai.model, ai.base_url, ai.api_version, ai.project and ai.location are runtime keys. chat.SettingsFromProps fills the matching chat.Config fields from them when the caller left them empty. Before, only ai.provider and ai.request_timeout were read, and ai.model was a key the generator alone used. A tool whose config already set ai.model for the generator now also pins its own chat model to that value.
  • The fallback chain is built by go/chat's NewWithFallbackSettings. GTB's fallbackProviderConfigs, perProviderConfig and warnFallbackPrimaryOverride are gone. The primary keeps the model and addressing configured for it (GTB's copy cleared them); every other member resolves its own, and GTB hands each its credential through WithProviderCredentials.
  • A credential root for Azure OpenAI (azure.api.*, fallback AZURE_OPENAI_API_KEY) and Gemini Vertex (sharing gemini.api.*). chat.NeedsCredential(p) replaces call-site IsLocalCLI checks that meant "carries no GTB credential", and now also covers bedrock.
  • The manifest records chat.default (provider, model, base_url, api_version, project, location) and gtb generate project gains --chat-default-provider, --chat-default-model, --chat-base-url, --chat-api-version, --chat-project, --chat-location. Several linked providers require a named default; one is its own.
  • A generated tool ships the default as cmd/<name>/chat/assets/config.yaml (embedded defaults) and cmd/<name>/chat/assets/init/config.yaml (init template), registered by chat.go. Both are rewritten by regenerate.

Phase 2, same release

  • No vendor default. chat.SettingsFromProps returns chat.ErrProviderUnset (with a hint naming ai.provider and init ai) when no provider is set in the caller's Config, in config, or in AI_PROVIDER. It used to default to Claude; docs.ResolveProvider used to default to OpenAI and now returns empty. A tool that relied on the silent Claude default sets ai.provider in its embedded defaults (the generator's chat.default does this) or its users run init ai. gtb itself seeds ai.provider: claude from its init template.
  • init ai offers every provider the framework knows, from chat.ProviderDisplays(), and skips the credential forms for a provider that carries none. Its per-provider key switches are gone in favour of chat.CredentialKeysFor. IsAIConfigured accepts any known provider and counts an env-var or keychain reference as configured, not only a literal.
  • The wizard has an AI page with the default-provider select and model, plus endpoint and cloud-addressing pages shown only for the providers that need them. The --provider help on docs and on gtb generate lists every provider.

Phase 3, same release: only what is linked

  • go/chat v0.24.0 for ProviderRegistered, RegisteredProviders and ErrProviderNotRegistered. The adapter's "add this import" hint matches the sentinel with errors.Is instead of the message text.
  • A tool that links exactly one provider needs no ai.provider: the registry rung fills it. With several linked and nothing set, the ErrProviderUnset hint lists them.
  • init ai offers only the providers the binary registers and refuses one it does not, naming the module. A binary registering none is offered the whole table.
  • doctor: new Chat providers check (ai.provider and every fallback member registered, else the module to import); API keys removed. The credential resolution check reports a chat credential only when one of the providers it serves is linked. credentialposture.ReportEnabled (added in the same release) is replaced by ReportWhere(ctx, cfg, func(Descriptor) bool), and Descriptor gains Providers.

What to do

  • A project that links several providers: on the next regenerate project the run warns names no default. Add chat.default.provider to the manifest and regenerate; until then the tool ships without an author default.
  • A project that links one provider: nothing. Regenerate derives the default and writes the bundle.
  • A hand-wired tool that called the removed helpers: call chat.NewWithFallbackFromProps, or the module's NewWithFallbackSettings directly.