Skip to content

Commit

Permalink
fix(vertex): correct messages beta handling
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie authored and stainless-app[bot] committed Oct 23, 2024
1 parent 0f8b00c commit a41193d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vertex-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>(['/v1/messages', '/v1/messages?beta=true']);

export type ClientOptions = Omit<API.ClientOptions, 'apiKey' | 'authToken'> & {
region?: string | null | undefined;
Expand Down Expand Up @@ -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.',
Expand Down

0 comments on commit a41193d

Please sign in to comment.