Skip to content

Commit

Permalink
feat(vertex): add beta.messages.create()
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie authored and stainless-app[bot] committed Oct 22, 2024
1 parent b9fa45a commit 08a8928
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/vertex-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class AnthropicVertex extends Core.APIClient {
}

messages: Resources.Messages = new Resources.Messages(this);
beta: BetaResource = makeBetaResource(this);

protected override defaultQuery(): Core.DefaultQuery | undefined {
return this._options.defaultQuery;
Expand Down Expand Up @@ -142,3 +143,22 @@ export class AnthropicVertex extends Core.APIClient {
return super.buildRequest(options);
}
}

/**
* The Vertex API does not currently support prompt caching or the Batch API.
*/
type BetaResource = Omit<Resources.Beta, 'promptCaching' | 'messages'> & {
messages: Omit<Resources.Beta['messages'], 'batches'>;
};

function makeBetaResource(client: AnthropicVertex): BetaResource {
const resource = new Resources.Beta(client);

// @ts-expect-error we're deleting non-optional properties
delete resource.promptCaching;

// @ts-expect-error we're deleting non-optional properties
delete resource.messages.batches;

return resource;
}

0 comments on commit 08a8928

Please sign in to comment.