Skip to content

Commit

Permalink
fix(vertex): don't mutate request body inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie committed Nov 5, 2024
1 parent f83b535 commit e9a82e5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vertex-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ export class AnthropicVertex extends Core.APIClient {
url: string;
timeout: number;
} {
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 e9a82e5

Please sign in to comment.