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

[bot] ruby_llm Chat span metadata misses accessible generation parameters (tool_prefs, params, schema) and omits tools from streaming spans

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

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
ruby
领域
observability

调研方向

从 lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb 中的 extract_metadata 开始,将其字段与 issue 中所列的 OpenAI 和 Anthropic instrumentation 文件进行比较。确保 tool_prefs、params、schema 和 tools 在 streaming 和 non-streaming span 中都有表示,然后根据文档化的 RubyLLM Chat 属性验证所得的 metadata。

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

描述

Summary

The ruby_llm Chat integration captures only 3–4 fields in span metadata (provider, stream, model, and tools in non-streaming). The RubyLLM::Chat class exposes several accessible attr_reader attributes that contain key generation configuration — tool_prefs, params, and schema — none of which are captured. Additionally, tools is explicitly omitted from streaming spans even though it is an accessible attr_reader.

This is a significant detail gap compared with the OpenAI and Anthropic integrations, which each capture 15–20 configuration fields per span.

What is missing

1. tool_prefs not captured (accessible via attr_reader)

RubyLLM::Chat exposes attr_reader :tool_prefs, which is a hash with two keys:

  • tool_prefs[:choice] — tool choice mode (:auto, :required, :none), set via chat.with_tools(..., choice: :required). Introduced in ruby_llm v1.13.0.
  • tool_prefs[:calls] — parallel tool call limit, set via chat.with_tools(..., calls: 1). Also introduced in v1.13.0.

These correspond directly to tool_choice and parallel_tool_calls that the OpenAI and Anthropic integrations capture.

2. params not captured (accessible via attr_reader)

RubyLLM::Chat exposes attr_reader :params, a hash of provider-specific generation parameters set via chat.with_params(max_tokens: 1000, top_p: 0.9, ...). This is the primary way users configure generation parameters like max_tokens, top_p, top_k, seed, and similar values.

These parameters directly affect generation quality and cost, and are the exact fields that the OpenAI (max_tokens, top_p, seed) and Anthropic (max_tokens, temperature, top_p, top_k) integrations capture.

3. schema not captured (accessible via attr_reader)

RubyLLM::Chat exposes attr_reader :schema, which holds the structured output format schema when users call chat.with_format(MyModel). Capturing this identifies which structured output format was requested — comparable to response_format captured by the OpenAI integration.

4. tools omitted from streaming spans

The extract_metadata method explicitly skips tools for streaming calls:

# lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb (lines ~162–164)
if !stream && respond_to?(:tools) && tools&.any?
  metadata["tools"] = extract_tools_metadata
end

tools is an attr_reader on RubyLLM::Chat and is available during streaming calls. When users stream a tool-using chat, the span metadata contains no information about which tools were available — making it impossible to correlate tool execution spans with their governing chat configuration.

Comparison with other integrations

Field OpenAI Anthropic ruby_llm
model ✓ ✓ ✓
temperature ✓ ✓ ✗ (in @temperature, no attr_reader)
max_tokens ✓ ✓ ✗ (in params)
top_p / top_k ✓ ✓ ✗ (in params)
seed ✓ – ✗ (in params)
tools ✓ ✓ ✓ non-streaming only
tool_choice ✓ ✓ ✗ (in tool_prefs[:choice])
parallel_tool_calls ✓ – ✗ (in tool_prefs[:calls])
response_format / schema ✓ – ✗ (in schema)

Braintrust docs status

not_found — The Braintrust ruby_llm integration docs at https://www.braintrust.dev/docs/integrations/sdk-integrations/ruby-llm describe basic chat tracing but do not document which metadata fields are captured. No mention of tool_choice, generation parameters, or structured output format in the Ruby LLM integration docs.

Upstream sources

Local repo files inspected

  • lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb — extract_metadata (lines ~151–167) captures only provider, stream, model, and tools (non-streaming); no tool_prefs, params, or schema
  • lib/braintrust/contrib/openai/instrumentation/chat.rb — METADATA_FIELDS captures 20 fields including model, temperature, top_p, max_tokens, response_format, seed, tools, tool_choice, parallel_tool_calls
  • lib/braintrust/contrib/anthropic/instrumentation/messages.rb — METADATA_FIELDS captures model, max_tokens, temperature, top_p, top_k, stop_sequences, tools, tool_choice, thinking, service_tier
主要语言
Ruby
星标
9
派生
11
平均合并
2 天 3 小时
30 天内合并 PR
5

环境准备

  • 提供 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 摘要。