Fix deprecation warning for old model format (#1625)

Merged
MI
10mo ago
+217-5

why

The legacy model format is getting deprecated. Encouraging the model definition as:

model: "{provider}/{model}"
// or 
model: {
   modelName:"{provider}/{model}",
   apiKey: "sk-tortilla-...."
}

what changed

  • Always log a deprecation warning for legacy model names; suggest provider/model format (e.g., "openai/gpt-5", "anthropic/claude-sonnet-4").
  • Preserve legacy model routing to OpenAI/Anthropic clients; provide clearer errors for invalid providers.

test plan


Summary by cubic

Add a level-0 deprecation warning for legacy model names without a provider (e.g., "gpt-4o") while keeping them functional. Improve error messages to guide users to the provider/model format with examples, and add tests for the new behavior.

  • New Features

    • Always log a deprecation warning for legacy model names; suggest provider/model format (e.g., "openai/gpt-5", "anthropic/claude-sonnet-4").
    • Update UnsupportedModelError to list supported models and include provider/model guidance with examples.
    • Preserve legacy model routing to OpenAI/Anthropic clients; provide clearer errors for invalid providers.
  • Migration

    • Use provider/model strings going forward (e.g., "openai/gpt-4o", "anthropic/claude-sonnet-4").
    • No breaking changes; legacy names still work for now.