Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#192 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
ruby
Lĩnh vực
observability

Hướng nghiên cứu

Bắt đầu với lib/braintrust/contrib/ruby_llm/patcher.rb và integration.rb, sau đó so sánh các mẫu hiện có trong các tệp moderation của OpenAI và phần instrumentation moderation của ruby-openai. Triển khai RubyLLM moderation instrumentation còn thiếu cho các trường input, metadata, output và latency đã được ghi trong tài liệu, đăng ký nó cùng với ChatPatcher và xác minh rằng integration bao phủ RubyLLM.moderate và RubyLLM::Moderation.moderate.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Ruby
Star
9
Fork
10
Merge trung bình
3 ngày 43 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của braintrustdata/braintrust-sdk-ruby

Tất cả issue của braintrustdata/braintrust-sdk-ruby

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.