Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

已关闭
#192 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
68/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
冷清
技术栈
ruby
领域
observability

调研方向

从 lib/braintrust/contrib/ruby_llm/patcher.rb 和 integration.rb 开始,然后对比 OpenAI moderation 文件和 ruby-openai moderation instrumentation 中现有的模式。为文档所述的 input、metadata、output 和 latency 字段实现缺失的 RubyLLM moderation instrumentation,将其与 ChatPatcher 一同注册,并验证 integration 覆盖 RubyLLM.moderate 和 RubyLLM::Moderation.moderate。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Ruby
星标
9
派生
11
平均合并
3 天 43 分钟
30 天内合并 PR
9

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

braintrustdata/braintrust-sdk-ruby 的其他 Issue

查看 braintrustdata/braintrust-sdk-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。