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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5780ec4e2aade493aadfb8bb89b34479fed6f780f1213c068175693c3c3714e3
4
- data.tar.gz: 4a6afb98e55a763080a68f34aaae378484492e60e3b8af35acf68da6518d965b
3
+ metadata.gz: 4b136bf0f2f2e32c879f8d83d2f5347ca030903bb6fdaee089f16b82ea0a07e1
4
+ data.tar.gz: 0be1a905e4d7d63864f900395a0a7e387be9e05a78173e0590e21bcb1980e775
5
5
  SHA512:
6
- metadata.gz: 7d386639fc8385b0c8a414385f07b6f9265e8d621a581804cfd726f9232bc412564cf6dcda870418866a58364a96662f740134f6eacfb8ceffc2f6ecd4c8b9ea
7
- data.tar.gz: 489116a6993b078dcc234066339d986946211495f1824ace4f3075a173772ed43d00ef77689897708251bf6431c52c96eaf4c8a809bac59ae1f24daf5b861532
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
@@ -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.chat_single(
40
- messages: [
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Legion
4
- VERSION = '1.4.189'
4
+ VERSION = '1.4.190'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legionio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.189
4
+ version: 1.4.190
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity