@@ -26,7 +26,7 @@ public class RequestOptions
2626internal constructor (
2727 internal val timeout: Duration ,
2828 internal val endpoint: String = " https://firebasevertexai.googleapis.com" ,
29- internal val apiVersion: String ,
29+ internal val apiVersion: String = DEFAULT_API_VERSION .value ,
3030) {
3131
3232 /* *
@@ -39,10 +39,29 @@ internal constructor(
3939 */
4040 @JvmOverloads
4141 public constructor (
42- timeoutInMillis: Long = 180 .seconds.inWholeMilliseconds,
43- apiVersion: ApiVersion = ApiVersion . V1BETA ,
42+ timeoutInMillis: Long = DEFAULT_TIMEOUT_IN_MILLIS .seconds.inWholeMilliseconds,
43+ apiVersion: ApiVersion = DEFAULT_API_VERSION ,
4444 ) : this (
4545 timeout = timeoutInMillis.toDuration(DurationUnit .MILLISECONDS ),
4646 apiVersion = apiVersion.value,
4747 )
48+
49+ /* *
50+ * Constructor for RequestOptions.
51+ *
52+ * @param apiVersion the version of the Vertex AI in Firebase API; defaults to [ApiVersion.V1BETA]
53+ * if not specified.
54+ */
55+ public constructor (
56+ apiVersion: ApiVersion
57+ ) : this (
58+ timeoutInMillis = DEFAULT_TIMEOUT_IN_MILLIS ,
59+ apiVersion = apiVersion,
60+ )
61+
62+ private companion object {
63+ private const val DEFAULT_TIMEOUT_IN_MILLIS : Long = 180_000L
64+
65+ private val DEFAULT_API_VERSION : ApiVersion = ApiVersion .V1BETA
66+ }
4867}
0 commit comments