001/* 002 * Copyright (c) 2026, Oracle and/or its affiliates. 003 * 004 * Licensed under the Universal Permissive License Version 1.0 as shown at 005 * https://oss.oracle.com/licenses/upl/ 006 */ 007package com.oracle.database.selectai.model; 008 009import java.util.Arrays; 010 011/** 012 * Supported Select AI provider identifiers accepted by profile attributes. 013 * 014 * @see <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/select-ai-manage-profiles.html"> 015 * Select AI profile provider configuration</a> 016 */ 017public enum Provider { 018 /** OpenAI provider. */ 019 openai, 020 /** Cohere provider. */ 021 cohere, 022 /** Azure OpenAI provider. */ 023 azure, 024 /** OCI Generative AI provider. */ 025 oci, 026 /** Google provider. */ 027 google, 028 /** Anthropic provider. */ 029 anthropic, 030 /** Hugging Face provider. */ 031 huggingface, 032 /** AWS Bedrock provider. */ 033 aws; 034 035 /** 036 * Parses a provider name using case-insensitive matching. 037 * 038 * @param value provider name from user input or database attributes 039 * @return matching provider enum constant, or {@code null} when input is null/blank 040 */ 041 public static Provider fromValue(String value) { 042 if (value == null || value.isBlank()) { 043 return null; 044 } 045 return Arrays.stream(values()) 046 .filter(provider -> provider.name().equalsIgnoreCase(value)) 047 .findFirst() 048 .orElseThrow(() -> new IllegalArgumentException("Unsupported provider: " + value)); 049 } 050}