ben-ai-models-registry 1.0.51 → 1.0.52

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/README.md CHANGED
File without changes
package/index.js CHANGED
@@ -18,6 +18,12 @@ const State = require("./models/State");
18
18
  const StatePermission = require("./models/StatePermission");
19
19
  const UserChatHistory = require("./models/UserChatHistory");
20
20
  const ScraperConfig = require("./models/ScraperConfig");
21
+ const {
22
+ CHUNKING_STRATEGIES,
23
+ CHUNKING_STRATEGY_VALUES,
24
+ CHUNKING_OPTION_FIELDS,
25
+ SIMILARITY_THRESHOLD,
26
+ } = require("./models/utils/sharedSchemas/chunkingStrategies");
21
27
 
22
28
  module.exports = {
23
29
  JobStatus,
@@ -39,4 +45,8 @@ module.exports = {
39
45
  FileStore,
40
46
  UserChatHistory,
41
47
  ScraperConfig,
48
+ CHUNKING_STRATEGIES,
49
+ CHUNKING_STRATEGY_VALUES,
50
+ CHUNKING_OPTION_FIELDS,
51
+ SIMILARITY_THRESHOLD,
42
52
  };
File without changes
package/models/Program.js CHANGED
File without changes
File without changes
package/models/State.js CHANGED
File without changes
File without changes
package/models/User.js CHANGED
File without changes
File without changes
@@ -1,10 +1,14 @@
1
1
  const mongoose = require("mongoose");
2
+ const {
3
+ CHUNKING_STRATEGY_VALUES,
4
+ SIMILARITY_THRESHOLD,
5
+ } = require("./chunkingStrategies");
2
6
 
3
7
  const ChunkingOptionsSchema = new mongoose.Schema(
4
8
  {
5
9
  chunkingStrategy: {
6
10
  type: String,
7
- enum: ["basic", "by_title"],
11
+ enum: [...CHUNKING_STRATEGY_VALUES],
8
12
  },
9
13
  maxCharacters: {
10
14
  type: Number,
@@ -18,6 +22,11 @@ const ChunkingOptionsSchema = new mongoose.Schema(
18
22
  overlapAll: {
19
23
  type: Boolean,
20
24
  },
25
+ similarityThreshold: {
26
+ type: Number,
27
+ min: SIMILARITY_THRESHOLD.min,
28
+ max: SIMILARITY_THRESHOLD.max,
29
+ },
21
30
  },
22
31
  { _id: false }
23
32
  );
@@ -0,0 +1,51 @@
1
+ const CHUNKING_OPTION_FIELDS = Object.freeze([
2
+ "chunkingStrategy",
3
+ "maxCharacters",
4
+ "newAfterNChars",
5
+ "overlap",
6
+ "overlapAll",
7
+ "similarityThreshold",
8
+ ]);
9
+
10
+ const COMMON_OPTIONS = [
11
+ "maxCharacters",
12
+ "newAfterNChars",
13
+ "overlap",
14
+ "overlapAll",
15
+ ];
16
+
17
+ const CHUNKING_STRATEGIES = Object.freeze({
18
+ basic: Object.freeze({
19
+ displayName: "Basic",
20
+ supportedOptions: Object.freeze([...COMMON_OPTIONS]),
21
+ }),
22
+ by_title: Object.freeze({
23
+ displayName: "By Title",
24
+ supportedOptions: Object.freeze([...COMMON_OPTIONS]),
25
+ }),
26
+ by_page: Object.freeze({
27
+ displayName: "By Page",
28
+ supportedOptions: Object.freeze([...COMMON_OPTIONS]),
29
+ }),
30
+ by_similarity: Object.freeze({
31
+ displayName: "By Similarity",
32
+ supportedOptions: Object.freeze([...COMMON_OPTIONS, "similarityThreshold"]),
33
+ }),
34
+ });
35
+
36
+ const CHUNKING_STRATEGY_VALUES = Object.freeze(
37
+ Object.keys(CHUNKING_STRATEGIES)
38
+ );
39
+
40
+ const SIMILARITY_THRESHOLD = Object.freeze({
41
+ min: 0.01,
42
+ max: 0.99,
43
+ default: 0.5,
44
+ });
45
+
46
+ module.exports = {
47
+ CHUNKING_STRATEGIES,
48
+ CHUNKING_STRATEGY_VALUES,
49
+ CHUNKING_OPTION_FIELDS,
50
+ SIMILARITY_THRESHOLD,
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ben-ai-models-registry",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "",
5
5
  "files": [
6
6
  "/models"