lex-agentic-learning 0.1.10 → 0.1.11
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: 98b0f0afb82cb17c9db706827d06ce2f27e9a69c590170b720bfa986bcb5529d
|
|
4
|
+
data.tar.gz: d985458466141a279fe4c0b79aaeccf168b15246f6863e2ff7181bf90d88bb31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3bf9d04bee2e5d19aba000ec08d043caa79fd704eea2414adcb89277a88e655784933bc5a358415a3d5a7319b3cc044bee04cc3fd6d2ab6fb74b4f932c3eac1b
|
|
7
|
+
data.tar.gz: 92193dbf3ffb4efeb3ec9c52751888a3798764652f75bee7b610e8b91e743fc27f286cbbef65eff134fe1adce4c478c6022fe6c650118cfa331f1160b736e122
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.11] - 2026-05-07
|
|
4
|
+
### Fixed
|
|
5
|
+
- Curiosity self-inquiry now uses native `Legion::LLM.chat` response hashes directly and avoids obsolete legacy LLM fallback calls after native chat succeeds.
|
|
6
|
+
|
|
3
7
|
## [0.1.10] - 2026-04-28
|
|
4
8
|
### Fixed
|
|
5
9
|
- Curiosity self-inquiry now prefers the current `Legion::LLM.ask` router before legacy helper fallbacks, preventing old `lex(:llm, :complete)` failures from hiding native LLM availability.
|
|
@@ -136,20 +136,15 @@ module Legion
|
|
|
136
136
|
def query_llm_for_wonder(question, domain)
|
|
137
137
|
prompt = build_self_inquiry_prompt(question, domain)
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return text if text && !text.empty?
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
if defined?(Legion::LLM) && Legion::LLM.respond_to?(:complete)
|
|
152
|
-
result = Legion::LLM.complete(prompt: prompt, max_tokens: 300)
|
|
139
|
+
if defined?(Legion::LLM) && Legion::LLM.respond_to?(:chat)
|
|
140
|
+
result = Legion::LLM.chat( # rubocop:disable Legion/HelperMigration/DirectLlm
|
|
141
|
+
message: prompt,
|
|
142
|
+
caller: {
|
|
143
|
+
extension: 'lex-agentic-learning',
|
|
144
|
+
operation: 'curiosity',
|
|
145
|
+
phase: 'self_inquiry'
|
|
146
|
+
}
|
|
147
|
+
)
|
|
153
148
|
text = extract_llm_text(result)
|
|
154
149
|
return text if text && !text.empty?
|
|
155
150
|
end
|
|
@@ -160,19 +155,13 @@ module Legion
|
|
|
160
155
|
nil
|
|
161
156
|
end
|
|
162
157
|
|
|
163
|
-
def query_legacy_lex_llm(prompt)
|
|
164
|
-
result = lex(:llm, :complete, prompt: prompt, max_tokens: 300)
|
|
165
|
-
extract_llm_text(result)
|
|
166
|
-
rescue StandardError => e
|
|
167
|
-
log.warn "[curiosity:self_inquiry] legacy lex LLM query failed: #{e.class}: #{e.message}"
|
|
168
|
-
nil
|
|
169
|
-
end
|
|
170
|
-
|
|
171
158
|
def extract_llm_text(result)
|
|
172
159
|
return result.strip if result.is_a?(String)
|
|
160
|
+
return result.content.to_s.strip if result.respond_to?(:content)
|
|
173
161
|
return nil unless result.is_a?(Hash)
|
|
174
162
|
|
|
175
|
-
text = result[:response] || result[:content] || result[:text] || result[:completion]
|
|
163
|
+
text = result[:response] || result[:content] || result[:text] || result[:completion] ||
|
|
164
|
+
result.dig(:message, :content) || result.dig('message', 'content')
|
|
176
165
|
text&.to_s&.strip
|
|
177
166
|
end
|
|
178
167
|
|
|
@@ -163,12 +163,12 @@ RSpec.describe Legion::Extensions::Agentic::Learning::Curiosity::Runners::Curios
|
|
|
163
163
|
allow(client).to receive(:respond_to?).with(:lex, true).and_return(false)
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
-
it 'uses Legion::LLM.
|
|
166
|
+
it 'uses Legion::LLM.chat response hashes for current legion-llm' do
|
|
167
167
|
llm = Module.new do
|
|
168
|
-
def self.
|
|
168
|
+
def self.chat(message:, **)
|
|
169
169
|
raise 'missing prompt' if message.to_s.empty?
|
|
170
170
|
|
|
171
|
-
{
|
|
171
|
+
{ content: ' useful insight ' }
|
|
172
172
|
end
|
|
173
173
|
end
|
|
174
174
|
stub_const('Legion::LLM', llm)
|
|
@@ -176,33 +176,27 @@ RSpec.describe Legion::Extensions::Agentic::Learning::Curiosity::Runners::Curios
|
|
|
176
176
|
expect(client.send(:query_llm_for_wonder, 'why?', :curiosity)).to eq('useful insight')
|
|
177
177
|
end
|
|
178
178
|
|
|
179
|
-
it 'does not
|
|
179
|
+
it 'does not call legacy LLM paths when native chat succeeds' do
|
|
180
180
|
allow(client).to receive(:respond_to?).with(:lex, true).and_return(true)
|
|
181
|
-
|
|
181
|
+
expect(client).not_to receive(:lex)
|
|
182
182
|
|
|
183
183
|
llm = Module.new do
|
|
184
|
-
def self.
|
|
184
|
+
def self.chat(message:, **)
|
|
185
185
|
raise 'missing prompt' if message.to_s.empty?
|
|
186
186
|
|
|
187
|
-
{
|
|
187
|
+
{ content: 'chat survived' }
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
stub_const('Legion::LLM', llm)
|
|
191
191
|
|
|
192
|
-
expect(client.send(:query_llm_for_wonder, 'why?', :curiosity)).to eq('
|
|
192
|
+
expect(client.send(:query_llm_for_wonder, 'why?', :curiosity)).to eq('chat survived')
|
|
193
193
|
end
|
|
194
194
|
|
|
195
|
-
it '
|
|
196
|
-
llm = Module.new
|
|
197
|
-
def self.complete(prompt:, max_tokens:)
|
|
198
|
-
raise 'missing prompt' if prompt.to_s.empty? || max_tokens != 300
|
|
199
|
-
|
|
200
|
-
{ content: 'legacy insight' }
|
|
201
|
-
end
|
|
202
|
-
end
|
|
195
|
+
it 'returns nil when native chat is unavailable' do
|
|
196
|
+
llm = Module.new
|
|
203
197
|
stub_const('Legion::LLM', llm)
|
|
204
198
|
|
|
205
|
-
expect(client.send(:query_llm_for_wonder, 'why?', :curiosity)).to
|
|
199
|
+
expect(client.send(:query_llm_for_wonder, 'why?', :curiosity)).to be_nil
|
|
206
200
|
end
|
|
207
201
|
end
|
|
208
202
|
end
|