ruby_llm-responses_api 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: daf5eec383489e81c577b2f04965ca156b976ca30a708a39a6ab8dce39863ff7
4
- data.tar.gz: df8e9a6f230724e40f479679229d20c1b2faeee8e186400f37367e059badea8a
3
+ metadata.gz: 43d4f0424abdeacfbc7b3248e4fd4c0d69ab8480109b3096067479ad1cd460b8
4
+ data.tar.gz: c93b65a4efd9f0fc4b7affa4f347805a5d0ef06546bb4df90e0a867d87e0dc2d
5
5
  SHA512:
6
- metadata.gz: 7b6ae940cd27e283b2fd06edcb9122fb25328f39d786f3c011073954a4e5574a63f4272b17e11816e499c3064343407181a044768ebaa7f4f9d1844ea3afae3b
7
- data.tar.gz: e2f971bfe9d6d874e6b368775485dab455ce16a0291c11d1806adf279273c3b6e762fac015ab86d376d84c3d31e0e1de26475ec5230c912d7352ad0b29c0a7f1
6
+ metadata.gz: d580ab35204ef570e1b4ea884a228df3adb20c828be2feae1694c99adcf65117f3f5ebb63d29654e99cfba47dba5a96328b8ac39b45abf81b31073e53131fd97
7
+ data.tar.gz: e16737b05b3322cef6a5420e38aa506845df963f8f71ce3967f4f50d54a0f876b99b9cecffb0181afc4a1a394dd33960d5d5a9abee90a9b7288ee5390b3a6036
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.1] - 2026-06-11
9
+
10
+ ### Added
11
+
12
+ - RubyLLM 1.16 compatibility for request instrumentation, including `request.ruby_llm` events for manual Responses API DELETE requests while preserving RubyLLM 1.15 compatibility
13
+ - Explicit provider `configuration_options` for OpenAI API key, base URL, organization, and project settings
14
+ - Explicit `supports_tool_parallel_control?` capability so RubyLLM can discover Responses API support for `calls: :many` / `calls: :one`
15
+
16
+ ### Fixed
17
+
18
+ - Streamed function-call argument accumulation with RubyLLM 1.16's indexed `StreamAccumulator`, including Responses API `item_id` deltas
19
+
8
20
  ## [0.6.0] - 2026-05-26
9
21
 
10
22
  ### Added
@@ -155,6 +155,10 @@ module RubyLLM
155
155
  model_matches?(model_id, CODE_INTERPRETER_MODELS)
156
156
  end
157
157
 
158
+ def supports_tool_parallel_control?(_model_id)
159
+ true
160
+ end
161
+
158
162
  def reasoning_model?(model_id)
159
163
  model_matches?(model_id, REASONING_MODELS)
160
164
  end
@@ -12,7 +12,7 @@ module RubyLLM
12
12
  'responses'
13
13
  end
14
14
 
15
- def build_chunk(data) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
15
+ def build_chunk(data) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
16
16
  event_type = data['type']
17
17
 
18
18
  case event_type
@@ -59,11 +59,12 @@ module RubyLLM
59
59
  # New output item started (function call, message, etc.)
60
60
  item = data['item'] || {}
61
61
  if item['type'] == 'function_call'
62
+ stream_key = item['id'] || item['call_id']
62
63
  Chunk.new(
63
64
  role: :assistant,
64
65
  content: nil,
65
66
  tool_calls: {
66
- item['call_id'] => ToolCall.new(
67
+ stream_key => ToolCall.new(
67
68
  id: item['call_id'],
68
69
  name: item['name'],
69
70
  arguments: ''
@@ -97,12 +98,14 @@ module RubyLLM
97
98
  call_id = data['call_id'] || data['item_id']
98
99
  return nil unless call_id
99
100
 
100
- # Argument delta events don't carry a tool name — only the initial
101
- # output_item.added event does. Omit `id` on nameless deltas so
102
- # StreamAccumulator appends arguments to the latest tool call
103
- # instead of creating a new entry that overwrites the named one.
101
+ stream_key = data['item_id']
102
+ stream_key ||= data['call_id'] if data['call_id']&.start_with?('call_')
103
+
104
+ # Argument delta events usually carry an item_id, while the final
105
+ # function call id lives on output_item.added. When only an unmapped
106
+ # id is available, use nil so RubyLLM 1.16 appends to the latest call.
104
107
  {
105
- call_id => ToolCall.new(
108
+ stream_key => ToolCall.new(
106
109
  id: data['name'] ? call_id : nil,
107
110
  name: data['name'],
108
111
  arguments: data['delta'] || ''
@@ -5,7 +5,7 @@ module RubyLLM
5
5
  # OpenAI Responses API provider for RubyLLM.
6
6
  # Implements the new Responses API which provides built-in tools,
7
7
  # stateful conversations, background mode, and MCP support.
8
- class OpenAIResponses
8
+ class OpenAIResponses # rubocop:disable Metrics/ClassLength
9
9
  include OpenAIResponses::Chat
10
10
  include OpenAIResponses::Streaming
11
11
  include OpenAIResponses::Tools
@@ -219,16 +219,37 @@ module RubyLLM
219
219
  # DELETE request via the underlying Faraday connection
220
220
  # RubyLLM::Connection only exposes get/post, so we use Faraday directly
221
221
  def delete_request(url)
222
- @connection.connection.delete(url) do |req|
223
- req.headers.merge!(headers)
222
+ payload = { provider: slug, method: :delete, url: url }
223
+
224
+ instrument_request(payload) do
225
+ response = @connection.connection.delete(url) do |req|
226
+ req.headers.merge!(headers)
227
+ end
228
+ payload[:status] = response.status if response.respond_to?(:status)
229
+ response
224
230
  end
225
231
  end
226
232
 
233
+ def instrument_request(payload, &)
234
+ return yield unless RubyLLM.respond_to?(:instrument)
235
+
236
+ RubyLLM.instrument('request.ruby_llm', payload, config: @config, &)
237
+ end
238
+
227
239
  class << self
228
240
  def capabilities
229
241
  OpenAIResponses::Capabilities
230
242
  end
231
243
 
244
+ def configuration_options
245
+ %i[
246
+ openai_api_key
247
+ openai_api_base
248
+ openai_organization_id
249
+ openai_project_id
250
+ ]
251
+ end
252
+
232
253
  def configuration_requirements
233
254
  %i[openai_api_key]
234
255
  end
@@ -41,7 +41,7 @@ RubyLLM::Providers::OpenAIResponses::ModelRegistry.register_all!
41
41
  module RubyLLM
42
42
  # ResponsesAPI namespace for direct access to helpers and version
43
43
  module ResponsesAPI
44
- VERSION = '0.6.0'
44
+ VERSION = '0.6.1'
45
45
 
46
46
  # Shorthand access to built-in tool helpers
47
47
  BuiltInTools = Providers::OpenAIResponses::BuiltInTools
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm-responses_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hasinski