llm_memory 0.1.3 → 0.1.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/llm_memory/hippocampus.rb +7 -11
- data/lib/llm_memory/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 072b5fa983000a18bccb6e5d0185663cbb30547a0fd6cc6194e1d4235ae833fb
|
4
|
+
data.tar.gz: 7233ecf0cbbb254b08cbf7d1fe747b8374e1e3baa3b6214a1ba5fa64ecd0360d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e670ee60c3e780343317d2b2175ea5cf9fefdaa8b4ce81b13ec1b32caa3cbd13ad4363dec63ebaabf803e434897eb34a21d4b4e0b37b60bb4b3ff22b6a9a80c
|
7
|
+
data.tar.gz: e4defb25011469c10b36c6d4b98763dcb56a673eaedb2709741769de0fc888a8d30e4301f5444c88dbb07c31b8a290ae0fbfae584d9d93a21c6c7ce34d96c40b
|
data/Gemfile.lock
CHANGED
@@ -23,7 +23,7 @@ module LlmMemory
|
|
23
23
|
raise "Store '#{store_name}' not found." unless store_class
|
24
24
|
@store = store_class.new(index_name: index_name)
|
25
25
|
|
26
|
-
#
|
26
|
+
# char count, not word count
|
27
27
|
@chunk_size = chunk_size
|
28
28
|
@chunk_overlap = chunk_overlap
|
29
29
|
end
|
@@ -87,18 +87,14 @@ module LlmMemory
|
|
87
87
|
docs.each do |item|
|
88
88
|
content = item[:content]
|
89
89
|
metadata = item[:metadata]
|
90
|
-
|
91
|
-
|
92
|
-
if words.length > @chunk_size
|
90
|
+
if content.length > @chunk_size
|
93
91
|
start_index = 0
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
chunk_words = words[start_index...end_index]
|
98
|
-
chunk = chunk_words.join(" ")
|
92
|
+
while start_index < content.length
|
93
|
+
end_index = [start_index + @chunk_size, content.length].min
|
94
|
+
chunk = content[start_index...end_index]
|
99
95
|
result << {content: chunk, metadata: metadata}
|
100
|
-
|
101
|
-
start_index += @chunk_size - @chunk_overlap
|
96
|
+
break if end_index == content.length
|
97
|
+
start_index += @chunk_size - @chunk_overlap
|
102
98
|
end
|
103
99
|
else
|
104
100
|
result << {content: content, metadata: metadata}
|
data/lib/llm_memory/version.rb
CHANGED