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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06c8e0373f627e588f41b1c2d8fda18fd75bbc0e673ab270ec0d08bfe27695ec
4
- data.tar.gz: 15c2e48761d2e797e144178db61363344663c9860918ddd001088532eaad84ee
3
+ metadata.gz: bea0deb0330e257b0a513675970bd988c5b157170e1bf46569482e9203578681
4
+ data.tar.gz: 9af8c0c5e9d6911f95f738bfd840c3dd1989e2503da7042357332e1c394fe930
5
5
  SHA512:
6
- metadata.gz: e4420346b02d8ec03fb5b80d930f678256245b4b80bd75076e9be15e9abf82d3f569af16f0278cbc78ec0bf8deb6058484045beb27fee8db265f8abf37a67d87
7
- data.tar.gz: e1477099d25547be1bd2f3556a19d1d38a6ce7c77eb3b856c03c0605d1d2510eaa173828e63ed7e1d2763dc2d4f036e754bc93c274b5a98b3437de72bc72aeaf
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
- augmented = [{ role: 'system', content: instruction }] + Array(messages)
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
- messages: augmented, **opts.except(:attempt))
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
- augmented = Array(messages) + [{ role: 'user', content: instruction }]
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
- messages: augmented, **opts.except(:attempt))
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module LLM
5
- VERSION = '0.8.22'
5
+ VERSION = '0.8.23'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.22
4
+ version: 0.8.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity