Skip to content

Commit

Permalink
chore(bedrock,vertex): remove unsupported countTokens method (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie authored Nov 8, 2024
1 parent 7572e48 commit 17b7da5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions packages/bedrock-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ export class AnthropicBedrock extends Core.APIClient {
}

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

function makeBetaResource(client: AnthropicBedrock): BetaResource {
Expand All @@ -174,5 +174,8 @@ function makeBetaResource(client: AnthropicBedrock): BetaResource {
// @ts-expect-error we're deleting non-optional properties
delete resource.messages.batches;

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

return resource;
}
7 changes: 5 additions & 2 deletions packages/vertex-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ export class AnthropicVertex extends Core.APIClient {
}

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

function makeBetaResource(client: AnthropicVertex): BetaResource {
Expand All @@ -167,5 +167,8 @@ function makeBetaResource(client: AnthropicVertex): BetaResource {
// @ts-expect-error we're deleting non-optional properties
delete resource.messages.batches;

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

return resource;
}

0 comments on commit 17b7da5

Please sign in to comment.