@@ -14,18 +14,16 @@ export class Embeddings extends APIResource {
1414 Core . debug ( 'request' , 'Sending request with arguments:' , { body, ...options } ) ;
1515
1616 const hasUserProvidedEncodingFormat = ! ! body . encoding_format ;
17+ // No encoding_format specified, defaulting to base64 for performance reasons
18+ // See https://github.com/openai/openai-node/pull/1312
1719 let encoding_format : EmbeddingCreateParams [ 'encoding_format' ] =
1820 hasUserProvidedEncodingFormat ? body . encoding_format : 'base64' ;
1921
2022 if ( hasUserProvidedEncodingFormat ) {
2123 Core . debug ( 'Request' , 'User defined encoding_format:' , body . encoding_format ) ;
22- } else {
23- // No encoding_format specified, defaulting to base64 for performance reasons
24- // See https://github.com/openai/openai-node/pull/1312
25- encoding_format = 'base64' ;
2624 }
2725
28- const response = this . _client . post ( '/embeddings' , {
26+ const response : Core . APIPromise < CreateEmbeddingResponse > = this . _client . post ( '/embeddings' , {
2927 body : {
3028 ...body ,
3129 encoding_format : encoding_format as EmbeddingCreateParams [ 'encoding_format' ] ,
@@ -35,7 +33,7 @@ export class Embeddings extends APIResource {
3533
3634 // if the user specified an encoding_format, return the response as-is
3735 if ( hasUserProvidedEncodingFormat ) {
38- return response as Core . APIPromise < CreateEmbeddingResponse > ;
36+ return response ;
3937 }
4038
4139 // in this stage, we are sure the user did not specify an encoding_format
0 commit comments