triangle-utils 1.2.3 → 1.2.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.2.3",
3
+ "version": "1.2.6",
4
4
  "main": "Utils.js",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -150,4 +150,12 @@ export default class Utils_Misc {
150
150
  }
151
151
  return chunk_indices
152
152
  }
153
+
154
+ chunkify(text, max_length = 2500, overlap = 50) {
155
+ const chunk_indices = this.get_chunk_indices(text, max_length = 2500, overlap = 50)
156
+ return chunk_indices.map(chunk_index => ({
157
+ chunk_index : chunk_index,
158
+ chunk_text : text.substring(...chunk_index)
159
+ }))
160
+ }
153
161
  }
@@ -86,7 +86,7 @@ export default class Utils_S3Vectors {
86
86
  }
87
87
 
88
88
  async batch_create(vector_bucket, vector_index, vectors) {
89
- for (let i = 0; i < vector_keys.length; i += 100) {
89
+ for (let i = 0; i < vectors.length; i += 100) {
90
90
  await this.s3vectors.putVectors({
91
91
  vectorBucketName : vector_bucket,
92
92
  indexName : vector_index,