From a41193d112f47faaae88872e8764b631dbad1941 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 23 Oct 2024 09:17:16 +0100 Subject: [PATCH] fix(vertex): correct messages beta handling --- packages/vertex-sdk/src/client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vertex-sdk/src/client.ts b/packages/vertex-sdk/src/client.ts index 30258db6..61f67582 100644 --- a/packages/vertex-sdk/src/client.ts +++ b/packages/vertex-sdk/src/client.ts @@ -5,6 +5,7 @@ import { type RequestInit } from '@anthropic-ai/sdk/_shims/index'; import { GoogleAuth } from 'google-auth-library'; const DEFAULT_VERSION = 'vertex-2023-10-16'; +const MODEL_ENDPOINTS = new Set(['/v1/messages', '/v1/messages?beta=true']); export type ClientOptions = Omit & { region?: string | null | undefined; @@ -119,7 +120,7 @@ export class AnthropicVertex extends Core.APIClient { } } - if (options.path === '/v1/messages' && options.method === 'post') { + if (MODEL_ENDPOINTS.has(options.path) && options.method === 'post') { if (!this.projectId) { throw new Error( 'No projectId was given and it could not be resolved from credentials. The client should be instantiated with the `projectId` option or the `ANTHROPIC_VERTEX_PROJECT_ID` environment variable should be set.',