[bot] RubyLLM moderation API (`RubyLLM.moderate`) not instrumented
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/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 moderation pattern in lib/braintrust/contrib/openai/instrumentation/moderations.rb and openai/patcher.rb lines 131–170. Done means RubyLLM.moderate and its alias are instrumented with the stated input, metadata, moderation output, and latency, with the integration registered and loading detection updated.
Written by the indexing model from the issue text.
Description
Summary
RubyLLM.moderate is a model execution call that invokes OpenAI's moderation API to classify text for harmful content. It is not instrumented by the Braintrust Ruby SDK. The existing RubyLLM integration only patches RubyLLM::Chat.
This is distinct from issue #136 (RubyLLM embed, paint, and transcribe APIs not instrumented), which covers three other non-chat RubyLLM execution surfaces but explicitly omits moderation.
What is missing
RubyLLM.moderate("text") (aliased as RubyLLM::Moderation.moderate) makes a live API request to OpenAI's moderation endpoint using models such as omni-moderation-latest or text-moderation-007. It returns a RubyLLM::Moderation object with:
flagged— overall boolean- Per-category flags and confidence scores
idandmodelfrom the API response
This is the same class of execution call as the moderations already instrumented for the openai and ruby-openai integrations (ModerationsPatcher in both). A parallel RubyLLM::ModerationPatcher would follow the same pattern.
What a span should capture
- Input: the text string being moderated
- Metadata: model (e.g.,
omni-moderation-latest), provider (ruby_llm), endpoint - Output: flagged categories and scores (or summary)
- Metrics: no token usage is returned by the moderation API, but latency should be captured
Braintrust docs status
not_found — The Braintrust RubyLLM integration docs at https://www.braintrust.dev/docs/integrations/sdk-integrations/ruby-llm cover chat completions and tool calls but do not mention moderation. The OpenAI provider docs at https://www.braintrust.dev/docs/providers/openai document moderation instrumentation via the openai gem but not via RubyLLM.
Upstream sources
- RubyLLM moderation docs: https://rubyllm.com/moderation/ — documents
RubyLLM.moderate("text")making an API call to OpenAI'somni-moderation-latestmodel - RubyLLM README: https://github.com/crmne/ruby_llm — lists
RubyLLM.moderateunder core capabilities
Local files inspected
lib/braintrust/contrib/ruby_llm/patcher.rb— defines onlyChatPatcher; noModerationPatcherlib/braintrust/contrib/ruby_llm/integration.rb— registers only[ChatPatcher];loaded?checksdefined?(::RubyLLM::Chat)onlylib/braintrust/contrib/openai/instrumentation/moderations.rb— demonstrates the existing moderation instrumentation pattern in this repolib/braintrust/contrib/openai/patcher.rb(lines 131–170) —ModerationsPatcherfor reference
- 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 88/100
forem/forem#23933 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
rails/mission_control-jobs#347 ·
-
PROJECT: ILR/DRS
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thewca/worldcubeassociation.org#15914 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 7 days
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
benbalter/site-inspector#127 ·
Maintainers usually reply within 1 day