lex-apollo 0.4.15 → 0.4.16
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 +5 -0
- data/lib/legion/extensions/apollo/actors/entity_watchdog.rb +2 -2
- data/lib/legion/extensions/apollo/actors/gas_subscriber.rb +3 -3
- data/lib/legion/extensions/apollo/actors/ingest.rb +3 -3
- data/lib/legion/extensions/apollo/actors/query_responder.rb +3 -3
- data/lib/legion/extensions/apollo/actors/writeback_store.rb +3 -3
- data/lib/legion/extensions/apollo/actors/writeback_vectorize.rb +3 -3
- data/lib/legion/extensions/apollo/helpers/capability.rb +1 -5
- data/lib/legion/extensions/apollo/helpers/confidence.rb +1 -5
- data/lib/legion/extensions/apollo/helpers/entity_watchdog.rb +1 -5
- data/lib/legion/extensions/apollo/helpers/similarity.rb +1 -5
- data/lib/legion/extensions/apollo/helpers/tag_normalizer.rb +1 -2
- data/lib/legion/extensions/apollo/helpers/writeback.rb +2 -6
- data/lib/legion/extensions/apollo/runners/entity_extractor.rb +1 -1
- data/lib/legion/extensions/apollo/runners/gas.rb +2 -6
- data/lib/legion/extensions/apollo/runners/knowledge.rb +2 -2
- data/lib/legion/extensions/apollo/runners/request.rb +2 -2
- data/lib/legion/extensions/apollo/transport/exchanges/apollo.rb +1 -1
- data/lib/legion/extensions/apollo/transport/exchanges/llm_audit.rb +1 -1
- data/lib/legion/extensions/apollo/transport/messages/ingest.rb +1 -1
- data/lib/legion/extensions/apollo/transport/messages/query.rb +1 -1
- data/lib/legion/extensions/apollo/transport/messages/writeback.rb +1 -1
- data/lib/legion/extensions/apollo/transport/queues/gas.rb +1 -1
- data/lib/legion/extensions/apollo/transport/queues/ingest.rb +1 -1
- data/lib/legion/extensions/apollo/transport/queues/query.rb +1 -1
- data/lib/legion/extensions/apollo/transport/queues/writeback_store.rb +1 -1
- data/lib/legion/extensions/apollo/transport/queues/writeback_vectorize.rb +1 -1
- data/lib/legion/extensions/apollo/version.rb +1 -1
- data/lib/legion/extensions/apollo.rb +2 -2
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c57e41cb0b9936b5b3933e847385ff6eed5581c29b2bd53ee15bab8d04972634
|
|
4
|
+
data.tar.gz: 0a48e91fafd9a6116e47b9c0e2c6fc411f915930669ad6b182e55b37fe7e26bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e781def1a51ef817fb607300bd5439844289ad8d8a77de4ef103d6187c01a4681ee1cf2db917b03adf3df7898b6ab05b4f0a7330631fee6d4e5fa54a3054f805
|
|
7
|
+
data.tar.gz: 1f392189d7e2b42da4bfcf1d92d980e2b813b68fb6c88e18c275b57afdf5cb741d84311fd5092f8552ef7c18f62f660e2a197f79cfd8c7bcde709fe474aa368e
|
data/CHANGELOG.md
CHANGED
|
@@ -24,9 +24,9 @@ module Legion
|
|
|
24
24
|
def check_subtask? = false
|
|
25
25
|
def generate_task? = false
|
|
26
26
|
|
|
27
|
-
def enabled?
|
|
27
|
+
def enabled? # rubocop:disable Legion/Extension/ActorEnabledSideEffects
|
|
28
28
|
defined?(Legion::Extensions::Apollo::Runners::EntityExtractor) &&
|
|
29
|
-
|
|
29
|
+
Legion.const_defined?(:Transport, false)
|
|
30
30
|
rescue StandardError => e
|
|
31
31
|
log.warn("EntityWatchdog enabled? check failed: #{e.message}")
|
|
32
32
|
false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/actors/subscription'
|
|
3
|
+
require 'legion/extensions/actors/subscription'
|
|
4
4
|
|
|
5
5
|
module Legion
|
|
6
6
|
module Extensions
|
|
@@ -13,9 +13,9 @@ module Legion
|
|
|
13
13
|
def generate_task? = false
|
|
14
14
|
def use_runner? = false
|
|
15
15
|
|
|
16
|
-
def enabled?
|
|
16
|
+
def enabled? # rubocop:disable Legion/Extension/ActorEnabledSideEffects
|
|
17
17
|
defined?(Legion::Extensions::Apollo::Runners::Gas) &&
|
|
18
|
-
|
|
18
|
+
Legion.const_defined?(:Transport, false)
|
|
19
19
|
rescue StandardError => e
|
|
20
20
|
log.warn("GasSubscriber enabled? check failed: #{e.message}")
|
|
21
21
|
false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/actors/subscription'
|
|
3
|
+
require 'legion/extensions/actors/subscription'
|
|
4
4
|
|
|
5
5
|
module Legion
|
|
6
6
|
module Extensions
|
|
@@ -12,9 +12,9 @@ module Legion
|
|
|
12
12
|
def check_subtask? = false
|
|
13
13
|
def generate_task? = false
|
|
14
14
|
|
|
15
|
-
def enabled?
|
|
15
|
+
def enabled? # rubocop:disable Legion/Extension/ActorEnabledSideEffects
|
|
16
16
|
defined?(Legion::Extensions::Apollo::Runners::Knowledge) &&
|
|
17
|
-
|
|
17
|
+
Legion.const_defined?(:Transport, false)
|
|
18
18
|
rescue StandardError => e
|
|
19
19
|
log.warn("Ingest enabled? check failed: #{e.message}")
|
|
20
20
|
false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/actors/subscription'
|
|
3
|
+
require 'legion/extensions/actors/subscription'
|
|
4
4
|
|
|
5
5
|
module Legion
|
|
6
6
|
module Extensions
|
|
@@ -12,9 +12,9 @@ module Legion
|
|
|
12
12
|
def check_subtask? = false
|
|
13
13
|
def generate_task? = false
|
|
14
14
|
|
|
15
|
-
def enabled?
|
|
15
|
+
def enabled? # rubocop:disable Legion/Extension/ActorEnabledSideEffects
|
|
16
16
|
defined?(Legion::Extensions::Apollo::Runners::Knowledge) &&
|
|
17
|
-
|
|
17
|
+
Legion.const_defined?(:Transport, false)
|
|
18
18
|
rescue StandardError => e
|
|
19
19
|
log.warn("QueryResponder enabled? check failed: #{e.message}")
|
|
20
20
|
false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/actors/subscription'
|
|
3
|
+
require 'legion/extensions/actors/subscription'
|
|
4
4
|
|
|
5
5
|
module Legion
|
|
6
6
|
module Extensions
|
|
@@ -12,9 +12,9 @@ module Legion
|
|
|
12
12
|
def check_subtask? = false
|
|
13
13
|
def generate_task? = false
|
|
14
14
|
|
|
15
|
-
def enabled?
|
|
15
|
+
def enabled? # rubocop:disable Legion/Extension/ActorEnabledSideEffects
|
|
16
16
|
defined?(Legion::Extensions::Apollo::Runners::Knowledge) &&
|
|
17
|
-
|
|
17
|
+
Legion.const_defined?(:Transport, false) &&
|
|
18
18
|
Helpers::Capability.apollo_write_enabled?
|
|
19
19
|
rescue StandardError => e
|
|
20
20
|
log.warn("WritebackStore enabled? check failed: #{e.message}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'legion/extensions/actors/subscription'
|
|
3
|
+
require 'legion/extensions/actors/subscription'
|
|
4
4
|
|
|
5
5
|
module Legion
|
|
6
6
|
module Extensions
|
|
@@ -32,8 +32,8 @@ module Legion
|
|
|
32
32
|
{ success: false, error: e.message }
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
def enabled?
|
|
36
|
-
|
|
35
|
+
def enabled? # rubocop:disable Legion/Extension/ActorEnabledSideEffects
|
|
36
|
+
Legion.const_defined?(:Transport, false) && Helpers::Capability.can_embed?
|
|
37
37
|
rescue StandardError => e
|
|
38
38
|
log.warn("WritebackVectorize enabled? check failed: #{e.message}")
|
|
39
39
|
false
|
|
@@ -10,11 +10,7 @@ module Legion
|
|
|
10
10
|
module_function
|
|
11
11
|
|
|
12
12
|
def log
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@log ||= Object.new.tap do |nl|
|
|
16
|
-
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
17
|
-
end
|
|
13
|
+
Legion::Logging
|
|
18
14
|
end
|
|
19
15
|
|
|
20
16
|
def can_embed?
|
|
@@ -21,11 +21,7 @@ module Legion
|
|
|
21
21
|
module_function
|
|
22
22
|
|
|
23
23
|
def log
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@log ||= Object.new.tap do |nl|
|
|
27
|
-
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
28
|
-
end
|
|
24
|
+
Legion::Logging
|
|
29
25
|
end
|
|
30
26
|
|
|
31
27
|
def apollo_setting(*keys, default:)
|
|
@@ -13,11 +13,7 @@ module Legion
|
|
|
13
13
|
|
|
14
14
|
class << self
|
|
15
15
|
def log
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@log ||= Object.new.tap do |nl|
|
|
19
|
-
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
20
|
-
end
|
|
16
|
+
Legion::Logging
|
|
21
17
|
end
|
|
22
18
|
|
|
23
19
|
def detect_entities(text:, types: nil)
|
|
@@ -10,11 +10,7 @@ module Legion
|
|
|
10
10
|
module_function
|
|
11
11
|
|
|
12
12
|
def log
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@log ||= Object.new.tap do |nl|
|
|
16
|
-
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
17
|
-
end
|
|
13
|
+
Legion::Logging
|
|
18
14
|
end
|
|
19
15
|
|
|
20
16
|
def cosine_similarity(vec_a:, vec_b:, **)
|
|
@@ -16,8 +16,7 @@ module Legion
|
|
|
16
16
|
tag = raw.to_s.strip.downcase
|
|
17
17
|
tag = ALIASES[tag] if ALIASES.key?(tag)
|
|
18
18
|
tag = tag.gsub(/[^a-z0-9\- ]/, '')
|
|
19
|
-
.gsub(/\s+/, '-')
|
|
20
|
-
.gsub(/-+/, '-')
|
|
19
|
+
.gsub(/\s+/, '-').squeeze('-')
|
|
21
20
|
.sub(/^-/, '')
|
|
22
21
|
.sub(/-$/, '')
|
|
23
22
|
tag.empty? ? nil : tag
|
|
@@ -15,11 +15,7 @@ module Legion
|
|
|
15
15
|
module_function
|
|
16
16
|
|
|
17
17
|
def log
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@log ||= Object.new.tap do |nl|
|
|
21
|
-
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
22
|
-
end
|
|
18
|
+
Legion::Logging
|
|
23
19
|
end
|
|
24
20
|
|
|
25
21
|
def evaluate_and_route(request:, response:, enrichments: {})
|
|
@@ -96,7 +92,7 @@ module Legion
|
|
|
96
92
|
end
|
|
97
93
|
|
|
98
94
|
def publish_to_transport(payload, has_embedding: false)
|
|
99
|
-
return unless
|
|
95
|
+
return unless Legion.const_defined?(:Transport, false)
|
|
100
96
|
|
|
101
97
|
Transport::Messages::Writeback.new(
|
|
102
98
|
**payload, has_embedding: has_embedding
|
|
@@ -4,7 +4,7 @@ module Legion
|
|
|
4
4
|
module Extensions
|
|
5
5
|
module Apollo
|
|
6
6
|
module Runners
|
|
7
|
-
module EntityExtractor
|
|
7
|
+
module EntityExtractor # rubocop:disable Legion/Extension/RunnerIncludeHelpers
|
|
8
8
|
DEFAULT_ENTITY_TYPES = %w[person service repository concept].freeze
|
|
9
9
|
DEFAULT_MIN_CONFIDENCE = 0.7
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ module Legion
|
|
|
4
4
|
module Extensions
|
|
5
5
|
module Apollo
|
|
6
6
|
module Runners
|
|
7
|
-
module Gas
|
|
7
|
+
module Gas # rubocop:disable Legion/Extension/RunnerIncludeHelpers
|
|
8
8
|
RELATION_TYPES = %w[
|
|
9
9
|
similar_to contradicts depends_on causes
|
|
10
10
|
part_of supersedes supports_by extends
|
|
@@ -17,11 +17,7 @@ module Legion
|
|
|
17
17
|
module_function
|
|
18
18
|
|
|
19
19
|
def log
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@log ||= Object.new.tap do |nl|
|
|
23
|
-
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
24
|
-
end
|
|
20
|
+
Legion::Logging
|
|
25
21
|
end
|
|
26
22
|
|
|
27
23
|
def json_load(str)
|
|
@@ -118,7 +118,7 @@ module Legion
|
|
|
118
118
|
{ success: false, error: e.message }
|
|
119
119
|
end
|
|
120
120
|
|
|
121
|
-
def handle_query(query:, limit: Helpers::GraphQuery.default_query_limit, min_confidence: Helpers::GraphQuery.default_query_min_confidence, status: [:confirmed], tags: nil, domain: nil, agent_id: 'unknown', **) # rubocop:disable
|
|
121
|
+
def handle_query(query:, limit: Helpers::GraphQuery.default_query_limit, min_confidence: Helpers::GraphQuery.default_query_min_confidence, status: [:confirmed], tags: nil, domain: nil, agent_id: 'unknown', **) # rubocop:disable Layout/LineLength
|
|
122
122
|
return { success: false, error: 'apollo_data_not_available' } unless defined?(Legion::Data::Model::ApolloEntry)
|
|
123
123
|
|
|
124
124
|
embedding = embed_text(query)
|
|
@@ -223,7 +223,7 @@ module Legion
|
|
|
223
223
|
{ success: false, error: e.message }
|
|
224
224
|
end
|
|
225
225
|
|
|
226
|
-
def retrieve_relevant(query: nil, limit: Helpers::Confidence.apollo_setting(:query, :retrieval_limit, default: 5), min_confidence: Helpers::GraphQuery.default_query_min_confidence, tags: nil, domain: nil, skip: false, **) # rubocop:disable
|
|
226
|
+
def retrieve_relevant(query: nil, limit: Helpers::Confidence.apollo_setting(:query, :retrieval_limit, default: 5), min_confidence: Helpers::GraphQuery.default_query_min_confidence, tags: nil, domain: nil, skip: false, **) # rubocop:disable Layout/LineLength
|
|
227
227
|
return { status: :skipped } if skip
|
|
228
228
|
|
|
229
229
|
return { success: false, error: 'apollo_data_not_available' } unless defined?(Legion::Data::Model::ApolloEntry)
|
|
@@ -11,7 +11,7 @@ module Legion
|
|
|
11
11
|
false
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def query(text:, limit: Helpers::GraphQuery.default_query_limit, min_confidence: Helpers::GraphQuery.default_query_min_confidence, tags: nil,
|
|
14
|
+
def query(text:, limit: Helpers::GraphQuery.default_query_limit, min_confidence: Helpers::GraphQuery.default_query_min_confidence, tags: nil,
|
|
15
15
|
domain: nil, agent_id: 'unknown', **)
|
|
16
16
|
if local_service_available?
|
|
17
17
|
knowledge_host.handle_query(query: text, limit: limit, min_confidence: min_confidence,
|
|
@@ -72,7 +72,7 @@ module Legion
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def transport_available?
|
|
75
|
-
|
|
75
|
+
Legion.const_defined?(:Transport, false) &&
|
|
76
76
|
Legion::Transport.respond_to?(:connected?) &&
|
|
77
77
|
Legion::Transport.connected?
|
|
78
78
|
end
|
|
@@ -16,7 +16,7 @@ require 'legion/extensions/apollo/runners/request'
|
|
|
16
16
|
|
|
17
17
|
require 'legion/extensions/apollo/api' if defined?(Sinatra)
|
|
18
18
|
|
|
19
|
-
if
|
|
19
|
+
if Legion.const_defined?(:Transport, false)
|
|
20
20
|
require 'legion/extensions/apollo/transport/exchanges/apollo'
|
|
21
21
|
require 'legion/extensions/apollo/transport/exchanges/llm_audit'
|
|
22
22
|
require 'legion/extensions/apollo/transport/queues/ingest'
|
|
@@ -32,7 +32,7 @@ end
|
|
|
32
32
|
module Legion
|
|
33
33
|
module Extensions
|
|
34
34
|
module Apollo
|
|
35
|
-
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
|
|
35
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core, false
|
|
36
36
|
|
|
37
37
|
def self.remote_invocable?
|
|
38
38
|
false
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-apollo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -135,6 +135,20 @@ dependencies:
|
|
|
135
135
|
- - "~>"
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
137
|
version: '1.0'
|
|
138
|
+
- !ruby/object:Gem::Dependency
|
|
139
|
+
name: rubocop-legion
|
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - "~>"
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0.1'
|
|
145
|
+
type: :development
|
|
146
|
+
prerelease: false
|
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - "~>"
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '0.1'
|
|
138
152
|
description: Durable shared knowledge with vector search, concept graph, and expertise
|
|
139
153
|
tracking
|
|
140
154
|
email:
|