Skip to content

Commit 2c12cd2

Browse files
authored
Merge pull request #1383 from narengogi/fix/falsy-check-bedrock
fix falsy check in bedrock
2 parents b5bc77e + c11f33a commit 2c12cd2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/providers/bedrock/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ export const transformInferenceConfig = (
8585
if (params['stop']) {
8686
inferenceConfig['stopSequences'] = params['stop'];
8787
}
88-
if (params['temperature']) {
88+
if (params['temperature'] !== null && params['temperature'] !== undefined) {
8989
inferenceConfig['temperature'] = params['temperature'];
9090
}
91-
if (params['top_p']) {
91+
if (params['top_p'] !== null && params['top_p'] !== undefined) {
9292
inferenceConfig['topP'] = params['top_p'];
9393
}
9494
return inferenceConfig;
@@ -101,7 +101,7 @@ export const transformAdditionalModelRequestFields = (
101101
params.additionalModelRequestFields ||
102102
params.additional_model_request_fields ||
103103
{};
104-
if (params['top_k']) {
104+
if (params['top_k'] !== null && params['top_k'] !== undefined) {
105105
additionalModelRequestFields['top_k'] = params['top_k'];
106106
}
107107
if (params['response_format']) {
@@ -117,7 +117,7 @@ export const transformAnthropicAdditionalModelRequestFields = (
117117
params.additionalModelRequestFields ||
118118
params.additional_model_request_fields ||
119119
{};
120-
if (params['top_k']) {
120+
if (params['top_k'] !== null && params['top_k'] !== undefined) {
121121
additionalModelRequestFields['top_k'] = params['top_k'];
122122
}
123123
if (params['anthropic_version']) {

0 commit comments

Comments
 (0)