@@ -12,13 +12,15 @@ import com.fasterxml.jackson.annotation.JsonProperty
12
12
* @property input The input(s) to convert to embeddings.
13
13
* @property model Which [model](https://platform.openai.com/docs/models/embeddings) to use to generate the embeddings.
14
14
* @property encodingFormat Determines how the embeddings are encoded. Defaults to [EncodingFormat.FLOAT].
15
+ * @property dimensions The number of dimensions to use for the embeddings.
15
16
* @property user The user ID to associate with this request.
16
17
* @constructor Create empty Embeddings request
17
18
*/
18
19
data class EmbeddingsRequest internal constructor(
19
20
var input : Any ,
20
21
var model : String ,
21
22
@JsonProperty(" encoding_format" ) var encodingFormat : EncodingFormat ? = null ,
23
+ var dimensions : Int? = null ,
22
24
var user : String? = null ,
23
25
) {
24
26
@@ -30,20 +32,23 @@ data class EmbeddingsRequest internal constructor(
30
32
private var input: Any? = null
31
33
private var model: String? = null
32
34
private var encodingFormat: EncodingFormat ? = null
35
+ private var dimensions: Int? = null
33
36
private var user: String? = null
34
37
35
38
fun input (input : String ) = apply { this .input = input }
36
39
fun input (input : List <String >) = apply { this .input = input }
37
40
fun model (model : String ) = apply { this .model = model }
38
41
fun encodingFormat (encodingFormat : EncodingFormat ) = apply { this .encodingFormat = encodingFormat }
42
+ fun dimensions (dimensions : Int ) = apply { this .dimensions = dimensions }
39
43
fun user (user : String ) = apply { this .user = user }
40
44
41
45
fun build (): EmbeddingsRequest {
42
46
return EmbeddingsRequest (
43
47
input = input ? : throw IllegalStateException (" input must be defined to use EmbeddingsRequest" ),
44
48
model = model ? : throw IllegalStateException (" model must be defined to use EmbeddingsRequest" ),
45
49
encodingFormat = encodingFormat,
46
- user = user
50
+ dimensions = dimensions,
51
+ user = user,
47
52
)
48
53
}
49
54
}
0 commit comments