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.

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.