llmemory 0.2.1 → 0.2.2
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/README.md +47 -1
- data/app/controllers/llmemory/dashboard/application_controller.rb +15 -1
- data/app/controllers/llmemory/dashboard/episodic_controller.rb +22 -0
- data/app/controllers/llmemory/dashboard/forget_log_controller.rb +12 -0
- data/app/controllers/llmemory/dashboard/maintenance_controller.rb +92 -0
- data/app/controllers/llmemory/dashboard/procedural_controller.rb +22 -0
- data/app/controllers/llmemory/dashboard/reflection_controller.rb +37 -0
- data/app/controllers/llmemory/dashboard/working_controller.rb +14 -0
- data/app/views/llmemory/dashboard/episodic/index.html.erb +37 -0
- data/app/views/llmemory/dashboard/forget_log/show.html.erb +23 -0
- data/app/views/llmemory/dashboard/maintenance/show.html.erb +65 -0
- data/app/views/llmemory/dashboard/procedural/index.html.erb +38 -0
- data/app/views/llmemory/dashboard/reflection/show.html.erb +29 -0
- data/app/views/llmemory/dashboard/users/show.html.erb +16 -0
- data/app/views/llmemory/dashboard/working/show.html.erb +20 -0
- data/config/routes.rb +14 -0
- data/lib/generators/llmemory/install/templates/create_llmemory_tables.rb +2 -0
- data/lib/llmemory/cli/commands/maintain.rb +62 -0
- data/lib/llmemory/cli/commands/mine_skills.rb +50 -0
- data/lib/llmemory/cli.rb +6 -0
- data/lib/llmemory/configuration.rb +7 -1
- data/lib/llmemory/instrumentation.rb +33 -0
- data/lib/llmemory/llm/anthropic.rb +19 -15
- data/lib/llmemory/llm/openai.rb +16 -12
- data/lib/llmemory/long_term/episodic/memory.rb +23 -10
- data/lib/llmemory/long_term/episodic/storages/active_record_storage.rb +14 -4
- data/lib/llmemory/long_term/episodic/storages/base.rb +15 -2
- data/lib/llmemory/long_term/episodic/storages/database_storage.rb +26 -5
- data/lib/llmemory/long_term/episodic/storages/file_storage.rb +27 -6
- data/lib/llmemory/long_term/episodic/storages/memory_storage.rb +35 -4
- data/lib/llmemory/long_term/file_based/memory.rb +12 -4
- data/lib/llmemory/long_term/file_based/storages/active_record_storage.rb +4 -2
- data/lib/llmemory/long_term/file_based/storages/base.rb +2 -2
- data/lib/llmemory/long_term/file_based/storages/database_storage.rb +4 -2
- data/lib/llmemory/long_term/file_based/storages/file_storage.rb +4 -2
- data/lib/llmemory/long_term/file_based/storages/memory_storage.rb +4 -2
- data/lib/llmemory/long_term/graph_based/memory.rb +12 -4
- data/lib/llmemory/long_term/graph_based/storages/active_record_storage.rb +4 -2
- data/lib/llmemory/long_term/graph_based/storages/base.rb +2 -2
- data/lib/llmemory/long_term/graph_based/storages/memory_storage.rb +4 -2
- data/lib/llmemory/long_term/procedural/memory.rb +26 -13
- data/lib/llmemory/long_term/procedural/skill.rb +6 -2
- data/lib/llmemory/long_term/procedural/storages/active_record_storage.rb +15 -5
- data/lib/llmemory/long_term/procedural/storages/base.rb +14 -1
- data/lib/llmemory/long_term/procedural/storages/database_storage.rb +27 -6
- data/lib/llmemory/long_term/procedural/storages/file_storage.rb +28 -7
- data/lib/llmemory/long_term/procedural/storages/memory_storage.rb +36 -5
- data/lib/llmemory/maintenance/cognitive_pass.rb +109 -0
- data/lib/llmemory/maintenance/ttl_expiry.rb +50 -0
- data/lib/llmemory/maintenance.rb +2 -0
- data/lib/llmemory/mcp/server.rb +5 -1
- data/lib/llmemory/mcp/tools/memory_maintain.rb +53 -0
- data/lib/llmemory/mcp/tools/memory_mine_skills.rb +53 -0
- data/lib/llmemory/memory.rb +20 -0
- data/lib/llmemory/memory_module.rb +13 -6
- data/lib/llmemory/reflection/reflector.rb +24 -20
- data/lib/llmemory/retrieval/engine.rb +25 -16
- data/lib/llmemory/skill_mining/miner.rb +163 -0
- data/lib/llmemory/skill_mining.rb +8 -0
- data/lib/llmemory/vector_store/openai_embeddings.rb +11 -7
- data/lib/llmemory/version.rb +1 -1
- data/lib/llmemory.rb +2 -0
- metadata +22 -1
|
@@ -54,14 +54,18 @@ module Llmemory
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def fetch_embedding(text)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
result = nil
|
|
58
|
+
Llmemory::Instrumentation.instrument(:llm_embed, provider: :openai, model: @model, text_chars: text.to_s.length) do
|
|
59
|
+
response = connection.post("embeddings") do |req|
|
|
60
|
+
req.headers["Authorization"] = "Bearer #{@api_key}"
|
|
61
|
+
req.headers["Content-Type"] = "application/json"
|
|
62
|
+
req.body = { input: text.to_s.strip, model: @model }.to_json
|
|
63
|
+
end
|
|
64
|
+
raise Llmemory::LLMError, "OpenAI Embeddings API error: #{response.body}" unless response.success?
|
|
65
|
+
body = response.body.is_a?(Hash) ? response.body : JSON.parse(response.body.to_s)
|
|
66
|
+
result = body.dig("data", 0, "embedding")&.map(&:to_f) || Array.new(DEFAULT_DIMS, 0.0)
|
|
61
67
|
end
|
|
62
|
-
|
|
63
|
-
body = response.body.is_a?(Hash) ? response.body : JSON.parse(response.body.to_s)
|
|
64
|
-
body.dig("data", 0, "embedding")&.map(&:to_f) || Array.new(DEFAULT_DIMS, 0.0)
|
|
68
|
+
result
|
|
65
69
|
end
|
|
66
70
|
|
|
67
71
|
def connection
|
data/lib/llmemory/version.rb
CHANGED
data/lib/llmemory.rb
CHANGED
|
@@ -4,6 +4,7 @@ require_relative "llmemory/version"
|
|
|
4
4
|
require_relative "llmemory/configuration"
|
|
5
5
|
require_relative "llmemory/provenance"
|
|
6
6
|
require_relative "llmemory/tokenizer"
|
|
7
|
+
require_relative "llmemory/instrumentation"
|
|
7
8
|
require_relative "llmemory/memory_module"
|
|
8
9
|
require_relative "llmemory/forget_log"
|
|
9
10
|
require_relative "llmemory/llm"
|
|
@@ -15,6 +16,7 @@ require_relative "llmemory/vector_store"
|
|
|
15
16
|
require_relative "llmemory/maintenance"
|
|
16
17
|
require_relative "llmemory/extractors"
|
|
17
18
|
require_relative "llmemory/reflection"
|
|
19
|
+
require_relative "llmemory/skill_mining"
|
|
18
20
|
require_relative "llmemory/actions"
|
|
19
21
|
require_relative "llmemory/memory"
|
|
20
22
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: llmemory
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- llmemory
|
|
@@ -106,21 +106,33 @@ files:
|
|
|
106
106
|
- LICENSE.txt
|
|
107
107
|
- README.md
|
|
108
108
|
- app/controllers/llmemory/dashboard/application_controller.rb
|
|
109
|
+
- app/controllers/llmemory/dashboard/episodic_controller.rb
|
|
110
|
+
- app/controllers/llmemory/dashboard/forget_log_controller.rb
|
|
109
111
|
- app/controllers/llmemory/dashboard/graph_controller.rb
|
|
110
112
|
- app/controllers/llmemory/dashboard/long_term_controller.rb
|
|
113
|
+
- app/controllers/llmemory/dashboard/maintenance_controller.rb
|
|
114
|
+
- app/controllers/llmemory/dashboard/procedural_controller.rb
|
|
115
|
+
- app/controllers/llmemory/dashboard/reflection_controller.rb
|
|
111
116
|
- app/controllers/llmemory/dashboard/search_controller.rb
|
|
112
117
|
- app/controllers/llmemory/dashboard/short_term_controller.rb
|
|
113
118
|
- app/controllers/llmemory/dashboard/stats_controller.rb
|
|
114
119
|
- app/controllers/llmemory/dashboard/users_controller.rb
|
|
120
|
+
- app/controllers/llmemory/dashboard/working_controller.rb
|
|
115
121
|
- app/views/layouts/application.html.erb
|
|
122
|
+
- app/views/llmemory/dashboard/episodic/index.html.erb
|
|
123
|
+
- app/views/llmemory/dashboard/forget_log/show.html.erb
|
|
116
124
|
- app/views/llmemory/dashboard/graph/index.html.erb
|
|
117
125
|
- app/views/llmemory/dashboard/long_term/categories.html.erb
|
|
118
126
|
- app/views/llmemory/dashboard/long_term/index.html.erb
|
|
127
|
+
- app/views/llmemory/dashboard/maintenance/show.html.erb
|
|
128
|
+
- app/views/llmemory/dashboard/procedural/index.html.erb
|
|
129
|
+
- app/views/llmemory/dashboard/reflection/show.html.erb
|
|
119
130
|
- app/views/llmemory/dashboard/search/index.html.erb
|
|
120
131
|
- app/views/llmemory/dashboard/short_term/show.html.erb
|
|
121
132
|
- app/views/llmemory/dashboard/stats/index.html.erb
|
|
122
133
|
- app/views/llmemory/dashboard/users/index.html.erb
|
|
123
134
|
- app/views/llmemory/dashboard/users/show.html.erb
|
|
135
|
+
- app/views/llmemory/dashboard/working/show.html.erb
|
|
124
136
|
- config/routes.rb
|
|
125
137
|
- exe/llmemory
|
|
126
138
|
- exe/llmemory-mcp
|
|
@@ -140,7 +152,9 @@ files:
|
|
|
140
152
|
- lib/llmemory/cli/commands/long_term/graph.rb
|
|
141
153
|
- lib/llmemory/cli/commands/long_term/nodes.rb
|
|
142
154
|
- lib/llmemory/cli/commands/long_term/resources.rb
|
|
155
|
+
- lib/llmemory/cli/commands/maintain.rb
|
|
143
156
|
- lib/llmemory/cli/commands/mcp.rb
|
|
157
|
+
- lib/llmemory/cli/commands/mine_skills.rb
|
|
144
158
|
- lib/llmemory/cli/commands/procedural.rb
|
|
145
159
|
- lib/llmemory/cli/commands/search.rb
|
|
146
160
|
- lib/llmemory/cli/commands/short_term.rb
|
|
@@ -154,6 +168,7 @@ files:
|
|
|
154
168
|
- lib/llmemory/extractors/entity_relation_extractor.rb
|
|
155
169
|
- lib/llmemory/extractors/fact_extractor.rb
|
|
156
170
|
- lib/llmemory/forget_log.rb
|
|
171
|
+
- lib/llmemory/instrumentation.rb
|
|
157
172
|
- lib/llmemory/llm.rb
|
|
158
173
|
- lib/llmemory/llm/anthropic.rb
|
|
159
174
|
- lib/llmemory/llm/base.rb
|
|
@@ -204,10 +219,12 @@ files:
|
|
|
204
219
|
- lib/llmemory/long_term/procedural/storages/file_storage.rb
|
|
205
220
|
- lib/llmemory/long_term/procedural/storages/memory_storage.rb
|
|
206
221
|
- lib/llmemory/maintenance.rb
|
|
222
|
+
- lib/llmemory/maintenance/cognitive_pass.rb
|
|
207
223
|
- lib/llmemory/maintenance/consolidator.rb
|
|
208
224
|
- lib/llmemory/maintenance/reindexer.rb
|
|
209
225
|
- lib/llmemory/maintenance/runner.rb
|
|
210
226
|
- lib/llmemory/maintenance/summarizer.rb
|
|
227
|
+
- lib/llmemory/maintenance/ttl_expiry.rb
|
|
211
228
|
- lib/llmemory/mcp.rb
|
|
212
229
|
- lib/llmemory/mcp/authentication.rb
|
|
213
230
|
- lib/llmemory/mcp/server.rb
|
|
@@ -217,6 +234,8 @@ files:
|
|
|
217
234
|
- lib/llmemory/mcp/tools/memory_episodes.rb
|
|
218
235
|
- lib/llmemory/mcp/tools/memory_forget.rb
|
|
219
236
|
- lib/llmemory/mcp/tools/memory_info.rb
|
|
237
|
+
- lib/llmemory/mcp/tools/memory_maintain.rb
|
|
238
|
+
- lib/llmemory/mcp/tools/memory_mine_skills.rb
|
|
220
239
|
- lib/llmemory/mcp/tools/memory_retrieve.rb
|
|
221
240
|
- lib/llmemory/mcp/tools/memory_save.rb
|
|
222
241
|
- lib/llmemory/mcp/tools/memory_search.rb
|
|
@@ -251,6 +270,8 @@ files:
|
|
|
251
270
|
- lib/llmemory/short_term/stores/memory_store.rb
|
|
252
271
|
- lib/llmemory/short_term/stores/postgres_store.rb
|
|
253
272
|
- lib/llmemory/short_term/stores/redis_store.rb
|
|
273
|
+
- lib/llmemory/skill_mining.rb
|
|
274
|
+
- lib/llmemory/skill_mining/miner.rb
|
|
254
275
|
- lib/llmemory/tokenizer.rb
|
|
255
276
|
- lib/llmemory/vector_store.rb
|
|
256
277
|
- lib/llmemory/vector_store/active_record_embedding.rb
|