parse static method

AiProviderKind parse(
  1. String? value
)

Parses the provider: key.

Implementation

static AiProviderKind parse(String? value) {
  switch (value?.toLowerCase().trim()) {
    case 'anthropic':
    case 'claude':
      return AiProviderKind.anthropic;
    case null:
    case '':
    case 'openai':
    case 'openai-compatible':
      return AiProviderKind.openai;
    default:
      throw ArgumentError(
        "Invalid ai provider '$value'. Expected 'openai' or 'anthropic'.",
      );
  }
}