Skip to content

Commit

Permalink
fix(bedrock): don't mutate request body inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie authored and stainless-app[bot] committed Nov 5, 2024
1 parent c128ce7 commit 4523ca9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/bedrock-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ export class AnthropicBedrock extends Core.APIClient {
} {
options.__streamClass = Stream;

if (Core.isObj(options.body)) {
// create a shallow copy of the request body so that code that mutates it later
// doesn't mutate the original user-provided object
options.body = { ...options.body };
}

if (Core.isObj(options.body)) {
if (!options.body['anthropic_version']) {
options.body['anthropic_version'] = DEFAULT_VERSION;
Expand Down

0 comments on commit 4523ca9

Please sign in to comment.