get_bedrock_anthropic_callback() -> Generator[BedrockAnthropicTokenUsageCallbackHandler, None, None]Get the Bedrock anthropic callback handler in a context manager. which conveniently exposes token and cost information.
Example:
with get_bedrock_anthropic_callback() as cb: ... # Use the Bedrock anthropic callback handler