Skip to content

Commit fffae25

Browse files
committed
Cleanup
1 parent bf92e8b commit fffae25

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/api/providers/anthropic-vertex.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,30 @@ export class AnthropicVertexHandler extends BaseProvider implements SingleComple
4545

4646
this.options = options
4747

48+
// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#regions
49+
const projectId = this.options.vertexProjectId ?? "not-provided"
50+
const region = this.options.vertexRegion ?? "us-east5"
51+
4852
if (this.options.vertexJsonCredentials) {
4953
this.client = new AnthropicVertex({
50-
projectId: this.options.vertexProjectId ?? "not-provided",
51-
// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#regions
52-
region: this.options.vertexRegion ?? "us-east5",
54+
projectId,
55+
region,
5356
googleAuth: new GoogleAuth({
5457
scopes: ["https://www.googleapis.com/auth/cloud-platform"],
5558
credentials: JSON.parse(this.options.vertexJsonCredentials),
5659
}),
5760
})
5861
} else if (this.options.vertexKeyFile) {
5962
this.client = new AnthropicVertex({
60-
projectId: this.options.vertexProjectId ?? "not-provided",
61-
// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#regions
62-
region: this.options.vertexRegion ?? "us-east5",
63+
projectId,
64+
region,
6365
googleAuth: new GoogleAuth({
6466
scopes: ["https://www.googleapis.com/auth/cloud-platform"],
6567
keyFile: this.options.vertexKeyFile,
6668
}),
6769
})
6870
} else {
69-
this.client = new AnthropicVertex({
70-
projectId: this.options.vertexProjectId ?? "not-provided",
71-
// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#regions
72-
region: this.options.vertexRegion ?? "us-east5",
73-
})
71+
this.client = new AnthropicVertex({ projectId, region })
7472
}
7573
}
7674

0 commit comments

Comments
 (0)