legionio 1.4.189 → 1.4.190
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 +8 -0
- data/lib/legion/guardrails.rb +6 -3
- data/lib/legion/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: 4b136bf0f2f2e32c879f8d83d2f5347ca030903bb6fdaee089f16b82ea0a07e1
|
|
4
|
+
data.tar.gz: 0be1a905e4d7d63864f900395a0a7e387be9e05a78173e0590e21bcb1980e775
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb553891cc502e622ef8b96d541b27dcfeba2f68410f3ecfae8b799279456f1ed5ea94a1a6e0f19ab60c948a87ce7ae2c8d1337bfad3818bd80c83c69e179c09
|
|
7
|
+
data.tar.gz: fbf3214bab1a73614e42a9adf82f39961cc1515d8ad19b3a28940683d191d843ceb56bd1ca03830b64d84cb832d7e7a83e480e4b80a9e2f2c92d739194af32e0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Legion Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.190] - 2026-03-23
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Migrate `Guardrails::RAGRelevancy` to use `Legion::LLM.chat` (public API) instead of the private `chat_single` method
|
|
7
|
+
- Add `Guardrails::SYSTEM_CALLER` constant with system pipeline identity to prevent infinite recursion when guardrails calls the LLM through the pipeline
|
|
8
|
+
- The `:system` profile skips governance steps (rbac, classification, billing, gaia_advisory, rag_context, context_load) — guardrails is internal infrastructure, not a user request
|
|
9
|
+
- Add specs covering `SYSTEM_CALLER` structure and LLM call behavior in `RAGRelevancy`
|
|
10
|
+
|
|
3
11
|
## [1.4.189] - 2026-03-23
|
|
4
12
|
|
|
5
13
|
### Changed
|
data/lib/legion/guardrails.rb
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Legion
|
|
4
4
|
module Guardrails
|
|
5
|
+
SYSTEM_CALLER = { requested_by: { identity: 'system:guardrails', type: :system, credential: :internal } }.freeze
|
|
6
|
+
|
|
5
7
|
module EmbeddingSimilarity
|
|
6
8
|
class << self
|
|
7
9
|
def check(input, safe_embeddings:, threshold: 0.3)
|
|
@@ -36,12 +38,13 @@ module Legion
|
|
|
36
38
|
def check(question:, context:, answer:, threshold: 3)
|
|
37
39
|
return { relevant: true, reason: 'no LLM' } unless defined?(Legion::LLM)
|
|
38
40
|
|
|
39
|
-
result = Legion::LLM.
|
|
40
|
-
|
|
41
|
+
result = Legion::LLM.chat(
|
|
42
|
+
message: [
|
|
41
43
|
{ role: 'system',
|
|
42
44
|
content: 'Rate 1-5 how relevant the answer is to the question given the context. Reply ONLY with the number.' },
|
|
43
45
|
{ role: 'user', content: "Question: #{question}\nContext: #{context}\nAnswer: #{answer}" }
|
|
44
|
-
]
|
|
46
|
+
],
|
|
47
|
+
caller: Guardrails::SYSTEM_CALLER
|
|
45
48
|
)
|
|
46
49
|
score = result[:content].to_s.strip.to_i
|
|
47
50
|
relevant = score >= threshold
|
data/lib/legion/version.rb
CHANGED