lex-llm-vllm 0.3.11 → 0.3.13

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: 66c6939650ded871419a3833d9d0a89e5c31a104f3acccbb065af86af17709cb
4
- data.tar.gz: e639e39a60ff4c03838100bd361048997fecfe38e92fdd9f1763809958a43f8e
3
+ metadata.gz: a62d4fc4e5b1020ccf9a4bcb5ed9c03096923075c7111357648cc1b360dd804b
4
+ data.tar.gz: 1cb2fe7f84f9fcd44b0c04407e62310e5fa4fad59bdfd2bc65889bfa8b9bd213
5
5
  SHA512:
6
- metadata.gz: cf346327446a5e3c7b8666c8ea04269d7fea32b7bbe89b9a0c11b7578fe3ca1a8f948cf4fc639265bfcfa6f0a65bca7007f24ce90146f6234f1589fcb6fe5c31
7
- data.tar.gz: 1e324da7463bd1a63b14b5fde9b3f6030be0f8cdd933d802d350066beaf40fe8208998a298a848b00126bf5d1d68868b8384c2ed719fb863c825179aa8c92ced
6
+ metadata.gz: 0a68362c7660f1474b943d8d67948e71b3d2b23840b39835937839bf5d2542d0baaa05b569764f77e5268cde1848dfca20e2e16274de6f112756a8eaa1b79ccc
7
+ data.tar.gz: de8011c0d1468c8d3f35215f01b7ee3ffa182d47c56dc89ac5fd983dcbf6f9de52ef167fc04d7514b984423081b65f4a8a6f5b463dc6d4372bbcbcdd90d7aa75
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.13] - 2026-07-14
4
+
5
+ ### Fixed
6
+ - **Streaming dead stop on Qwen with thinking enabled.** `empty_delta?` only checked `delta['reasoning_content']`, missing vLLM's `delta['reasoning']` field. When the final chunk carried `finish_reason: "stop"` alongside a `reasoning` delta, the translator incorrectly treated it as an empty delta and fired the done chunk early — the content phase never started, producing an empty streaming response. Now checks both `reasoning_content` and `reasoning`. Also fixed `wire_metadata` to read from either field for sync responses.
7
+
8
+ ## [0.3.12] - 2026-07-05
9
+
10
+ ### Changed
11
+ - Stop_reason mapping now uses the shared `Legion::Extensions::Llm::StopReasonMapping` mixin from lex-llm (>= 0.6.9) instead of a local `VLLM_STOP_REASON_MAP`. The local 3-entry map only recognized `tool_use` and silently fell back to `:end_turn` on the `tool_calls` finish_reason that OpenAI-compatible vLLM actually emits on tool turns — so vLLM tool completions were mis-reported as `end_turn`. The shared vocabulary maps both `tool_calls` and `tool_use` to `:tool_use` (plus `stop`/`end_turn`/`eos`, `length`/`max_tokens`, `stop_sequence`, `content_filter`), and is inherited by every provider so it no longer drifts per gem.
12
+
3
13
  ## [0.3.11] - 2026-06-20
4
14
 
5
15
  ### Fixed
data/lex-llm-vllm.gemspec CHANGED
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency 'legion-logging', '>= 1.3.2'
28
28
  spec.add_dependency 'legion-settings', '>= 1.3.14'
29
29
  spec.add_dependency 'legion-transport', '>= 1.4.14'
30
- spec.add_dependency 'lex-llm', '>= 0.6.0'
30
+ spec.add_dependency 'lex-llm', '>= 0.6.9'
31
31
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'legion/extensions/llm/canonical'
4
4
  require 'legion/extensions/llm/responses/thinking_extractor'
5
+ require 'legion/extensions/llm/stop_reason_mapping'
5
6
  require 'legion/json'
6
7
  require 'legion/logging'
7
8
 
@@ -25,13 +26,10 @@ module Legion
25
26
  # rubocop:disable Metrics/ClassLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity -- translator implementation
26
27
  class Translator
27
28
  include Legion::Logging::Helper
29
+ # Shared stop_reason vocabulary (tool_calls/tool_use/stop/length/...).
30
+ # vLLM is OpenAI-compatible and needs no additions; inherits the common map.
31
+ include Legion::Extensions::Llm::StopReasonMapping
28
32
 
29
- # vLLM-specific stop_reason mapping (per conformance fixture stop_reason_matrix).
30
- VLLM_STOP_REASON_MAP = {
31
- 'stop' => :end_turn,
32
- 'tool_use' => :tool_use,
33
- 'length' => :max_tokens
34
- }.freeze
35
33
  FALLBACK_STOP_REASON = :end_turn
36
34
 
37
35
  # G18 parameter mapping: supported canonical params.
@@ -200,7 +198,7 @@ module Legion
200
198
  tool_calls_as_text: true,
201
199
  forced_tool_choice: true,
202
200
  thinking_tags: %w[think thinking],
203
- stop_reason_map: VLLM_STOP_REASON_MAP,
201
+ stop_reason_map: stop_reason_map,
204
202
  streaming_token_usage: true
205
203
  }.freeze
206
204
  end
@@ -613,7 +611,8 @@ module Legion
613
611
 
614
612
  def wire_metadata(wire, message, _thinking_meta)
615
613
  meta = {}
616
- meta[:reasoning_content] = message['reasoning_content'] if message['reasoning_content']
614
+ reasoning = message['reasoning_content'] || message['reasoning']
615
+ meta[:reasoning_content] = reasoning if reasoning
617
616
  raw_usage = wire['usage']
618
617
  if raw_usage.is_a?(Hash) && raw_usage['completion_tokens_details']
619
618
  meta[:completion_tokens_details] = raw_usage['completion_tokens_details']
@@ -657,7 +656,8 @@ module Legion
657
656
  def empty_delta?(delta)
658
657
  (delta['content'].nil? || delta['content'].to_s.empty?) &&
659
658
  (delta['tool_calls'].nil? || Array(delta['tool_calls']).empty?) &&
660
- (delta['reasoning_content'].nil? || delta['reasoning_content'].to_s.empty?)
659
+ (delta['reasoning_content'].nil? || delta['reasoning_content'].to_s.empty?) &&
660
+ (delta['reasoning'].nil? || delta['reasoning'].to_s.empty?)
661
661
  end
662
662
 
663
663
  # Per-chunk think-tag extraction is structurally impossible while streaming:
@@ -694,7 +694,7 @@ module Legion
694
694
  def map_stop_reason(raw)
695
695
  return FALLBACK_STOP_REASON if raw.nil? || raw.to_s.empty?
696
696
 
697
- VLLM_STOP_REASON_MAP.fetch(raw.to_s, FALLBACK_STOP_REASON)
697
+ stop_reason_lookup(raw) || FALLBACK_STOP_REASON
698
698
  end
699
699
 
700
700
  # ── JSON helpers ──
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Llm
6
6
  module Vllm
7
- VERSION = '0.3.11'
7
+ VERSION = '0.3.13'
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-vllm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - LegionIO
@@ -71,14 +71,14 @@ dependencies:
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 0.6.0
74
+ version: 0.6.9
75
75
  type: :runtime
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: 0.6.0
81
+ version: 0.6.9
82
82
  description: vLLM provider integration for the LegionIO LLM routing framework.
83
83
  email:
84
84
  - matthewdiverson@gmail.com