|
| 1 | +package ai.koog.prompt.executor.clients.openai.azure |
| 2 | + |
| 3 | +import kotlin.jvm.JvmName |
| 4 | +import kotlin.jvm.JvmStatic |
| 5 | + |
| 6 | +/** |
| 7 | + * Represents the version of the Azure OpenAI Service. |
| 8 | + * |
| 9 | + * This class encapsulates the version string and provides a way to access predefined versions. |
| 10 | + * It also allows for easy comparison and retrieval of the latest stable and preview versions. |
| 11 | + * |
| 12 | + * @property value The version string of the Azure OpenAI Service. |
| 13 | + */ |
| 14 | +public class AzureOpenAIServiceVersion private constructor( |
| 15 | + @get:JvmName("value") public val value: String, |
| 16 | +) { |
| 17 | + |
| 18 | + /** |
| 19 | + * Companion object to hold predefined versions and utility methods. |
| 20 | + */ |
| 21 | + public companion object { |
| 22 | + |
| 23 | + private val values: MutableMap<String, AzureOpenAIServiceVersion> = |
| 24 | + mutableMapOf<String, AzureOpenAIServiceVersion>() |
| 25 | + |
| 26 | + |
| 27 | + /** |
| 28 | + * Returns the latest stable version of the Azure OpenAI Service. |
| 29 | + */ |
| 30 | + @JvmStatic |
| 31 | + public fun latestStableVersion(): AzureOpenAIServiceVersion { |
| 32 | + // We can update the value every general available(GA)/stable announcement. |
| 33 | + return V2024_10_21 |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Returns the latest preview version of the Azure OpenAI Service. |
| 38 | + */ |
| 39 | + @JvmStatic |
| 40 | + public fun latestPreviewVersion(): AzureOpenAIServiceVersion { |
| 41 | + // We can update the value every preview announcement. |
| 42 | + return V2025_03_01_PREVIEW |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * Creates an instance of [AzureOpenAIServiceVersion] from a version string. |
| 47 | + */ |
| 48 | + @JvmStatic |
| 49 | + public fun fromString(version: String): AzureOpenAIServiceVersion = |
| 50 | + values.getOrPut(version) { AzureOpenAIServiceVersion(version) } |
| 51 | + |
| 52 | + /** |
| 53 | + * Version 2022-12-01 of the Azure OpenAI Service. |
| 54 | + */ |
| 55 | + @JvmStatic |
| 56 | + public val V2022_12_01: AzureOpenAIServiceVersion = fromString("2022-12-01") |
| 57 | + |
| 58 | + /** |
| 59 | + * Version 2023-05-15 of the Azure OpenAI Service. |
| 60 | + */ |
| 61 | + @JvmStatic |
| 62 | + public val V2023_05_15: AzureOpenAIServiceVersion = fromString("2023-05-15") |
| 63 | + |
| 64 | + /** |
| 65 | + * Version 2024-02-01 of the Azure OpenAI Service. |
| 66 | + */ |
| 67 | + @JvmStatic |
| 68 | + public val V2024_02_01: AzureOpenAIServiceVersion = fromString("2024-02-01") |
| 69 | + |
| 70 | + /** |
| 71 | + * Version 2024-06-01 of the Azure OpenAI Service. |
| 72 | + */ |
| 73 | + @JvmStatic |
| 74 | + public val V2024_06_01: AzureOpenAIServiceVersion = fromString("2024-06-01") |
| 75 | + |
| 76 | + /** |
| 77 | + * Version 2024-10-21 of the Azure OpenAI Service. |
| 78 | + */ |
| 79 | + @JvmStatic |
| 80 | + public val V2024_10_21: AzureOpenAIServiceVersion = fromString("2024-10-21") |
| 81 | + |
| 82 | + /** |
| 83 | + * Version 2023-06-01-preview of the Azure OpenAI Service. |
| 84 | + */ |
| 85 | + @JvmStatic |
| 86 | + public val V2023_06_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2023-06-01-preview") |
| 87 | + |
| 88 | + /** |
| 89 | + * Version 2023-07-01-preview of the Azure OpenAI Service. |
| 90 | + */ |
| 91 | + @JvmStatic |
| 92 | + public val V2023_07_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2023-07-01-preview") |
| 93 | + |
| 94 | + /** |
| 95 | + * Version 2024-02-15-preview of the Azure OpenAI Service. |
| 96 | + */ |
| 97 | + @JvmStatic |
| 98 | + public val V2024_02_15_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-02-15-preview") |
| 99 | + |
| 100 | + /** |
| 101 | + * Version 2024-03-01-preview of the Azure OpenAI Service. |
| 102 | + */ |
| 103 | + @JvmStatic |
| 104 | + public val V2024_03_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-03-01-preview") |
| 105 | + |
| 106 | + /** |
| 107 | + * Version 2024-04-01-preview of the Azure OpenAI Service. |
| 108 | + */ |
| 109 | + @JvmStatic |
| 110 | + public val V2024_04_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-04-01-preview") |
| 111 | + |
| 112 | + /** |
| 113 | + * Version 2024-05-01-preview of the Azure OpenAI Service. |
| 114 | + */ |
| 115 | + @JvmStatic |
| 116 | + public val V2024_05_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-05-01-preview") |
| 117 | + |
| 118 | + /** |
| 119 | + * Version 2024-07-01-preview of the Azure OpenAI Service. |
| 120 | + */ |
| 121 | + @JvmStatic |
| 122 | + public val V2024_07_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-07-01-preview") |
| 123 | + |
| 124 | + /** |
| 125 | + * Version 2024-08-01-preview of the Azure OpenAI Service. |
| 126 | + */ |
| 127 | + @JvmStatic |
| 128 | + public val V2024_08_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-08-01-preview") |
| 129 | + |
| 130 | + /** |
| 131 | + * Version 2024-09-01-preview of the Azure OpenAI Service. |
| 132 | + */ |
| 133 | + @JvmStatic |
| 134 | + public val V2024_09_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-09-01-preview") |
| 135 | + |
| 136 | + /** |
| 137 | + * Version 2024-10-01-preview of the Azure OpenAI Service. |
| 138 | + */ |
| 139 | + @JvmStatic |
| 140 | + public val V2024_10_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-10-01-preview") |
| 141 | + |
| 142 | + /** |
| 143 | + * Version 2024-12-01-preview of the Azure OpenAI Service. |
| 144 | + */ |
| 145 | + @JvmStatic |
| 146 | + public val V2024_12_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2024-12-01-preview") |
| 147 | + |
| 148 | + /** |
| 149 | + * Version 2025-01-01-preview of the Azure OpenAI Service. |
| 150 | + */ |
| 151 | + @JvmStatic |
| 152 | + public val V2025_01_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2025-01-01-preview") |
| 153 | + |
| 154 | + /** |
| 155 | + * Version 2025-02-01-preview of the Azure OpenAI Service. |
| 156 | + */ |
| 157 | + @JvmStatic |
| 158 | + public val V2025_02_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2025-02-01-preview") |
| 159 | + |
| 160 | + /** |
| 161 | + * Version 2025-03-01-preview of the Azure OpenAI Service. |
| 162 | + */ |
| 163 | + @JvmStatic |
| 164 | + public val V2025_03_01_PREVIEW: AzureOpenAIServiceVersion = fromString("2025-03-01-preview") |
| 165 | + |
| 166 | + } |
| 167 | + |
| 168 | + override fun equals(other: Any?): Boolean = |
| 169 | + this === other || (other is AzureOpenAIServiceVersion && value == other.value) |
| 170 | + |
| 171 | + override fun hashCode(): Int = value.hashCode() |
| 172 | + |
| 173 | + override fun toString(): String = "AzureOpenAIServiceVersion{value=$value}" |
| 174 | + |
| 175 | +} |
0 commit comments