easy_ml 0.2.0.pre.rc83 → 0.2.0.pre.rc85
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/app/controllers/easy_ml/datasets_controller.rb +1 -1
- data/app/frontend/pages/DatasetsPage.tsx +1 -0
- data/lib/easy_ml/version.rb +1 -1
- data/public/easy_ml/assets/.vite/manifest.json +1 -1
- data/public/easy_ml/assets/assets/entrypoints/{Application.tsx-Bbf3mD_b.js → Application.tsx-CD8voxfL.js} +2 -2
- data/public/easy_ml/assets/assets/entrypoints/{Application.tsx-Bbf3mD_b.js.map → Application.tsx-CD8voxfL.js.map} +1 -1
- metadata +4 -7
- data/lib/easy_ml/data/embeddings/adapters.rb +0 -56
- data/lib/easy_ml/data/embeddings/compression.rb +0 -1
- data/lib/easy_ml/data/embeddings.rb +0 -43
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_ml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.pre.
|
4
|
+
version: 0.2.0.pre.rc85
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Shollenberger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -719,9 +719,6 @@ files:
|
|
719
719
|
- lib/easy_ml/data/dataset_manager/writer/partitioned.rb
|
720
720
|
- lib/easy_ml/data/dataset_manager/writer/partitioned/partition_reasons.rb
|
721
721
|
- lib/easy_ml/data/date_converter.rb
|
722
|
-
- lib/easy_ml/data/embeddings.rb
|
723
|
-
- lib/easy_ml/data/embeddings/adapters.rb
|
724
|
-
- lib/easy_ml/data/embeddings/compression.rb
|
725
722
|
- lib/easy_ml/data/partition.rb
|
726
723
|
- lib/easy_ml/data/partition/boundaries.rb
|
727
724
|
- lib/easy_ml/data/polars_column.rb
|
@@ -802,8 +799,8 @@ files:
|
|
802
799
|
- public/easy_ml/assets/.vite/manifest-assets.json
|
803
800
|
- public/easy_ml/assets/.vite/manifest.json
|
804
801
|
- public/easy_ml/assets/assets/Application-nnn_XLuL.css
|
805
|
-
- public/easy_ml/assets/assets/entrypoints/Application.tsx-
|
806
|
-
- public/easy_ml/assets/assets/entrypoints/Application.tsx-
|
802
|
+
- public/easy_ml/assets/assets/entrypoints/Application.tsx-CD8voxfL.js
|
803
|
+
- public/easy_ml/assets/assets/entrypoints/Application.tsx-CD8voxfL.js.map
|
807
804
|
homepage: https://github.com/brettshollenberger/easy_ml
|
808
805
|
licenses:
|
809
806
|
- MIT
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module EasyML
|
2
|
-
module Data
|
3
|
-
class Embeddings
|
4
|
-
class Adapters
|
5
|
-
attr_accessor :model, :config
|
6
|
-
|
7
|
-
ADAPTERS = {
|
8
|
-
anthropic: Langchain::LLM::Anthropic,
|
9
|
-
gemini: Langchain::LLM::GoogleGemini,
|
10
|
-
openai: Langchain::LLM::OpenAI,
|
11
|
-
ollama: Langchain::LLM::Ollama,
|
12
|
-
}
|
13
|
-
|
14
|
-
DEFAULTS = {
|
15
|
-
api_key: {
|
16
|
-
anthropic: ENV["ANTHROPIC_API_KEY"],
|
17
|
-
gemini: ENV["GEMINI_API_KEY"],
|
18
|
-
openai: ENV["OPENAI_API_KEY"],
|
19
|
-
ollama: ENV["OLLAMA_API_KEY"],
|
20
|
-
},
|
21
|
-
}
|
22
|
-
|
23
|
-
def initialize(model, config = {})
|
24
|
-
@model = model.to_sym
|
25
|
-
@config = config.symbolize_keys
|
26
|
-
apply_defaults
|
27
|
-
end
|
28
|
-
|
29
|
-
def embed(df, col)
|
30
|
-
pick
|
31
|
-
texts = df[col].to_a
|
32
|
-
df = df.with_column(
|
33
|
-
embeddings: adapter.embed(text: texts),
|
34
|
-
)
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def pick
|
40
|
-
@adapter ||= ADAPTERS[@model].new(config)
|
41
|
-
self
|
42
|
-
end
|
43
|
-
|
44
|
-
def apply_defaults
|
45
|
-
@config = @config.deep_symbolize_keys
|
46
|
-
|
47
|
-
DEFAULTS.each do |k, v|
|
48
|
-
unless @config.key?(k)
|
49
|
-
@config[k] = v[@model]
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module EasyML
|
2
|
-
module Data
|
3
|
-
class Embeddings
|
4
|
-
COMPRESSION_DEFAULT = {
|
5
|
-
present: :balanced,
|
6
|
-
}
|
7
|
-
|
8
|
-
attr_reader :df, :column, :model, :adapter, :compression,
|
9
|
-
:embeddings, :compressed_embeddings
|
10
|
-
|
11
|
-
def initialize(options = {})
|
12
|
-
@df = options[:df]
|
13
|
-
@column = options[:column]
|
14
|
-
@model = options[:model]
|
15
|
-
@config = options[:config] || {}
|
16
|
-
@compression = options[:compression] || COMPRESSION_DEFAULT
|
17
|
-
end
|
18
|
-
|
19
|
-
def create
|
20
|
-
embed
|
21
|
-
compress
|
22
|
-
end
|
23
|
-
|
24
|
-
def embed
|
25
|
-
@embeddings ||= adapter.embed(df, column)
|
26
|
-
end
|
27
|
-
|
28
|
-
def compress
|
29
|
-
@compressed_embeddings ||= compression_adapter.compress(embeddings)
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def adapter
|
35
|
-
@adapter ||= EasyML::Data::Embeddings::Adapters.new(model, config)
|
36
|
-
end
|
37
|
-
|
38
|
-
def compression_adapter
|
39
|
-
@compression_adapter ||= EasyML::Data::Embeddings::Compression.new(compression)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|