44.5 Model/provider change management

Overview and links for this section of the guide.

Vendor Risks

  • API changes: Breaking changes to response format
  • Deprecation: Model version sunset
  • Pricing: Cost increases
  • Outages: Service unavailability
  • Policy: ToS changes affecting your use case

Abstraction Layer

// model-abstraction.ts
interface LLMProvider {
  name: string;
  generate(prompt: string, config: GenerateConfig): Promise;
}

class GeminiProvider implements LLMProvider {
  name = 'gemini';
  // Gemini-specific implementation
}

class OpenAIProvider implements LLMProvider {
  name = 'openai';
  // OpenAI-specific implementation
}

// Switch providers without changing app code
const provider = process.env.LLM_PROVIDER === 'openai' 
  ? new OpenAIProvider()
  : new GeminiProvider();

// Your app only calls:
await provider.generate(prompt, config);

Migration Checklist

## Provider Migration Checklist

### Before Migration
- [ ] Run full eval suite on new provider
- [ ] Compare accuracy scores
- [ ] Compare latency metrics
- [ ] Calculate cost difference

### During Migration
- [ ] Start with 5% traffic
- [ ] Monitor error rates
- [ ] Monitor user feedback
- [ ] Gradually increase traffic

### After Migration
- [ ] Deprecate old provider code
- [ ] Update documentation
- [ ] Update on-call runbooks

Where to go next