Skip to content

v0.2.0

Choose a tag to compare

@mikecarroll mikecarroll released this 17 Dec 02:56
· 80 commits to main since this release

v0.2.0 Release Notes

🚀 What's New

Official Anthropic Gem Support - Major release adding comprehensive Anthropic monitoring, streaming support, and advanced duplicate prevention.

🧠 Anthropic Integration

  • Dual gem support - Works with both official anthropic gem and community ruby-anthropic gem
  • Automatic detection - Smart detection of which Anthropic gem you're using
  • Streaming support - Complete accumulated response capture for both streaming and non-streaming requests

⚡ Advanced Dual Interceptor Architecture

The new architecture uses specialized interceptors for different transport layers:

# Works automatically with both gems
require 'anthropic'  # Either official or ruby-anthropic
require 'coolhand/ruby'

Coolhand.configure do |config|
  config.api_key = 'your_api_key_here'
end

# All requests automatically monitored - zero configuration needed
client = Anthropic::Client.new
response = client.messages(parameters: { model: "claude-3-sonnet", stream: true })

🛡️ Key Technical Improvements

Dual Interceptor Strategy

  • FaradayInterceptor - Monitors OpenAI SDK, ruby-anthropic, and other Faraday-based libraries
  • AnthropicInterceptor - Monitors official Anthropic gem's Net::HTTP transport
  • Thread-local suppression - Prevents duplicate request logging automatically

Advanced Streaming Support

  • Smart detection - Automatically identifies streaming vs non-streaming requests
  • Complete logging - Captures full accumulated response, not individual chunks
  • SSE handling - Proper Server-Sent Events parsing for streaming responses
  • MessageStream patching - Automatic interception of official gem's streaming classes

🏗️ Architecture Overview

Before v0.2.0

Ruby App → Faraday → LLM APIs
             ↓
        Single Interceptor

v0.2.0 Architecture

Ruby App → Official Anthropic Gem (Net::HTTP) → Anthropic API
    ↓           ↓
    ↓      AnthropicInterceptor
    ↓
    → Faraday-based gems → LLM APIs
              ↓
        FaradayInterceptor

Thread-Local Suppression ensures no duplicate logging when interceptors could overlap.


🔗 Resources