lex-llm 0.4.13 → 0.4.14
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: af47edfcf6813928e79139f3a1e584a1059dbc8a653b52cb08b3e6e044873c93
|
|
4
|
+
data.tar.gz: 178115b144324642a4a852f69a56290d4f8b82de2ccc71779f8104e7f27e8cf3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 245cc173b44eb04591e9ca7ff7923b83908d52c27e01f262c0afe3bcb4b38d8362f1251a81e8a8d61526a580986eff7a2f04eae7fd46f65f6d99550044fa2838
|
|
7
|
+
data.tar.gz: 5bd102f0c17824170060972729bb17aee68f401d512ce6be8d3c9018e01704c888f7b730ec8611d5af177b1eea854acb6cc2803c7f4784967288fe3d16b93239
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.14 - 2026-05-16
|
|
4
|
+
|
|
5
|
+
- Normalize `function_calling`, `functions`, and related tool-use capability aliases to include canonical `:tools` on model metadata and routing offerings.
|
|
6
|
+
- Keep provider compatibility aliases while allowing capability filters to reliably match tool-capable models.
|
|
7
|
+
|
|
3
8
|
## 0.4.13 - 2026-05-15
|
|
4
9
|
|
|
5
10
|
- Strip provider thinking from OpenAI-compatible responses when local models emit `<thinking>` tags or untagged initial reasoning preambles, and keep those hidden from live streaming content deltas.
|
|
@@ -4,6 +4,15 @@ module Legion
|
|
|
4
4
|
module Extensions
|
|
5
5
|
module Llm
|
|
6
6
|
module Model
|
|
7
|
+
CAPABILITY_ALIASES = {
|
|
8
|
+
function_calling: :tools,
|
|
9
|
+
functions: :tools,
|
|
10
|
+
tool: :tools,
|
|
11
|
+
tool_use: :tools,
|
|
12
|
+
stream: :streaming,
|
|
13
|
+
stream_chat: :streaming
|
|
14
|
+
}.freeze
|
|
15
|
+
|
|
7
16
|
Info = ::Data.define(
|
|
8
17
|
:id, :name, :provider, :instance, :family,
|
|
9
18
|
:capabilities, :context_length, :parameter_count,
|
|
@@ -171,7 +180,14 @@ module Legion
|
|
|
171
180
|
private
|
|
172
181
|
|
|
173
182
|
def normalize_symbols(value)
|
|
174
|
-
Array(value).
|
|
183
|
+
Array(value).compact.each_with_object([]) do |item, normalized|
|
|
184
|
+
symbol = item.to_s.downcase.strip.to_sym
|
|
185
|
+
next if symbol.to_s.empty?
|
|
186
|
+
|
|
187
|
+
normalized << symbol
|
|
188
|
+
alias_symbol = CAPABILITY_ALIASES[symbol]
|
|
189
|
+
normalized << alias_symbol if alias_symbol
|
|
190
|
+
end.uniq
|
|
175
191
|
end
|
|
176
192
|
|
|
177
193
|
def to_int(value)
|
|
@@ -6,6 +6,15 @@ module Legion
|
|
|
6
6
|
module Routing
|
|
7
7
|
# Describes one concrete model made available by one provider instance.
|
|
8
8
|
class ModelOffering
|
|
9
|
+
CAPABILITY_ALIASES = {
|
|
10
|
+
function_calling: :tools,
|
|
11
|
+
functions: :tools,
|
|
12
|
+
tool: :tools,
|
|
13
|
+
tool_use: :tools,
|
|
14
|
+
stream: :streaming,
|
|
15
|
+
stream_chat: :streaming
|
|
16
|
+
}.freeze
|
|
17
|
+
|
|
9
18
|
attr_reader :offering_id, :provider_family, :model_family, :provider_instance, :instance_id, :transport,
|
|
10
19
|
:tier, :model, :canonical_model_alias, :routing_metadata, :usage_type, :capabilities, :limits,
|
|
11
20
|
:credentials, :health, :cost, :policy_tags, :metadata
|
|
@@ -27,7 +36,7 @@ module Legion
|
|
|
27
36
|
fetch_value(data, :type) ||
|
|
28
37
|
fetch_value(data, :kind) ||
|
|
29
38
|
infer_usage_type(data)))
|
|
30
|
-
@capabilities =
|
|
39
|
+
@capabilities = normalize_capabilities(fetch_value(data, :capabilities))
|
|
31
40
|
@limits = normalize_hash(fetch_value(data, :limits))
|
|
32
41
|
@credentials = fetch_value(data, :credentials)
|
|
33
42
|
@health = normalize_hash(fetch_value(data, :health))
|
|
@@ -57,7 +66,7 @@ module Legion
|
|
|
57
66
|
end
|
|
58
67
|
|
|
59
68
|
def supports?(capability)
|
|
60
|
-
capabilities.include?(
|
|
69
|
+
normalize_capabilities([capability]).any? { |candidate| capabilities.include?(candidate) }
|
|
61
70
|
end
|
|
62
71
|
|
|
63
72
|
def eligible_for?(usage_type: nil, required_capabilities: [], min_context_window: nil, policy_tags: [])
|
|
@@ -120,7 +129,7 @@ module Legion
|
|
|
120
129
|
end
|
|
121
130
|
|
|
122
131
|
def infer_usage_type(data)
|
|
123
|
-
capabilities =
|
|
132
|
+
capabilities = normalize_capabilities(fetch_value(data, :capabilities))
|
|
124
133
|
return :embedding if capabilities.include?(:embedding) || capabilities.include?(:embed)
|
|
125
134
|
|
|
126
135
|
:inference
|
|
@@ -147,6 +156,17 @@ module Legion
|
|
|
147
156
|
Array(value).compact.map(&:to_sym)
|
|
148
157
|
end
|
|
149
158
|
|
|
159
|
+
def normalize_capabilities(value)
|
|
160
|
+
Array(value).compact.each_with_object([]) do |item, normalized|
|
|
161
|
+
symbol = item.to_s.downcase.strip.to_sym
|
|
162
|
+
next if symbol.to_s.empty?
|
|
163
|
+
|
|
164
|
+
normalized << symbol
|
|
165
|
+
alias_symbol = CAPABILITY_ALIASES[symbol]
|
|
166
|
+
normalized << alias_symbol if alias_symbol
|
|
167
|
+
end.uniq
|
|
168
|
+
end
|
|
169
|
+
|
|
150
170
|
def normalize_hash(value)
|
|
151
171
|
(value || {}).to_h.transform_keys(&:to_sym)
|
|
152
172
|
end
|
|
@@ -165,7 +185,7 @@ module Legion
|
|
|
165
185
|
end
|
|
166
186
|
|
|
167
187
|
def capabilities_match?(required)
|
|
168
|
-
|
|
188
|
+
normalize_capabilities(required).all? { |capability| capabilities.include?(capability) }
|
|
169
189
|
end
|
|
170
190
|
|
|
171
191
|
def context_window_matches?(minimum)
|