[bot] RubyLLM content moderation (`RubyLLM.moderate`) not instrumented
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- ruby
- Domain
- observability
Research direction
Start with lib/braintrust/contrib/ruby_llm/patcher.rb and integration.rb, then compare the existing patterns in the OpenAI moderation files and ruby-openai moderation instrumentation. Implement the missing RubyLLM moderation instrumentation for the documented input, metadata, output, and latency fields, register it alongside ChatPatcher, and verify the integration covers RubyLLM.moderate and RubyLLM::Moderation.moderate.
Written by the indexing model from the issue text.
Description
Summary
The ruby_llm gem provides RubyLLM.moderate(input, ...) for AI-powered content moderation. This API is not instrumented by this SDK. The current RubyLLM integration only instruments RubyLLM::Chat. Content moderation uses an AI classification model to screen text and images for harmful content, and is a distinct execution surface from chat completions.
This is a cross-library parity gap: the Braintrust Ruby SDK already instruments OpenAI's moderation API for both the openai gem (OpenAI::Resources::Moderations) and the ruby-openai gem (ModerationsPatcher). The equivalent ruby_llm surface has no instrumentation.
What is missing
RubyLLM.moderate(input, model:, with:, provider:, ...) / RubyLLM::Moderation.moderate(input, ...) — invokes a provider moderation model (e.g., OpenAI's omni-moderation-latest) and returns a RubyLLM::Moderation object containing:
id— provider-assigned identifiermodel— model ID used for moderationresults— array ofResultobjects with category flags and scores
What a span should capture
- Input: text string(s) and/or image attachments being moderated
- Metadata: model, provider, endpoint
- Output: flagged status (
flagged?), flagged categories, per-category scores - Metrics:
time_to_first_token(latency)
The implementation pattern is established: ModerationsPatcher for openai and ruby-openai gems both wrap a single create-style method. A new ModerationPatcher for ruby_llm would wrap Moderation.moderate.
Braintrust docs status
not_found — The Braintrust RubyLLM integration docs at https://www.braintrust.dev/docs/integrations/sdk-integrations/ruby-llm document only chat completions, tool calls, token usage, and streaming. Moderation is not mentioned. The OpenAI integration page does describe moderation support for the openai gem.
Upstream sources
- RubyLLM
Moderationclass: https://github.com/crmne/ruby_llm/blob/main/lib/ruby_llm/moderation.rb - RubyLLM module
moderatemethod: https://github.com/crmne/ruby_llm/blob/main/lib/ruby_llm.rb
Local repo files inspected
lib/braintrust/contrib/ruby_llm/patcher.rb— defines onlyChatPatcher; noModerationPatcherlib/braintrust/contrib/ruby_llm/integration.rb— registers[ChatPatcher]onlylib/braintrust/contrib/openai/instrumentation/moderations.rb— existing OpenAI moderation instrumentation (pattern to follow)lib/braintrust/contrib/openai/patcher.rb—ModerationsPatcherdemonstrates the patcher patternlib/braintrust/contrib/ruby_openai/instrumentation/moderations.rb— ruby-openai moderation instrumentation- Grep for
moderate,Moderation,ModerationPatcheracrosslib/braintrust/contrib/ruby_llm/returns zero matches
- Dominant language
- Ruby
- Stars
- 9
- Forks
- 10
- Avg merge
- 22h 10m
- Merged PRs (30d)
- 6
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from braintrustdata/braintrust-sdk-ruby
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
ruby
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
ruby
Difficulty 4/5 3-5 days Newbie friendliness 48/100
All issues in braintrustdata/braintrust-sdk-ruby
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
eurosky-social/eu-haul#32 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
benbalter/add-to-org#17 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
benbalter/change_agent#11 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
benbalter/count-org-loc#20 ·
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
benbalter/sitemap-parser#33 ·