@@ -157,6 +157,9 @@ type EmbeddingRequest struct {
157157 Model EmbeddingModel `json:"model"`
158158 User string `json:"user"`
159159 EncodingFormat EmbeddingEncodingFormat `json:"encoding_format,omitempty"`
160+ // Dimensions The number of dimensions the resulting output embeddings should have.
161+ // Only supported in text-embedding-3 and later models.
162+ Dimensions int `json:"dimensions,omitempty"`
160163}
161164
162165func (r EmbeddingRequest ) Convert () EmbeddingRequest {
@@ -181,6 +184,9 @@ type EmbeddingRequestStrings struct {
181184 // Currently, only "float" and "base64" are supported, however, "base64" is not officially documented.
182185 // If not specified OpenAI will use "float".
183186 EncodingFormat EmbeddingEncodingFormat `json:"encoding_format,omitempty"`
187+ // Dimensions The number of dimensions the resulting output embeddings should have.
188+ // Only supported in text-embedding-3 and later models.
189+ Dimensions int `json:"dimensions,omitempty"`
184190}
185191
186192func (r EmbeddingRequestStrings ) Convert () EmbeddingRequest {
@@ -189,6 +195,7 @@ func (r EmbeddingRequestStrings) Convert() EmbeddingRequest {
189195 Model : r .Model ,
190196 User : r .User ,
191197 EncodingFormat : r .EncodingFormat ,
198+ Dimensions : r .Dimensions ,
192199 }
193200}
194201
@@ -209,6 +216,9 @@ type EmbeddingRequestTokens struct {
209216 // Currently, only "float" and "base64" are supported, however, "base64" is not officially documented.
210217 // If not specified OpenAI will use "float".
211218 EncodingFormat EmbeddingEncodingFormat `json:"encoding_format,omitempty"`
219+ // Dimensions The number of dimensions the resulting output embeddings should have.
220+ // Only supported in text-embedding-3 and later models.
221+ Dimensions int `json:"dimensions,omitempty"`
212222}
213223
214224func (r EmbeddingRequestTokens ) Convert () EmbeddingRequest {
@@ -217,6 +227,7 @@ func (r EmbeddingRequestTokens) Convert() EmbeddingRequest {
217227 Model : r .Model ,
218228 User : r .User ,
219229 EncodingFormat : r .EncodingFormat ,
230+ Dimensions : r .Dimensions ,
220231 }
221232}
222233
0 commit comments