Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[bot] RubyLLM content moderation (`RubyLLM.moderate`) not instrumented

Open
#192 0 comments 0 reactions 0 assignees View on GitHub

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 identifier
  • model — model ID used for moderation
  • results — array of Result objects 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

Local repo files inspected

  • lib/braintrust/contrib/ruby_llm/patcher.rb — defines only ChatPatcher; no ModerationPatcher
  • lib/braintrust/contrib/ruby_llm/integration.rb — registers [ChatPatcher] only
  • lib/braintrust/contrib/openai/instrumentation/moderations.rb — existing OpenAI moderation instrumentation (pattern to follow)
  • lib/braintrust/contrib/openai/patcher.rb — ModerationsPatcher demonstrates the patcher pattern
  • lib/braintrust/contrib/ruby_openai/instrumentation/moderations.rb — ruby-openai moderation instrumentation
  • Grep for moderate, Moderation, ModerationPatcher across lib/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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from braintrustdata/braintrust-sdk-ruby

All issues in braintrustdata/braintrust-sdk-ruby

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.