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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d497000abdc4e0a8f02f6167570d5d00888979e31ed5e484fc707647ebdface5
4
- data.tar.gz: b721aeaeddabe1c8dce81f6aca4ff94188623c6cdb8fd5b22dd5199a7d1fb3bf
3
+ metadata.gz: 01b1f21a6cc3de948b270cbd23c95911803accd689598315f655cc320fcdcc4f
4
+ data.tar.gz: ec76e4cedde5863f5022bd9842e0360ecbe0e51d39d8287c83c5b83415376023
5
5
  SHA512:
6
- metadata.gz: 0f6a1a9ec8f3f9a4d0404f2ef5b7b8dc61ad41bee7a7557d3701a7e958786114430ca4b5c3db4e1581b98bda4b280856eca1a1cd7152987c6d5db54ebc4b1b63
7
- data.tar.gz: 43316a2c58575ae72429deb036cd3499b42bd19ec5c7fadf15404b46a864fdcffa3b41a33b24815fef16dd426ace74bac38fe8460e6e722c9639785ee5c4d7ef
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAiKit
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
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.0
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: 1980-01-02 00:00:00.000000000 Z
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/your-org/rails_ai_kit
95
+ homepage: https://github.com/imrrohitt/rails_ai_kit
95
96
  licenses: []
96
97
  metadata:
97
- homepage_uri: https://github.com/your-org/rails_ai_kit
98
- source_code_uri: https://github.com/your-org/rails_ai_kit
99
- changelog_uri: https://github.com/your-org/rails_ai_kit/blob/main/CHANGELOG.md
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: 4.0.7
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: []