Skip to content

Commit 6eacbff

Browse files
committed
anthropic beta for vertex
1 parent f6bc63c commit 6eacbff

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/handlers/handlerUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ export function constructConfigFromRequestHeaders(
940940
vertexModelName: requestHeaders[`x-${POWERED_BY}-provider-model`],
941941
vertexBatchEndpoint:
942942
requestHeaders[`x-${POWERED_BY}-provider-batch-endpoint`],
943+
anthropicBeta: requestHeaders[`x-${POWERED_BY}-anthropic-beta`],
943944
};
944945

945946
const fireworksConfig = {

src/providers/google-vertex-ai/api.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,23 @@ export const GoogleApiConfig: ProviderAPIConfig = {
6262
}
6363
return `https://${vertexRegion}-aiplatform.googleapis.com`;
6464
},
65-
headers: async ({ c, providerOptions }) => {
65+
headers: async ({ c, providerOptions, gatewayRequestBody }) => {
6666
const { apiKey, vertexServiceAccountJson } = providerOptions;
6767
let authToken = apiKey;
6868
if (vertexServiceAccountJson) {
6969
authToken = await getAccessToken(c, vertexServiceAccountJson);
7070
}
7171

72+
const anthropicBeta =
73+
providerOptions?.['anthropicBeta'] ??
74+
gatewayRequestBody?.['anthropic_beta'];
75+
7276
return {
7377
'Content-Type': 'application/json',
7478
Authorization: `Bearer ${authToken}`,
79+
...(anthropicBeta && {
80+
'anthropic-beta': anthropicBeta,
81+
}),
7582
};
7683
},
7784
getEndpoint: ({

0 commit comments

Comments
 (0)