-
Your Name authored
Major rewrite to use the official Anthropic Python SDK instead of direct HTTP calls, while maintaining our OAuth2 authentication flow. Key changes: - Use Anthropic SDK client with OAuth2 token as api_key - SDK handles proper message format conversion - SDK handles automatic retries (max_retries=3) - SDK handles proper streaming event parsing - SDK handles correct headers and beta features - Better error handling and rate limit management This should fix the rate limiting issues we were seeing with direct HTTP calls, as the SDK implements proper retry logic and request formatting. New methods: - _get_sdk_client(): Creates SDK client with OAuth2 token - _handle_streaming_request_sdk(): SDK-based streaming handler - get_cache_stats(): Returns cache usage statistics Removed methods: - _request_with_retry(): No longer needed (SDK handles retries) - _handle_streaming_request_with_retry(): Replaced by SDK streaming - _handle_streaming_request(): Replaced by SDK streaming
0ba372d8