rails_ai_kit 0.1.0 → 0.1.1
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 +6 -0
- data/README.md +2 -10
- data/lib/rails_ai_kit/version.rb +1 -1
- data/lib/rails_ai_kit.rb +5 -2
- metadata +10 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 01b1f21a6cc3de948b270cbd23c95911803accd689598315f655cc320fcdcc4f
|
|
4
|
+
data.tar.gz: ec76e4cedde5863f5022bd9842e0360ecbe0e51d39d8287c83c5b83415376023
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3bc4d41ca7050bc75b1f92276d1826ae43020d10b48bcd07d0fad1838c4f6dadba8f0dd262fe6a3188d2c18514a92f2dd35540ec40a99583d304fff45d585803
|
|
7
|
+
data.tar.gz: 1ef19893af1c1a7bf6ea5be4d15da6243cb00629ff79f1bc3c6254f2bebcef1d957a7c1f9a81be5eac3cb16a2b90a2f0894c9158df0922a0fc154760d414d987
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.1] - 2026-03-07
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Define `RailsAiKit::Error` before loading embedding providers to fix `uninitialized constant RailsAiKit::Error` when running generators or migrations
|
|
10
|
+
|
|
5
11
|
## [0.1.0] - 2025-03-07
|
|
6
12
|
|
|
7
13
|
### Added
|
data/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A Rails gem that adds a **classification layer on top of [pgvector](https://github.com/pgvector/pgvector)**. Instead of building custom ML or calling LLMs every time, use vector similarity to classify data: support tickets, content moderation, ecommerce categories, document routing, and more.
|
|
4
4
|
|
|
5
|
+
**Source:** [github.com/imrrohitt/rails_ai_kit](https://github.com/imrrohitt/rails_ai_kit)
|
|
6
|
+
|
|
5
7
|
- **No ML training** – train labels with example texts and compare embeddings
|
|
6
8
|
- **No LLM cost** – one-time embedding per piece of content; classification is nearest-neighbor in PostgreSQL
|
|
7
9
|
- **Rails-friendly** – `vector_classify`, `Classifier.train`, `Classifier.classify`, `Article.similar_to("query")`
|
|
@@ -247,15 +249,6 @@ MIT.
|
|
|
247
249
|
|
|
248
250
|
## How it’s built
|
|
249
251
|
|
|
250
|
-
- **Configuration** (`lib/rails_ai_kit/configuration.rb`) – Embeding provider, dimensions, and API keys (e.g. `api_keys[:openai]`).
|
|
251
|
-
- **Embedding providers** (`lib/rails_ai_kit/embedding_providers/`) – Base class plus OpenAI and Cohere. Each implements `embed(text)` and `embed_batch(texts)` using the provider API.
|
|
252
|
-
- **EmbeddingService** – Wraps the configured provider and API key so `RailsAiKit.embedding.embed(text)` works without passing keys every time.
|
|
253
|
-
- **LabelRecord** – ActiveRecord model for `rails_ai_kit_labels` (classifier_name, label_name, embedding). Uses Neighbor’s `has_neighbors :embedding` for similarity.
|
|
254
|
-
- **Classifier** – Trains labels by averaging example embeddings and storing them; classifies by nearest-neighbor (cosine) against those label vectors. Supports `classify(text)`, `classify_by_embedding(vector)`, and `batch_classify(records)`.
|
|
255
|
-
- **VectorClassify** – Concern that adds the `vector_classify` macro: `has_neighbors` on the embedding column, a before_save that embeds the source column and runs `classify_by_embedding`, and a `similar_to(query_text)` scope that embeds the query and runs nearest-neighbor search.
|
|
256
|
-
|
|
257
|
-
## How it’s built
|
|
258
|
-
|
|
259
252
|
- **Configuration** (`lib/rails_ai_kit/configuration.rb`) – Embedding provider, dimensions, and API keys (e.g. `api_keys[:openai]`).
|
|
260
253
|
- **Embedding providers** (`lib/rails_ai_kit/embedding_providers/`) – Base class plus OpenAI and Cohere. Each implements `embed(text)` and `embed_batch(texts)` using the provider API.
|
|
261
254
|
- **EmbeddingService** – Wraps the configured provider and API key so `RailsAiKit.embedding.embed(text)` works without passing keys every time.
|
|
@@ -268,4 +261,3 @@ MIT.
|
|
|
268
261
|
|
|
269
262
|
- [pgvector](https://github.com/pgvector/pgvector) – Open-source vector similarity search for Postgres
|
|
270
263
|
- [Neighbor](https://github.com/ankane/neighbor) – Nearest neighbor search for Rails (used by this gem)
|
|
271
|
-
test
|
data/lib/rails_ai_kit/version.rb
CHANGED
data/lib/rails_ai_kit.rb
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "rails_ai_kit/version"
|
|
4
4
|
require_relative "rails_ai_kit/configuration"
|
|
5
|
+
|
|
6
|
+
module RailsAiKit
|
|
7
|
+
class Error < StandardError; end
|
|
8
|
+
end
|
|
9
|
+
|
|
5
10
|
require_relative "rails_ai_kit/embedding_providers/base"
|
|
6
11
|
require_relative "rails_ai_kit/embedding_providers/openai"
|
|
7
12
|
require_relative "rails_ai_kit/embedding_providers/cohere"
|
|
@@ -11,8 +16,6 @@ require_relative "rails_ai_kit/classifier"
|
|
|
11
16
|
require_relative "rails_ai_kit/vector_classify"
|
|
12
17
|
|
|
13
18
|
module RailsAiKit
|
|
14
|
-
class Error < StandardError; end
|
|
15
|
-
|
|
16
19
|
# Top-level classifier using default classifier name. For custom name use Classifier.new(classifier_name: "MyClassifier").
|
|
17
20
|
def self.classifier(classifier_name = nil)
|
|
18
21
|
Classifier.new(classifier_name: classifier_name)
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_ai_kit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rails AI Kit Contributors
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-03-07 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: activerecord
|
|
@@ -91,12 +92,13 @@ files:
|
|
|
91
92
|
- lib/rails_ai_kit/label_record.rb
|
|
92
93
|
- lib/rails_ai_kit/vector_classify.rb
|
|
93
94
|
- lib/rails_ai_kit/version.rb
|
|
94
|
-
homepage: https://github.com/
|
|
95
|
+
homepage: https://github.com/imrrohitt/rails_ai_kit
|
|
95
96
|
licenses: []
|
|
96
97
|
metadata:
|
|
97
|
-
homepage_uri: https://github.com/
|
|
98
|
-
source_code_uri: https://github.com/
|
|
99
|
-
changelog_uri: https://github.com/
|
|
98
|
+
homepage_uri: https://github.com/imrrohitt/rails_ai_kit
|
|
99
|
+
source_code_uri: https://github.com/imrrohitt/rails_ai_kit
|
|
100
|
+
changelog_uri: https://github.com/imrrohitt/rails_ai_kit/blob/main/CHANGELOG.md
|
|
101
|
+
post_install_message:
|
|
100
102
|
rdoc_options: []
|
|
101
103
|
require_paths:
|
|
102
104
|
- lib
|
|
@@ -111,7 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
111
113
|
- !ruby/object:Gem::Version
|
|
112
114
|
version: '0'
|
|
113
115
|
requirements: []
|
|
114
|
-
rubygems_version:
|
|
116
|
+
rubygems_version: 3.0.3.1
|
|
117
|
+
signing_key:
|
|
115
118
|
specification_version: 4
|
|
116
119
|
summary: Vector-based classification layer on top of pgvector for Rails
|
|
117
120
|
test_files: []
|