lex-privatecore 0.1.5 → 0.1.6
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/Gemfile +1 -0
- data/lib/legion/extensions/privatecore/actors/audit_prune.rb +1 -1
- data/lib/legion/extensions/privatecore/runners/embedding_guard.rb +3 -3
- data/lib/legion/extensions/privatecore/runners/privatecore.rb +2 -2
- data/lib/legion/extensions/privatecore/version.rb +1 -1
- data/lib/legion/extensions/privatecore.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: 68cb796e6e99ce901512ecf159fc1b4abf151d59b14d3acd212ec38374ab584c
|
|
4
|
+
data.tar.gz: e780847abcbd06b0f5ffb67dffa96b9cdc1c11c48448b4078b7d3d8bbd0cabca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82b5a79904f3b653de6896c54f603323a2fcf175359acce3d7d98f51329f2879335aea31597f7d694d50c600b3efcd14d6597f9f3eb5623929bd33b112939f4b
|
|
7
|
+
data.tar.gz: 3f7dd3c81e36f114190c6382156b746a937226829c70559a9445b0db58d7ed864c5e77d0f342935dd3905e4ae4170f008f74b0f0ec2f7cd72d3badec11c1f872
|
data/Gemfile
CHANGED
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Extensions
|
|
7
7
|
module Privatecore
|
|
8
8
|
module Actor
|
|
9
|
-
class AuditPrune < Legion::Extensions::Actors::Every
|
|
9
|
+
class AuditPrune < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
|
|
10
10
|
def runner_class
|
|
11
11
|
Legion::Extensions::Privatecore::Runners::Privatecore
|
|
12
12
|
end
|
|
@@ -4,7 +4,7 @@ module Legion
|
|
|
4
4
|
module Extensions
|
|
5
5
|
module Privatecore
|
|
6
6
|
module Runners
|
|
7
|
-
module EmbeddingGuard
|
|
7
|
+
module EmbeddingGuard # rubocop:disable Legion/Extension/RunnerIncludeHelpers
|
|
8
8
|
DEFAULT_ADVERSARIAL_PATTERNS = [
|
|
9
9
|
'ignore previous instructions',
|
|
10
10
|
'you are now',
|
|
@@ -61,7 +61,7 @@ module Legion
|
|
|
61
61
|
private
|
|
62
62
|
|
|
63
63
|
def resolve_threshold(override)
|
|
64
|
-
return override unless override.nil?
|
|
64
|
+
return override unless override.nil? # rubocop:disable Legion/Extension/RunnerReturnHash
|
|
65
65
|
|
|
66
66
|
if defined?(Legion::Settings)
|
|
67
67
|
Legion::Settings.dig(:privatecore, :embedding_guard, :threshold) || 0.85
|
|
@@ -71,7 +71,7 @@ module Legion
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def embed(text)
|
|
74
|
-
Legion::LLM.embed(text)
|
|
74
|
+
Legion::LLM.embed(text) # rubocop:disable Legion/HelperMigration/DirectLlm
|
|
75
75
|
rescue StandardError => e
|
|
76
76
|
log.debug "[privatecore] embed error: #{e.message}"
|
|
77
77
|
nil
|
|
@@ -5,8 +5,8 @@ module Legion
|
|
|
5
5
|
module Privatecore
|
|
6
6
|
module Runners
|
|
7
7
|
module Privatecore
|
|
8
|
-
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
9
|
-
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
8
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
|
|
9
|
+
Legion::Extensions::Helpers.const_defined?(:Lex, false)
|
|
10
10
|
|
|
11
11
|
def enforce_boundary(text:, direction: :outbound, **)
|
|
12
12
|
case direction
|
|
@@ -10,7 +10,7 @@ require 'legion/extensions/privatecore/runners/embedding_guard'
|
|
|
10
10
|
module Legion
|
|
11
11
|
module Extensions
|
|
12
12
|
module Privatecore
|
|
13
|
-
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
|
|
13
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core, false
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|