Open austinmw opened 6 months ago
@austinmw
PR 20 added support for token count with callbacks. It might not be compatible with the BedrockAnthropicTokenUsageCallbackHandler
but you can use the sample in the PR to get the token count. Having a dedicated callback handler does add some utility, plz feel free to add one in this repo if you have cycles to do so.
langchain_community.callbacks.bedrock_anthropic_callback.BedrockAnthropicTokenUsageCallbackHandler
appears to be broken withlangchain_aws
models.Example:
Output:
Side note: It might be a good idea for
langchain_aws
to take over theBedrockAnthropicTokenUsageCallbackHandler
callback instead in order to keep it more up to date?