legion-data 1.4.3 → 1.4.4

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: cc137f8ac51b46a97a5bc6c82b25e8036536fb5771309b69aa9df35604db7b89
4
- data.tar.gz: dd10068c7f5b243c0fe6b5d56b572ab06cdfe3a33bcf6449c8758e94e4e17147
3
+ metadata.gz: 5cd79bdce76b7a6043a32f43448907046df4ba71a4715dc6afea5c34168f152a
4
+ data.tar.gz: 9029b9c2de24c614a8c2742ffa7e276cd63b9b1205a1b39d99d22f1ad2fccc77
5
5
  SHA512:
6
- metadata.gz: 74ca6d37fce4a381b04b9ce35bc50117649a0be3fae11c3231d496aed38aa43a03439dc5262569bcce2c6b037a996fa6b16ac6067c48d2e40cd1b97aa2153241
7
- data.tar.gz: c7d530da08c104df4f2d633a33ac13171c7eac51516ac75d2b54374b9d938a9075a41a0d37edc0614f204753e349264bd0a96b76ca3ca031ccc63c926f9deebd
6
+ metadata.gz: beafcc4417a128f66b8d13761aa66330cf81903231591b2320c102fff188ed37f9ee82dcbf3e1111fa93c5a7d8c87f3366bea2715260566297e98269b2c6f6c4
7
+ data.tar.gz: 1dada9cc4fbe1e716b718db9ae28e748ac36a1db5277c1a8652a298747403333b8f0e6d665c69d9219c8a7e268e0f22d31bc638bc334d48b93f14d08cd310824
data/CHANGELOG.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Legion::Data Changelog
2
2
 
3
- ## [Unreleased]
3
+ ## v1.4.4
4
4
 
5
5
  ### Added
6
- - `Legion::Data::Spool`: filesystem-based event buffer at `~/.legionio/data/spool/`
6
+ - Migration 026: `description` (TEXT) and `embedding` (TEXT, JSON-serialized vector) columns on `functions` table
7
+ - Postgres-only: `embedding_vector vector(1536)` column with HNSW cosine index for semantic similarity search
8
+ - `Function#embedding_vector` / `Function#embedding_vector=` helper methods for JSON serialization
7
9
 
8
10
  ## v1.4.3
9
11
 
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ Sequel.migration do
4
+ up do
5
+ alter_table(:functions) do
6
+ add_column :description, String, text: true, null: true
7
+ add_column :embedding, String, text: true, null: true
8
+ end
9
+
10
+ next unless adapter_scheme == :postgres
11
+
12
+ run 'ALTER TABLE functions ADD COLUMN IF NOT EXISTS embedding_vector vector(1536)'
13
+ run 'CREATE INDEX IF NOT EXISTS idx_functions_embedding ON functions USING hnsw (embedding_vector vector_cosine_ops)'
14
+ end
15
+
16
+ down do
17
+ alter_table(:functions) do
18
+ drop_column :embedding
19
+ drop_column :description
20
+ end
21
+
22
+ if adapter_scheme == :postgres
23
+ run 'DROP INDEX IF EXISTS idx_functions_embedding'
24
+ run 'ALTER TABLE functions DROP COLUMN IF EXISTS embedding_vector'
25
+ end
26
+ end
27
+ end
@@ -7,6 +7,18 @@ module Legion
7
7
  many_to_one :runner
8
8
  one_to_many :trigger_relationships, class: 'Legion::Data::Model::Relationship', key: :trigger_id
9
9
  one_to_many :action_relationships, class: 'Legion::Data::Model::Relationship', key: :action_id
10
+
11
+ def embedding_vector
12
+ return nil unless embedding
13
+
14
+ ::JSON.parse(embedding)
15
+ rescue ::JSON::ParserError
16
+ nil
17
+ end
18
+
19
+ def embedding_vector=(vec)
20
+ self.embedding = vec&.to_json
21
+ end
10
22
  end
11
23
  end
12
24
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Data
5
- VERSION = '1.4.3'
5
+ VERSION = '1.4.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -121,6 +121,7 @@ files:
121
121
  - lib/legion/data/migrations/023_add_data_archive.rb
122
122
  - lib/legion/data/migrations/024_add_tenant_partition_columns.rb
123
123
  - lib/legion/data/migrations/025_add_tenants_table.rb
124
+ - lib/legion/data/migrations/026_add_function_embeddings.rb
124
125
  - lib/legion/data/model.rb
125
126
  - lib/legion/data/models/apollo_access_log.rb
126
127
  - lib/legion/data/models/apollo_entry.rb