legion-llm 0.9.53 → 0.9.54
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '09bf7eb9fe4c93ccba0bb574864c66a518225327399b47a30dd08aa148ac3b74'
|
|
4
|
+
data.tar.gz: a54854addf081e387d94ed9fd3ba67f826df9b64ec3b042b2767a7e5a441d715
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69fa173952297d7da6410c101c9b9e13548514db85075188fdef153d0f9340f50c314e3f633432e5481c5a4d979468ea84dc3b24edff84d4d728a6d7df7f94c0
|
|
7
|
+
data.tar.gz: 52852f542515ec121bf1d9851506c3866e70cae5a551f034777f15d9c68fc7886888eb6d9c5cb9a9f58e18016d84d92d4dd010a58cc7c312b2c683bfb477815d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Legion LLM Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.54] - 2026-05-29
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- API: OpenAI-compatible streaming responses now include `usage` (`prompt_tokens`, `completion_tokens`, `total_tokens`) in the final done-chunk, allowing the Vercel AI SDK `step-finish` event to propagate token counts to clients (fixes empty Tokens display in Kai's response info popup)
|
|
7
|
+
|
|
3
8
|
## [0.9.53] - 2026-05-29
|
|
4
9
|
|
|
5
10
|
### Added
|
|
@@ -91,7 +91,13 @@ module Legion
|
|
|
91
91
|
nil,
|
|
92
92
|
model: final_model,
|
|
93
93
|
request_id: request_id,
|
|
94
|
-
finish_reason: tool_calls.empty? ? 'stop' : 'tool_calls'
|
|
94
|
+
finish_reason: tool_calls.empty? ? 'stop' : 'tool_calls',
|
|
95
|
+
usage: {
|
|
96
|
+
prompt_tokens: Legion::LLM::API::Translators::OpenAIResponse.extract_token_count(pipeline_response.tokens, :input),
|
|
97
|
+
completion_tokens: Legion::LLM::API::Translators::OpenAIResponse.extract_token_count(pipeline_response.tokens, :output),
|
|
98
|
+
total_tokens: Legion::LLM::API::Translators::OpenAIResponse.extract_token_count(pipeline_response.tokens, :input).to_i +
|
|
99
|
+
Legion::LLM::API::Translators::OpenAIResponse.extract_token_count(pipeline_response.tokens, :output).to_i
|
|
100
|
+
}
|
|
95
101
|
)
|
|
96
102
|
out << "data: #{Legion::JSON.dump(done_chunk)}\n\n"
|
|
97
103
|
out << "data: [DONE]\n\n"
|
|
@@ -57,17 +57,19 @@ module Legion
|
|
|
57
57
|
}
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
def format_stream_chunk(delta_text, model:, request_id:, finish_reason: nil)
|
|
60
|
+
def format_stream_chunk(delta_text, model:, request_id:, finish_reason: nil, usage: nil)
|
|
61
61
|
choice = { index: 0, delta: {}, finish_reason: finish_reason }
|
|
62
62
|
choice[:delta][:content] = delta_text if delta_text && !delta_text.empty?
|
|
63
63
|
|
|
64
|
-
{
|
|
64
|
+
chunk = {
|
|
65
65
|
id: "chatcmpl-#{request_id.delete('-')}",
|
|
66
66
|
object: 'chat.completion.chunk',
|
|
67
67
|
created: Time.now.to_i,
|
|
68
68
|
model: model.to_s,
|
|
69
69
|
choices: [choice]
|
|
70
70
|
}
|
|
71
|
+
chunk[:usage] = usage if usage
|
|
72
|
+
chunk
|
|
71
73
|
end
|
|
72
74
|
|
|
73
75
|
def format_stream_tool_call_chunk(tool_call, model:, request_id:, index:)
|
data/lib/legion/llm/version.rb
CHANGED