lex-llm-anthropic 0.2.9 → 0.2.10

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: d7687ad53b9f3aa50db888d664f8ac8e1dbdd92bac3701097b1aa40312a30ff9
4
- data.tar.gz: 1eaf4a5fdd3f40a27da9fb72983fafab2dd974f81e40ed1d0e73a0d82d4fec47
3
+ metadata.gz: 698085fefbd69b9c2689ac472c42ce579c05e0ef2be2d06dc146f324df2ba69e
4
+ data.tar.gz: c72e6c9974500f0285084da0da19af6390806ccfb4f93a9f42128e50a65205ad
5
5
  SHA512:
6
- metadata.gz: 8f44ddddc7211f40bd5e155d802c1b59983ebbd0fe4ed2db3f1e6e9e637dce9c4d9428a2fdf59a3190f59cba71ac9443448d2c488ceac213bda8d453d06bf1e2
7
- data.tar.gz: 979bcf878d565712f1d24a32aaeedb24f7311c05b36a82861c547dc1f37931b97f2bd997a17f5507ba91d77b27ba7f3a9cc658d6ecc81c98f6e6573b324da527
6
+ metadata.gz: 725109b45b7fdf9849fcbdffba9e1d8b338e0b6e80c23d495c0aac5ef06d733f075c19f6b6de8bf1d34ea77050efc53d71d0ecd42873f59a30afbf7e7bbe60ba
7
+ data.tar.gz: 3406970db252257e2c074455132e55d7166dc4180a4c06f5b803ed267e7a17030e523ed063511c87e48f5345141891bd9211ee555d749af8e9cde496bf5e8568
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.10 - 2026-05-18
4
+
5
+ - Fix streaming tool call input accumulation: `build_chunk` now handles both `content_block_start` (tool_use with id+name) and `input_json_delta` (partial argument fragments) events. Previously only the start event was parsed, resulting in tool calls with empty arguments.
6
+
7
+
3
8
  ## 0.2.9 - 2026-05-16
4
9
 
5
10
  - Advertise Anthropic tool support in discovered instance and model metadata so capability-aware routing can select Claude models for native tool requests.
@@ -347,10 +347,24 @@ module Legion
347
347
  ),
348
348
  input_tokens: data.dig('message', 'usage', 'input_tokens'),
349
349
  output_tokens: data.dig('message', 'usage', 'output_tokens') || data.dig('usage', 'output_tokens'),
350
- tool_calls: parse_tool_calls(data['content_block'])
350
+ tool_calls: extract_streaming_tool_calls(data, delta_type)
351
351
  )
352
352
  end
353
353
 
354
+ def extract_streaming_tool_calls(data, delta_type)
355
+ content_block = data['content_block']
356
+ if content_block && content_block['type'] == 'tool_use'
357
+ { content_block['id'] => Legion::Extensions::Llm::ToolCall.new(
358
+ id: content_block['id'], name: content_block['name'], arguments: ''
359
+ ) }
360
+ elsif delta_type == 'input_json_delta'
361
+ partial = data.dig('delta', 'partial_json')
362
+ return nil unless partial
363
+
364
+ { nil => Legion::Extensions::Llm::ToolCall.new(id: nil, name: nil, arguments: partial) }
365
+ end
366
+ end
367
+
354
368
  def parse_tool_calls(content_blocks)
355
369
  blocks = Array(content_blocks).select { |block| block && block['type'] == 'tool_use' }
356
370
  return nil if blocks.empty?
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Llm
6
6
  module Anthropic
7
- VERSION = '0.2.9'
7
+ VERSION = '0.2.10'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-llm-anthropic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - LegionIO