Skip to content

Commit

Permalink
chore(bedrock): remove unsupported methods
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie committed Dec 17, 2024
1 parent 7c752f0 commit 0ee411a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/bedrock-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class AnthropicBedrock extends Core.APIClient {
this.awsSessionToken = awsSessionToken;
}

messages: Resources.Messages = new Resources.Messages(this);
messages: MessagesResource = makeMessagesResource(this);
completions: Resources.Completions = new Resources.Completions(this);
beta: BetaResource = makeBetaResource(this);

Expand Down Expand Up @@ -158,6 +158,23 @@ export class AnthropicBedrock extends Core.APIClient {
}
}

/**
* The Bedrock API does not currently support token counting or the Batch API.
*/
type MessagesResource = Omit<Resources.Messages, 'batches' | 'countTokens'>;

function makeMessagesResource(client: AnthropicBedrock): MessagesResource {
const resource = new Resources.Messages(client);

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

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

return resource;
}

/**
* The Bedrock API does not currently support prompt caching, token counting or the Batch API.
*/
Expand Down

0 comments on commit 0ee411a

Please sign in to comment.