ben-ai-models-registry 1.0.13 → 1.0.14

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
@@ -1,37 +1,47 @@
1
- # Bennie and the AI Jets Shared Mongoose Models
2
-
3
- This repository contains shared Mongoose models used across all Bennie and the AI Jets Node.js applications.
4
-
5
- ## Contents
6
-
7
- - **Models**:
8
- - `Run`
9
- - `JobStatus`
10
-
11
- ## Usage in Other Applications
12
-
13
- To use these models in your application, follow these steps:
14
-
15
- 1. Install the package:
16
- ```sh
17
- npm install ben-ai-models-registry
18
- 2. Import the models:
19
- ```sh
20
- import { Run, JobStatus } from 'ben-ai-models-registry';
21
-
22
- ## Usage in Other Applications
23
-
24
- If you need to make changes to the models, follow these steps:
25
- 1. Clone the repository
26
- 2. Make your changes.
27
- 3. Update the version number in package.json to the next version.
28
- 4. Login to npm:
29
- ```sh
30
- npm login
31
- 5. Publish the updated package to npm:
32
- ```sh
33
- npm publish
34
-
35
- Note: You must have publishing access to the npm package to publish changes.
36
-
37
- Feel free to contribute to the repository by submitting pull requests with your improvements and suggestions.
1
+ # Bennie and the AI Jets Shared Mongoose Models
2
+
3
+ This repository contains shared Mongoose models used across all Bennie and the AI Jets Node.js applications.
4
+
5
+ ## Contents
6
+
7
+ - **Models**:
8
+ - `Run`
9
+ - `JobStatus`
10
+ - `LanguageObject`
11
+
12
+ ## Usage in Other Applications
13
+
14
+ To use these models in your application, follow these steps:
15
+
16
+ 1. Install the package:
17
+
18
+ ```sh
19
+
20
+ npm install ben-ai-models-registry
21
+
22
+ 2. Import the models:
23
+
24
+ ```sh
25
+
26
+ import { Run, JobStatus, LanguageObject } from 'ben-ai-models-registry';
27
+
28
+
29
+ ## Usage in Other Applications
30
+
31
+ If you need to make changes to the models, follow these steps:
32
+
33
+ 1. Clone the repository
34
+ 2. Make your changes.
35
+ 3. Update the version number in package.json to the next version.
36
+ 4. Login to npm:
37
+
38
+ ```sh
39
+ npm login
40
+ 5. Publish the updated package to npm:
41
+
42
+ ```sh
43
+ npm publish
44
+
45
+ Note: You must have publishing access to the npm package to publish changes.
46
+
47
+ Feel free to contribute to the repository by submitting pull requests with your improvements and suggestions.
package/index.js CHANGED
@@ -1,18 +1,20 @@
1
- // index.js
2
- const JobStatus = require('./models/JobStatus');
3
- const Run = require('./models/Run');
4
- const Files = require('./models/Files');
5
- const Dataset = require('./models/Dataset');
6
- const Program = require('./models/Program');
7
- const QA = require('./models/QA');
8
- const ChatMessages = require('./models/ChatMessages');
9
-
10
- module.exports = {
11
- JobStatus,
12
- Run,
13
- Files,
14
- Dataset,
15
- Program,
16
- QA,
17
- ChatMessages,
18
- };
1
+ // index.js
2
+ const JobStatus = require('./models/JobStatus');
3
+ const Run = require('./models/Run');
4
+ const Files = require('./models/Files');
5
+ const Dataset = require('./models/Dataset');
6
+ const Program = require('./models/Program');
7
+ const QA = require('./models/QA');
8
+ const ChatMessages = require('./models/ChatMessages');
9
+ const LanguageObject = require('./models/langObject')
10
+
11
+ module.exports = {
12
+ JobStatus,
13
+ Run,
14
+ Files,
15
+ Dataset,
16
+ Program,
17
+ QA,
18
+ ChatMessages,
19
+ LanguageObject
20
+ };
@@ -1,41 +1,41 @@
1
- const mongoose = require("mongoose");
2
- const { Schema, Types } = mongoose;
3
-
4
- const OpenAIChatMessages = new Schema({
5
- role: {
6
- type: String,
7
- required: true,
8
- },
9
- content: {
10
- type: String,
11
- required: true,
12
- },
13
- AIchatId: {
14
- type: String,
15
- },
16
- }, { _id: false });
17
-
18
- const ChatMessageSchema = new mongoose.Schema(
19
- {
20
- assistantType: {
21
- type: String,
22
- enum: {
23
- values: ['openai', 'langchain'],
24
- },
25
- },
26
- programID: {
27
- type: mongoose.Schema.Types.ObjectId,
28
- ref: "Program",
29
- },
30
- bId: {
31
- type: String,
32
- },
33
- chatMessages: [OpenAIChatMessages],
34
- },
35
- {
36
- timestamps: true,
37
- versionKey: false,
38
- }
39
- );
40
-
41
- module.exports = mongoose.models.ChatMessages || mongoose.model("ChatMessages", ChatMessageSchema);
1
+ const mongoose = require("mongoose");
2
+ const { Schema, Types } = mongoose;
3
+
4
+ const OpenAIChatMessages = new Schema({
5
+ role: {
6
+ type: String,
7
+ required: true,
8
+ },
9
+ content: {
10
+ type: String,
11
+ required: true,
12
+ },
13
+ AIchatId: {
14
+ type: String,
15
+ },
16
+ }, { _id: false });
17
+
18
+ const ChatMessageSchema = new mongoose.Schema(
19
+ {
20
+ assistantType: {
21
+ type: String,
22
+ enum: {
23
+ values: ['openai', 'langchain'],
24
+ },
25
+ },
26
+ programID: {
27
+ type: mongoose.Schema.Types.ObjectId,
28
+ ref: "Program",
29
+ },
30
+ bId: {
31
+ type: String,
32
+ },
33
+ chatMessages: [OpenAIChatMessages],
34
+ },
35
+ {
36
+ timestamps: true,
37
+ versionKey: false,
38
+ }
39
+ );
40
+
41
+ module.exports = mongoose.models.ChatMessages || mongoose.model("ChatMessages", ChatMessageSchema);
package/models/Dataset.js CHANGED
@@ -1,34 +1,34 @@
1
- const mongoose = require('mongoose');
2
- const { Schema, Types } = mongoose;
3
-
4
- const QAPairSchema = new Schema(
5
- {
6
- question: { type: String },
7
- expectedAnswer: { type: String },
8
- },
9
- { timestamps: true, versionKey: false }
10
- );
11
-
12
- const DatasetSchema = new Schema(
13
- {
14
- programID: {
15
- type: Types.ObjectId,
16
- },
17
- name: {
18
- type: String,
19
- },
20
- description: {
21
- type: String,
22
- },
23
- qaPairs: [QAPairSchema],
24
- runs: [
25
- {
26
- type: Types.ObjectId,
27
- ref: "Run",
28
- },
29
- ],
30
- },
31
- { timestamps: true, versionKey: false }
32
- );
33
-
34
- module.exports = mongoose.models.Dataset || mongoose.model("Dataset", DatasetSchema);
1
+ const mongoose = require('mongoose');
2
+ const { Schema, Types } = mongoose;
3
+
4
+ const QAPairSchema = new Schema(
5
+ {
6
+ question: { type: String },
7
+ expectedAnswer: { type: String },
8
+ },
9
+ { timestamps: true, versionKey: false }
10
+ );
11
+
12
+ const DatasetSchema = new Schema(
13
+ {
14
+ programID: {
15
+ type: Types.ObjectId,
16
+ },
17
+ name: {
18
+ type: String,
19
+ },
20
+ description: {
21
+ type: String,
22
+ },
23
+ qaPairs: [QAPairSchema],
24
+ runs: [
25
+ {
26
+ type: Types.ObjectId,
27
+ ref: "Run",
28
+ },
29
+ ],
30
+ },
31
+ { timestamps: true, versionKey: false }
32
+ );
33
+
34
+ module.exports = mongoose.models.Dataset || mongoose.model("Dataset", DatasetSchema);
package/models/Files.js CHANGED
@@ -1,30 +1,30 @@
1
- const mongoose = require("mongoose");
2
- const { Schema } = mongoose;
3
-
4
- const FileSchema = new Schema(
5
- {
6
- displayName: {
7
- type: String,
8
- required: [true, "Please provide a display name."],
9
- },
10
- refName: {
11
- type: String,
12
- },
13
- description: {
14
- type: String,
15
- },
16
- type: {
17
- type: String,
18
- },
19
- url: {
20
- type: String,
21
- },
22
- openAIFileID: {
23
- type: String,
24
- },
25
- programCount: { type: Number },
26
- },
27
- { timestamps: true, versionKey: false }
28
- );
29
-
30
- module.exports = mongoose.models.Files || mongoose.model("Files", FileSchema);
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const FileSchema = new Schema(
5
+ {
6
+ displayName: {
7
+ type: String,
8
+ required: [true, "Please provide a display name."],
9
+ },
10
+ refName: {
11
+ type: String,
12
+ },
13
+ description: {
14
+ type: String,
15
+ },
16
+ type: {
17
+ type: String,
18
+ },
19
+ url: {
20
+ type: String,
21
+ },
22
+ openAIFileID: {
23
+ type: String,
24
+ },
25
+ programCount: { type: Number },
26
+ },
27
+ { timestamps: true, versionKey: false }
28
+ );
29
+
30
+ module.exports = mongoose.models.Files || mongoose.model("Files", FileSchema);
@@ -1,34 +1,34 @@
1
- // This collection is used for updating the status of worker background in Nodejs, currently we are using for Run and Ingestion tasks
2
- const mongoose = require("mongoose");
3
-
4
- const JobStatusSchema = new mongoose.Schema(
5
- {
6
- runId: { type: mongoose.Schema.Types.ObjectId, ref: "Run" },
7
- programId: { type: mongoose.Schema.Types.ObjectId, ref: "Program" },
8
- jobType: {
9
- type: String,
10
- enum: ["run", "ingestion"],
11
- },
12
- status: {
13
- type: String,
14
- enum: [
15
- "pending",
16
- "in_progress",
17
- "completed",
18
- "completed_with_errors",
19
- "failed",
20
- ],
21
- default: "pending",
22
- },
23
- progress: {
24
- processed: { type: Number, default: 0 },
25
- failed: { type: Number, default: 0 },
26
- total: Number,
27
- },
28
- details: mongoose.Schema.Types.Mixed,
29
- },
30
- { timestamps: true, versionKey: false }
31
- );
32
-
33
- module.exports =
1
+ // This collection is used for updating the status of worker background in Nodejs, currently we are using for Run and Ingestion tasks
2
+ const mongoose = require("mongoose");
3
+
4
+ const JobStatusSchema = new mongoose.Schema(
5
+ {
6
+ runId: { type: mongoose.Schema.Types.ObjectId, ref: "Run" },
7
+ programId: { type: mongoose.Schema.Types.ObjectId, ref: "Program" },
8
+ jobType: {
9
+ type: String,
10
+ enum: ["run", "ingestion"],
11
+ },
12
+ status: {
13
+ type: String,
14
+ enum: [
15
+ "pending",
16
+ "in_progress",
17
+ "completed",
18
+ "completed_with_errors",
19
+ "failed",
20
+ ],
21
+ default: "pending",
22
+ },
23
+ progress: {
24
+ processed: { type: Number, default: 0 },
25
+ failed: { type: Number, default: 0 },
26
+ total: Number,
27
+ },
28
+ details: mongoose.Schema.Types.Mixed,
29
+ },
30
+ { timestamps: true, versionKey: false }
31
+ );
32
+
33
+ module.exports =
34
34
  mongoose.models.JobStatus || mongoose.model("JobStatus", JobStatusSchema);
package/models/Program.js CHANGED
@@ -1,120 +1,120 @@
1
- const mongoose = require("mongoose");
2
- const { Schema, Types } = mongoose;
3
-
4
- const FaqSchema = new Schema(
5
- {
6
- question: {
7
- type: [String],
8
- required: true,
9
- },
10
- createdAt: {
11
- type: Date,
12
- default: Date.now,
13
- },
14
- },
15
- { timestamps: true, versionKey: false }
16
- );
17
-
18
- const TestOpenAISchema = new Schema(
19
- {
20
- testAssistantID: {
21
- type: String,
22
- },
23
- testVectorStoreID: {
24
- type: String,
25
- },
26
- files: [{ type: Schema.Types.ObjectId, ref: "Files" }],
27
- },
28
- { timestamps: true, versionKey: false }
29
- );
30
-
31
- const ProgramSchema = new Schema(
32
- {
33
- name: {
34
- type: String,
35
- required: [true, "Please provide a program name."],
36
- },
37
- state: {
38
- type: String,
39
- enum: [
40
- "Alabama",
41
- "Alaska",
42
- "Arizona",
43
- "Arkansas",
44
- "California",
45
- "Colorado",
46
- "Connecticut",
47
- "Delaware",
48
- "District of Columbia",
49
- "Florida",
50
- "Georgia",
51
- "Hawaii",
52
- "Idaho",
53
- "Illinois",
54
- "Indiana",
55
- "Iowa",
56
- "Kansas",
57
- "Kentucky",
58
- "Louisiana",
59
- "Maine",
60
- "Maryland",
61
- "Massachusetts",
62
- "Michigan",
63
- "Minnesota",
64
- "Mississippi",
65
- "Missouri",
66
- "Montana",
67
- "Nebraska",
68
- "Nevada",
69
- "New Hampshire",
70
- "New Jersey",
71
- "New Mexico",
72
- "New York",
73
- "North Carolina",
74
- "North Dakota",
75
- "Ohio",
76
- "Oklahoma",
77
- "Oregon",
78
- "Pennsylvania",
79
- "Rhode Island",
80
- "South Carolina",
81
- "South Dakota",
82
- "Tennessee",
83
- "Texas",
84
- "Utah",
85
- "Vermont",
86
- "Virginia",
87
- "Washington",
88
- "West Virginia",
89
- "Wisconsin",
90
- "Wyoming",
91
- ],
92
- required: [true, "Please provide the state this program is in."],
93
- },
94
- description: {
95
- type: String,
96
- },
97
- faq: [FaqSchema],
98
- assistantID: {
99
- type: String,
100
- },
101
- vectorStoreID: {
102
- type: String,
103
- },
104
- testOpenAI: [TestOpenAISchema],
105
- // Add the embedding collection name into Program every time we create an embedding collection
106
- // This embedding is only used for Langchain RAG system, not openAI Assistant
107
- embeddingCollection: {
108
- type: String,
109
- },
110
- status: {
111
- type: String,
112
- },
113
- dataset: [{ type: Schema.Types.ObjectId, ref: "Dataset" }],
114
- files: [{ type: Schema.Types.ObjectId, ref: "Files" }],
115
- },
116
- { timestamps: true, versionKey: false }
117
- );
118
-
119
- module.exports =
120
- mongoose.models.Program || mongoose.model("Program", ProgramSchema);
1
+ const mongoose = require("mongoose");
2
+ const { Schema, Types } = mongoose;
3
+
4
+ const FaqSchema = new Schema(
5
+ {
6
+ question: {
7
+ type: [String],
8
+ required: true,
9
+ },
10
+ createdAt: {
11
+ type: Date,
12
+ default: Date.now,
13
+ },
14
+ },
15
+ { timestamps: true, versionKey: false }
16
+ );
17
+
18
+ const TestOpenAISchema = new Schema(
19
+ {
20
+ testAssistantID: {
21
+ type: String,
22
+ },
23
+ testVectorStoreID: {
24
+ type: String,
25
+ },
26
+ files: [{ type: Schema.Types.ObjectId, ref: "Files" }],
27
+ },
28
+ { timestamps: true, versionKey: false }
29
+ );
30
+
31
+ const ProgramSchema = new Schema(
32
+ {
33
+ name: {
34
+ type: String,
35
+ required: [true, "Please provide a program name."],
36
+ },
37
+ state: {
38
+ type: String,
39
+ enum: [
40
+ "Alabama",
41
+ "Alaska",
42
+ "Arizona",
43
+ "Arkansas",
44
+ "California",
45
+ "Colorado",
46
+ "Connecticut",
47
+ "Delaware",
48
+ "District of Columbia",
49
+ "Florida",
50
+ "Georgia",
51
+ "Hawaii",
52
+ "Idaho",
53
+ "Illinois",
54
+ "Indiana",
55
+ "Iowa",
56
+ "Kansas",
57
+ "Kentucky",
58
+ "Louisiana",
59
+ "Maine",
60
+ "Maryland",
61
+ "Massachusetts",
62
+ "Michigan",
63
+ "Minnesota",
64
+ "Mississippi",
65
+ "Missouri",
66
+ "Montana",
67
+ "Nebraska",
68
+ "Nevada",
69
+ "New Hampshire",
70
+ "New Jersey",
71
+ "New Mexico",
72
+ "New York",
73
+ "North Carolina",
74
+ "North Dakota",
75
+ "Ohio",
76
+ "Oklahoma",
77
+ "Oregon",
78
+ "Pennsylvania",
79
+ "Rhode Island",
80
+ "South Carolina",
81
+ "South Dakota",
82
+ "Tennessee",
83
+ "Texas",
84
+ "Utah",
85
+ "Vermont",
86
+ "Virginia",
87
+ "Washington",
88
+ "West Virginia",
89
+ "Wisconsin",
90
+ "Wyoming",
91
+ ],
92
+ required: [true, "Please provide the state this program is in."],
93
+ },
94
+ description: {
95
+ type: String,
96
+ },
97
+ faq: [FaqSchema],
98
+ assistantID: {
99
+ type: String,
100
+ },
101
+ vectorStoreID: {
102
+ type: String,
103
+ },
104
+ testOpenAI: [TestOpenAISchema],
105
+ // Add the embedding collection name into Program every time we create an embedding collection
106
+ // This embedding is only used for Langchain RAG system, not openAI Assistant
107
+ embeddingCollection: {
108
+ type: String,
109
+ },
110
+ status: {
111
+ type: String,
112
+ },
113
+ dataset: [{ type: Schema.Types.ObjectId, ref: "Dataset" }],
114
+ files: [{ type: Schema.Types.ObjectId, ref: "Files" }],
115
+ },
116
+ { timestamps: true, versionKey: false }
117
+ );
118
+
119
+ module.exports =
120
+ mongoose.models.Program || mongoose.model("Program", ProgramSchema);
package/models/QA.js CHANGED
@@ -1,60 +1,60 @@
1
- const mongoose = require("mongoose");
2
- const { Schema, Types } = mongoose;
3
-
4
- const QASchema = new Schema(
5
- {
6
- programID: {
7
- type: Types.ObjectId,
8
- ref: "Program",
9
- },
10
- question: {
11
- type: String,
12
- },
13
- answer: {
14
- type: String,
15
- },
16
- assistantModel: {
17
- type: String,
18
- enum: ["langchain-assistant", "openAI-assistant"],
19
- },
20
- instruction: {
21
- type: String,
22
- },
23
- modelName: {
24
- type: String,
25
- enum: [
26
- "gpt-4o",
27
- "gpt-4o-mini",
28
- "gpt-4-turbo-preview",
29
- "gpt-4-turbo",
30
- "gpt-4-turbo-2024-04-09",
31
- "gpt-4-0125-preview",
32
- "gpt-4-1106-preview",
33
- "gpt-4",
34
- "gpt-4-0613",
35
- "gpt-4-32k",
36
- "gpt-4-32k-0613",
37
- "gpt-3.5-turbo-0125",
38
- "gpt-3.5-turbo",
39
- "gpt-3.5-turbo-1106",
40
- "gpt-3.5-turbo-instruct",
41
- ],
42
- },
43
- score: {
44
- type: Number,
45
- enum: [0, 1, 2, 3, 4, 5],
46
- },
47
- messageId: {
48
- type: String,
49
- },
50
- batchId: {
51
- type: String,
52
- },
53
- },
54
- {
55
- timestamps: true,
56
- versionKey: false,
57
- }
58
- );
59
-
60
- module.exports = mongoose.models.QA || mongoose.model("QA", QASchema);
1
+ const mongoose = require("mongoose");
2
+ const { Schema, Types } = mongoose;
3
+
4
+ const QASchema = new Schema(
5
+ {
6
+ programID: {
7
+ type: Types.ObjectId,
8
+ ref: "Program",
9
+ },
10
+ question: {
11
+ type: String,
12
+ },
13
+ answer: {
14
+ type: String,
15
+ },
16
+ assistantModel: {
17
+ type: String,
18
+ enum: ["langchain-assistant", "openAI-assistant"],
19
+ },
20
+ instruction: {
21
+ type: String,
22
+ },
23
+ modelName: {
24
+ type: String,
25
+ enum: [
26
+ "gpt-4o",
27
+ "gpt-4o-mini",
28
+ "gpt-4-turbo-preview",
29
+ "gpt-4-turbo",
30
+ "gpt-4-turbo-2024-04-09",
31
+ "gpt-4-0125-preview",
32
+ "gpt-4-1106-preview",
33
+ "gpt-4",
34
+ "gpt-4-0613",
35
+ "gpt-4-32k",
36
+ "gpt-4-32k-0613",
37
+ "gpt-3.5-turbo-0125",
38
+ "gpt-3.5-turbo",
39
+ "gpt-3.5-turbo-1106",
40
+ "gpt-3.5-turbo-instruct",
41
+ ],
42
+ },
43
+ score: {
44
+ type: Number,
45
+ enum: [0, 1, 2, 3, 4, 5],
46
+ },
47
+ messageId: {
48
+ type: String,
49
+ },
50
+ batchId: {
51
+ type: String,
52
+ },
53
+ },
54
+ {
55
+ timestamps: true,
56
+ versionKey: false,
57
+ }
58
+ );
59
+
60
+ module.exports = mongoose.models.QA || mongoose.model("QA", QASchema);
package/models/Run.js CHANGED
@@ -1,73 +1,73 @@
1
- const mongoose = require('mongoose');
2
- const { Schema } = mongoose;
3
-
4
- const AssistantModel = {
5
- Langchain: 'langchain-assistant',
6
- OpenAI: 'openAI-assistant',
7
- };
8
-
9
- const ModelName = {
10
- GPT4O: 'gpt-4o',
11
- GPT4OMini: "gpt-4o-mini",
12
- GPT4TurboPreview: 'gpt-4-turbo-preview',
13
- GPT4Turbo: 'gpt-4-turbo',
14
- GPT4Turbo20240409: 'gpt-4-turbo-2024-04-09',
15
- GPT40125Preview: 'gpt-4-0125-preview',
16
- GPT41106Preview: 'gpt-4-1106-preview',
17
- GPT4: 'gpt-4',
18
- GPT40613: 'gpt-4-0613',
19
- GPT432K: 'gpt-4-32k',
20
- GPT432K0613: 'gpt-4-32k-0613',
21
- GPT3_5Turbo0125: 'gpt-3.5-turbo-0125',
22
- GPT3_5Turbo: 'gpt-3.5-turbo',
23
- GPT3_5Turbo1106: 'gpt-3.5-turbo-1106',
24
- GPT3_5TurboInstruct: 'gpt-3.5-turbo-instruct',
25
- };
26
-
27
- const RunType = {
28
- SINGLE_LOOP: 'single-loop',
29
- PAIR_WISE_COMPARE: 'pair-wise-compare',
30
- };
31
-
32
- const AnswerSchema = new Schema({
33
- prediction: { type: String, required: true },
34
- assistantModel: {
35
- type: String,
36
- enum: Object.values(AssistantModel),
37
- required: true,
38
- },
39
- }, { versionKey: false });
40
-
41
- const EvalSchema = new Schema({
42
- evalData: [
43
- {
44
- answers: { type: [AnswerSchema] },
45
- llmScore: { type: String },
46
- llmReasoning: { type: String },
47
- humanScore: { type: String },
48
- humanReasoning: { type: String },
49
- },
50
- ],
51
- question: { type: String },
52
- expectedAnswer: { type: String },
53
- }, { versionKey: false });
54
-
55
- const RunSchema = new mongoose.Schema({
56
- name: { type: String },
57
- description: { type: String },
58
- type: {
59
- type: String,
60
- enum: Object.values(RunType),
61
- },
62
- instruction: { type: String },
63
- modelName: {
64
- type: String,
65
- enum: Object.values(ModelName),
66
- },
67
- evalResults: { type: [EvalSchema], required: true },
68
- llmPassRate: { type: Schema.Types.Mixed },
69
- humanPassRate: { type: Schema.Types.Mixed },
70
- }, { timestamps: true, versionKey: false });
71
-
72
-
73
- module.exports = mongoose.models.Run || mongoose.model('Run', RunSchema);
1
+ const mongoose = require('mongoose');
2
+ const { Schema } = mongoose;
3
+
4
+ const AssistantModel = {
5
+ Langchain: 'langchain-assistant',
6
+ OpenAI: 'openAI-assistant',
7
+ };
8
+
9
+ const ModelName = {
10
+ GPT4O: 'gpt-4o',
11
+ GPT4OMini: "gpt-4o-mini",
12
+ GPT4TurboPreview: 'gpt-4-turbo-preview',
13
+ GPT4Turbo: 'gpt-4-turbo',
14
+ GPT4Turbo20240409: 'gpt-4-turbo-2024-04-09',
15
+ GPT40125Preview: 'gpt-4-0125-preview',
16
+ GPT41106Preview: 'gpt-4-1106-preview',
17
+ GPT4: 'gpt-4',
18
+ GPT40613: 'gpt-4-0613',
19
+ GPT432K: 'gpt-4-32k',
20
+ GPT432K0613: 'gpt-4-32k-0613',
21
+ GPT3_5Turbo0125: 'gpt-3.5-turbo-0125',
22
+ GPT3_5Turbo: 'gpt-3.5-turbo',
23
+ GPT3_5Turbo1106: 'gpt-3.5-turbo-1106',
24
+ GPT3_5TurboInstruct: 'gpt-3.5-turbo-instruct',
25
+ };
26
+
27
+ const RunType = {
28
+ SINGLE_LOOP: 'single-loop',
29
+ PAIR_WISE_COMPARE: 'pair-wise-compare',
30
+ };
31
+
32
+ const AnswerSchema = new Schema({
33
+ prediction: { type: String, required: true },
34
+ assistantModel: {
35
+ type: String,
36
+ enum: Object.values(AssistantModel),
37
+ required: true,
38
+ },
39
+ }, { versionKey: false });
40
+
41
+ const EvalSchema = new Schema({
42
+ evalData: [
43
+ {
44
+ answers: { type: [AnswerSchema] },
45
+ llmScore: { type: String },
46
+ llmReasoning: { type: String },
47
+ humanScore: { type: String },
48
+ humanReasoning: { type: String },
49
+ },
50
+ ],
51
+ question: { type: String },
52
+ expectedAnswer: { type: String },
53
+ }, { versionKey: false });
54
+
55
+ const RunSchema = new mongoose.Schema({
56
+ name: { type: String },
57
+ description: { type: String },
58
+ type: {
59
+ type: String,
60
+ enum: Object.values(RunType),
61
+ },
62
+ instruction: { type: String },
63
+ modelName: {
64
+ type: String,
65
+ enum: Object.values(ModelName),
66
+ },
67
+ evalResults: { type: [EvalSchema], required: true },
68
+ llmPassRate: { type: Schema.Types.Mixed },
69
+ humanPassRate: { type: Schema.Types.Mixed },
70
+ }, { timestamps: true, versionKey: false });
71
+
72
+
73
+ module.exports = mongoose.models.Run || mongoose.model('Run', RunSchema);
@@ -0,0 +1,13 @@
1
+ const mongoose = require("mongoose");
2
+
3
+ const LanguageObjectSchema = new mongoose.Schema(
4
+ {
5
+ timestamps: true,
6
+ versionKey: false,
7
+ strict: false
8
+ }
9
+ );
10
+
11
+ module.exports =
12
+ mongoose.models.LanguageObject ||
13
+ mongoose.model("LanguageObject", LanguageObjectSchema);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
- {
2
- "name": "ben-ai-models-registry",
3
- "version": "1.0.13",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC",
12
- "dependencies": {
13
- "mongoose": "^8.4.4"
14
- }
15
- }
1
+ {
2
+ "name": "ben-ai-models-registry",
3
+ "version": "1.0.14",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "mongoose": "^8.4.4"
14
+ }
15
+ }