fix: return Ant response no transfrom

This commit is contained in:
Ishaan Jaffer 2026-01-20 17:24:31 -08:00
parent 49e712c059
commit 15265f77a6
3 changed files with 4 additions and 30 deletions

View file

@ -101,12 +101,8 @@ class AnthropicCountTokensHandler(AnthropicCountTokensConfig):
verbose_logger.debug(f"Anthropic response: {anthropic_response}")
# Transform response
final_response = self.transform_response(anthropic_response)
verbose_logger.debug(f"Final response: {final_response}")
return final_response
# Return Anthropic response directly - no transformation needed
return anthropic_response
except AnthropicError:
# Re-raise Anthropic exceptions as-is

View file

@ -53,24 +53,6 @@ class AnthropicCountTokensConfig:
"messages": messages,
}
def transform_response(self, response: Dict[str, Any]) -> Dict[str, Any]:
"""
Transform Anthropic CountTokens response.
Input (Anthropic response):
{
"input_tokens": 123
}
Output:
{
"input_tokens": 123
}
"""
return {
"input_tokens": response.get("input_tokens", 0),
}
def get_required_headers(self, api_key: str) -> Dict[str, str]:
"""
Get the required headers for the CountTokens API.

View file

@ -106,12 +106,8 @@ class AzureAIAnthropicCountTokensHandler(AzureAIAnthropicCountTokensConfig):
verbose_logger.debug(f"Azure AI Anthropic response: {azure_response}")
# Transform response
final_response = self.transform_response(azure_response)
verbose_logger.debug(f"Final response: {final_response}")
return final_response
# Return Anthropic-compatible response directly - no transformation needed
return azure_response
except AnthropicError:
# Re-raise Anthropic exceptions as-is