Skip to content

Commit a3f0ac0

Browse files
committed
handle null in encoding format
1 parent 9775e10 commit a3f0ac0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/providers/bedrock/embed.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ export const BedrockTitanEmbedConfig: ProviderConfig = {
115115
encoding_format: {
116116
param: 'embeddingTypes',
117117
required: false,
118-
transform: (params: any): string[] => {
118+
transform: (params: any): string[] | undefined => {
119119
if (Array.isArray(params.encoding_format)) return params.encoding_format;
120-
return [params.encoding_format];
120+
else if (typeof params.encoding_format === 'string')
121+
return [params.encoding_format];
121122
},
122123
},
123124
// Titan specific parameters

src/providers/cohere/embed.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ export const CohereEmbedConfig: ProviderConfig = {
5050
encoding_format: {
5151
param: 'embedding_types',
5252
required: false,
53-
transform: (params: any): string[] => {
53+
transform: (params: any): string[] | undefined => {
5454
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];
5657
},
5758
},
5859
//backwards compatibility

0 commit comments

Comments
 (0)