Skip to content

[bot] ruby-anthropic gem (alexrudall) not instrumented #157

@braintrust-bot

Description

@braintrust-bot

Summary

The ruby-anthropic gem (~444K downloads, v0.4.2, April 2025) by alexrudall is not instrumented by this SDK. This is a direct asymmetry: the SDK instruments both the official OpenAI gem (openai) and alexrudall's community OpenAI gem (ruby-openai), but for Anthropic it only instruments the official gem (anthropic) — not the equivalent community gem (ruby-anthropic) by the same author.

What is missing

No instrumentation exists for any ruby-anthropic execution surface. Key APIs that should be instrumented:

Messages API (Chat Completions)

  • client.messages(parameters: { model:, messages:, ... }) — Core chat completions method supporting Claude models (claude-3-haiku, claude-3-sonnet, claude-3-opus, claude-3.5-sonnet, etc.)

Streaming

  • client.messages(parameters: { ..., stream: Proc.new { |chunk| } }) — Streaming responses via callback proc

Batches API

  • client.messages.batches.create(parameters: { ... }) — Asynchronous batch processing of multiple message requests

Vision

  • Multimodal image analysis via base64-encoded image content in messages

Braintrust docs status

not_found — Braintrust docs at https://www.braintrust.dev/docs/instrument/trace-llm-calls list only the official anthropic gem (minimum version 0.3.0) for Ruby Anthropic tracing. No mention of ruby-anthropic anywhere.

Upstream sources

Local repo files inspected

  • lib/braintrust/contrib.rb (lines 196–205) — registers 4 integrations: OpenAI, RubyOpenAI, RubyLLM, Anthropic. No RubyAnthropic integration.
  • lib/braintrust/contrib/ — contains openai/, ruby_openai/, ruby_llm/, anthropic/ directories. No ruby_anthropic/ directory.
  • lib/braintrust/contrib/ruby_openai/integration.rb — instruments alexrudall's ruby-openai gem, confirming the pattern of instrumenting community gems alongside official ones.
  • lib/braintrust/contrib/anthropic/integration.rb — only instruments the official anthropic gem (checks for ::Anthropic::Client).
  • Appraisals — no appraisal scenarios for ruby-anthropic
  • braintrust.gemspec — no mention of ruby-anthropic
  • Grep for ruby.anthropic and ruby_anthropic across lib/braintrust/ returns zero matches

Notes

The existing ruby_openai integration demonstrates the pattern for instrumenting alexrudall's community gems. A ruby_anthropic integration could follow the same structure: RubyAnthropic::Integration, RubyAnthropic::MessagesPatcher, etc., mirroring how RubyOpenAI::ChatPatcher parallels OpenAI::ChatPatcher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions