fix(bedrock_httpx.py): move anthropic bedrock calls to httpx

Fixing https://github.com/BerriAI/litellm/issues/2921
This commit is contained in:
Krrish Dholakia 2024-05-16 21:51:55 -07:00
parent 10a672634d
commit 180bc46ca4
7 changed files with 298 additions and 56 deletions

View file

@ -4874,11 +4874,12 @@ async def token_counter(request: TokenCountRequest):
model_to_use = (
litellm_model_name or request.model
) # use litellm model name, if it's not avalable then fallback to request.model
total_tokens, tokenizer_used = token_counter(
_tokenizer_used = litellm.utils._select_tokenizer(model=model_to_use)
tokenizer_used = str(_tokenizer_used["type"])
total_tokens = token_counter(
model=model_to_use,
text=prompt,
messages=messages,
return_tokenizer_used=True,
)
return TokenCountResponse(
total_tokens=total_tokens,