File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -52,9 +52,10 @@ export const BedrockCohereEmbedConfig: ProviderConfig = {
52
52
encoding_format : {
53
53
param : 'embedding_types' ,
54
54
required : false ,
55
- transform : ( params : any ) : string [ ] => {
55
+ transform : ( params : any ) : string [ ] | undefined => {
56
56
if ( Array . isArray ( params . encoding_format ) ) return params . encoding_format ;
57
- return [ params . encoding_format ] ;
57
+ else if ( typeof params . encoding_format === 'string' )
58
+ return [ params . encoding_format ] ;
58
59
} ,
59
60
} ,
60
61
} ;
@@ -115,9 +116,10 @@ export const BedrockTitanEmbedConfig: ProviderConfig = {
115
116
encoding_format : {
116
117
param : 'embeddingTypes' ,
117
118
required : false ,
118
- transform : ( params : any ) : string [ ] => {
119
+ transform : ( params : any ) : string [ ] | undefined => {
119
120
if ( Array . isArray ( params . encoding_format ) ) return params . encoding_format ;
120
- return [ params . encoding_format ] ;
121
+ else if ( typeof params . encoding_format === 'string' )
122
+ return [ params . encoding_format ] ;
121
123
} ,
122
124
} ,
123
125
// Titan specific parameters
Original file line number Diff line number Diff line change @@ -50,9 +50,10 @@ export const CohereEmbedConfig: ProviderConfig = {
50
50
encoding_format : {
51
51
param : 'embedding_types' ,
52
52
required : false ,
53
- transform : ( params : any ) : string [ ] => {
53
+ transform : ( params : any ) : string [ ] | undefined => {
54
54
if ( Array . isArray ( params . encoding_format ) ) return params . encoding_format ;
55
- return [ params . encoding_format ] ;
55
+ else if ( typeof params . encoding_format === 'string' )
56
+ return [ params . encoding_format ] ;
56
57
} ,
57
58
} ,
58
59
//backwards compatibility
You can’t perform that action at this time.
0 commit comments