lex-agentic-learning 0.1.8 → 0.1.9
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 +4 -0
- data/README.md +1 -1
- data/lib/legion/extensions/agentic/learning/curiosity/runners/curiosity.rb +16 -4
- data/lib/legion/extensions/agentic/learning/version.rb +1 -1
- data/spec/legion/extensions/agentic/learning/curiosity/runners/curiosity_spec.rb +33 -0
- 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: 8f2bd98de70d5e11f07c18043483a22d4325508c7e2601fd2d1c3a3bdb9726bd
|
|
4
|
+
data.tar.gz: e1f9d5d06972b5fe01b932d973050d701aa82663bca6ff76709769df476ea80b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5858c88e16679558b7bf3d2433f3d88810a85f5a41cb7cf37991ccc22195569f65fffad058dbeb2aeaf359b89855dd3ac3330759da49e36c18c489afc08b713
|
|
7
|
+
data.tar.gz: 55abe2021cd74cbd3885d75a2ff321febe189d369e802ea910eced3d86ac9398adf807414880f006ab23b0a5b869f81a304093fdc10a05da8dedc6352136611a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.9] - 2026-04-28
|
|
4
|
+
### Fixed
|
|
5
|
+
- Curiosity self-inquiry now uses the current `Legion::LLM.ask` API before falling back to legacy `Legion::LLM.complete`, preserving compatibility with the LLM routing uplift.
|
|
6
|
+
|
|
3
7
|
## [0.1.8] - 2026-04-22
|
|
4
8
|
### Added
|
|
5
9
|
- 3 new decay actors: Curiosity::Decay (300s), EpistemicCuriosity::Decay (300s), Habit::Decay (300s)
|
data/README.md
CHANGED
|
@@ -139,14 +139,18 @@ module Legion
|
|
|
139
139
|
# Try via Lex helper (primary path inside Legion runtime)
|
|
140
140
|
if respond_to?(:lex, true)
|
|
141
141
|
result = lex(:llm, :complete, prompt: prompt, max_tokens: 300)
|
|
142
|
-
text = result
|
|
142
|
+
text = extract_llm_text(result)
|
|
143
143
|
return text if text && !text.empty?
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
-
# Direct LLM
|
|
147
|
-
if defined?(Legion::LLM) && Legion::LLM.respond_to?(:
|
|
146
|
+
# Direct LLM fallback for current legion-llm; complete is kept for older installs.
|
|
147
|
+
if defined?(Legion::LLM) && Legion::LLM.respond_to?(:ask)
|
|
148
|
+
result = Legion::LLM.ask(message: prompt) # rubocop:disable Legion/HelperMigration/DirectLlm
|
|
149
|
+
text = extract_llm_text(result)
|
|
150
|
+
return text if text && !text.empty?
|
|
151
|
+
elsif defined?(Legion::LLM) && Legion::LLM.respond_to?(:complete)
|
|
148
152
|
result = Legion::LLM.complete(prompt: prompt, max_tokens: 300)
|
|
149
|
-
text = result
|
|
153
|
+
text = extract_llm_text(result)
|
|
150
154
|
return text if text && !text.empty?
|
|
151
155
|
end
|
|
152
156
|
|
|
@@ -156,6 +160,14 @@ module Legion
|
|
|
156
160
|
nil
|
|
157
161
|
end
|
|
158
162
|
|
|
163
|
+
def extract_llm_text(result)
|
|
164
|
+
return result.strip if result.is_a?(String)
|
|
165
|
+
return nil unless result.is_a?(Hash)
|
|
166
|
+
|
|
167
|
+
text = result[:response] || result[:content] || result[:text] || result[:completion]
|
|
168
|
+
text&.to_s&.strip
|
|
169
|
+
end
|
|
170
|
+
|
|
159
171
|
def build_self_inquiry_prompt(question, domain)
|
|
160
172
|
<<~PROMPT.strip
|
|
161
173
|
You are GAIA, a thinking, curious AI. You are reflecting on a knowledge gap you detected in yourself.
|
|
@@ -156,4 +156,37 @@ RSpec.describe Legion::Extensions::Agentic::Learning::Curiosity::Runners::Curios
|
|
|
156
156
|
expect(result[:pruned]).to eq(1)
|
|
157
157
|
end
|
|
158
158
|
end
|
|
159
|
+
|
|
160
|
+
describe '#query_llm_for_wonder' do
|
|
161
|
+
before do
|
|
162
|
+
allow(client).to receive(:respond_to?).and_call_original
|
|
163
|
+
allow(client).to receive(:respond_to?).with(:lex, true).and_return(false)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it 'uses Legion::LLM.ask response hashes for current legion-llm' do
|
|
167
|
+
llm = Module.new do
|
|
168
|
+
def self.ask(message:)
|
|
169
|
+
raise 'missing prompt' if message.to_s.empty?
|
|
170
|
+
|
|
171
|
+
{ response: ' useful insight ' }
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
stub_const('Legion::LLM', llm)
|
|
175
|
+
|
|
176
|
+
expect(client.send(:query_llm_for_wonder, 'why?', :curiosity)).to eq('useful insight')
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
it 'keeps legacy Legion::LLM.complete fallback for older installs' do
|
|
180
|
+
llm = Module.new do
|
|
181
|
+
def self.complete(prompt:, max_tokens:)
|
|
182
|
+
raise 'missing prompt' if prompt.to_s.empty? || max_tokens != 300
|
|
183
|
+
|
|
184
|
+
{ content: 'legacy insight' }
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
stub_const('Legion::LLM', llm)
|
|
188
|
+
|
|
189
|
+
expect(client.send(:query_llm_for_wonder, 'why?', :curiosity)).to eq('legacy insight')
|
|
190
|
+
end
|
|
191
|
+
end
|
|
159
192
|
end
|