@postalsys/email-ai-tools 1.4.0 → 1.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.1](https://github.com/postalsys/email-ai-tools/compare/v1.4.0...v1.4.1) (2023-09-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **embeddings:** remove quoted lines ([fb5dd92](https://github.com/postalsys/email-ai-tools/commit/fb5dd92b834249a0290113df4c42b2f01eb22e84))
9
+
3
10
  ## [1.4.0](https://github.com/postalsys/email-ai-tools/compare/v1.3.4...v1.4.0) (2023-09-20)
4
11
 
5
12
 
@@ -28,6 +28,11 @@ async function main() {
28
28
  );
29
29
 
30
30
  console.log(util.inspect(result, false, 22, true));
31
+
32
+ for (let e of result?.embeddings || []) {
33
+ console.log('CHUNK');
34
+ console.log(e.chunk);
35
+ }
31
36
  }
32
37
 
33
38
  main();
@@ -151,7 +151,13 @@ class Embedder {
151
151
 
152
152
  let textChunks = [];
153
153
  if (this.text) {
154
- let textTokens = tokenizer.encode(this.text.replace(/[\r\n]+/g, '\n'));
154
+ let preparedText = this.text
155
+ .replace(/\r?\n/g, '\n')
156
+ .replace(/^\s*>.*$/gm, '')
157
+ .replace(/^\s*>$/gm)
158
+ .replace(/\n\n+/g, '\n\n');
159
+
160
+ let textTokens = tokenizer.encode(preparedText);
155
161
 
156
162
  let pos = 0;
157
163
  while (pos < textTokens.bpe.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postalsys/email-ai-tools",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Email AI tools",
5
5
  "main": "index.js",
6
6
  "scripts": {