legion-llm 0.8.22 → 0.8.23
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/legion/llm/call/structured_output.rb +13 -4
- data/lib/legion/llm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bea0deb0330e257b0a513675970bd988c5b157170e1bf46569482e9203578681
|
|
4
|
+
data.tar.gz: 9af8c0c5e9d6911f95f738bfd840c3dd1989e2503da7042357332e1c394fe930
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff80717d479fb79c9c2ea60123828b50c218ce549d90c7d6a9605885c8791c1a078c48a232d4b5437213c904206c326d7b832348eabf694caef8e7cb30abdfcd
|
|
7
|
+
data.tar.gz: d81969d08b0dd13e6447a662aaeb4c4a0c43fe07cfe3e4a2af328bd30ab9d09df0e817a6ffaa8b296e44ebdb00d4a4f2b70f55a3f86c59e1f8b18c0207fb4da2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Legion LLM Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.23] - 2026-04-23
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- `Call::StructuredOutput` prompt-fallback path passed `messages:` (plural) to `chat_single` which only accepts `message:` (singular), leaking the unknown kwarg into `RubyLLM::Chat.new`. Visible as repeated "unknown keyword: :messages" warnings during dream cycle contradiction detection. Flattened instruction + messages into a single string via `extract_user_content`.
|
|
7
|
+
|
|
3
8
|
## [0.8.22] - 2026-04-22
|
|
4
9
|
|
|
5
10
|
### Fixed
|
|
@@ -36,10 +36,10 @@ module Legion
|
|
|
36
36
|
instruction = "You MUST respond with valid JSON matching this schema:\n" \
|
|
37
37
|
"```json\n#{Legion::JSON.dump(schema)}\n```\n" \
|
|
38
38
|
'Respond with ONLY the JSON object, no other text.'
|
|
39
|
-
|
|
39
|
+
user_content = extract_user_content(messages, instruction)
|
|
40
40
|
Legion::LLM::Inference.send(:chat_single,
|
|
41
41
|
model: model, provider: provider, intent: nil, tier: nil,
|
|
42
|
-
|
|
42
|
+
message: user_content, **opts.except(:attempt))
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -55,10 +55,10 @@ module Legion
|
|
|
55
55
|
|
|
56
56
|
def retry_with_instruction(messages, schema, model, provider: nil, **opts)
|
|
57
57
|
instruction = "Your previous response was not valid JSON. Respond with ONLY a valid JSON object matching this schema:\n#{Legion::JSON.dump(schema)}"
|
|
58
|
-
|
|
58
|
+
user_content = extract_user_content(messages, instruction)
|
|
59
59
|
result = Legion::LLM::Inference.send(:chat_single,
|
|
60
60
|
model: model, provider: provider, intent: nil, tier: nil,
|
|
61
|
-
|
|
61
|
+
message: user_content, **opts.except(:attempt))
|
|
62
62
|
|
|
63
63
|
parsed = Legion::JSON.load(result[:content])
|
|
64
64
|
{ data: parsed, raw: result[:content], model: result[:model], valid: true, retried: true }
|
|
@@ -67,6 +67,15 @@ module Legion
|
|
|
67
67
|
{ data: nil, error: e.message, valid: false }
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
def extract_user_content(messages, instruction)
|
|
71
|
+
parts = [instruction]
|
|
72
|
+
Array(messages).each do |msg|
|
|
73
|
+
content = msg[:content] || msg['content']
|
|
74
|
+
parts << content.to_s unless content.to_s.empty?
|
|
75
|
+
end
|
|
76
|
+
parts.join("\n\n")
|
|
77
|
+
end
|
|
78
|
+
|
|
70
79
|
def supports_response_format?(model)
|
|
71
80
|
SCHEMA_CAPABLE_MODELS.any? { |m| model.to_s.include?(m) }
|
|
72
81
|
end
|
data/lib/legion/llm/version.rb
CHANGED