ben-ai-models-registry 1.0.2 → 1.0.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.
package/README.md CHANGED
@@ -1 +1,37 @@
1
- This repositry is for shared mongoose models used in all Bennie and the AI Jets node apps.
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.
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- // index.js
2
- const JobStatus = require('./models/JobStatus');
3
- const Run = require('./models/Run');
4
-
5
- module.exports = {
6
- JobStatus,
7
- Run
8
- };
1
+ // index.js
2
+ const JobStatus = require('./models/JobStatus');
3
+ const Run = require('./models/Run');
4
+
5
+ module.exports = {
6
+ JobStatus,
7
+ Run
8
+ };
@@ -1,19 +1,20 @@
1
- const mongoose = require('mongoose');
2
-
3
- const JobStatusSchema = new mongoose.Schema(
4
- {
5
- runId: { type: mongoose.Schema.Types.ObjectId, ref: 'Run' },
6
- status: {
7
- type: String,
8
- enum: ['pending', 'in_progress', 'completed', 'failed'],
9
- default: 'pending',
10
- },
11
- progress: {
12
- processedQAPairs: { type: Number, default: 0 },
13
- totalQAPairs: Number,
14
- },
15
- },
16
- { timestamps: true, versionKey: false }
17
- );
18
-
19
- module.exports = mongoose.model('JobStatus', JobStatusSchema);
1
+ const mongoose = require('mongoose');
2
+
3
+ const JobStatusSchema = new mongoose.Schema(
4
+ {
5
+ runId: { type: mongoose.Schema.Types.ObjectId, ref: 'Run' },
6
+ status: {
7
+ type: String,
8
+ enum: ['pending', 'in_progress', 'completed', 'failed'],
9
+ default: 'pending',
10
+ },
11
+ progress: {
12
+ processedQAPairs: { type: Number, default: 0 },
13
+ totalQAPairs: Number,
14
+ },
15
+ },
16
+ { timestamps: true, versionKey: false }
17
+ );
18
+
19
+
20
+ module.exports = mongoose.models.JobStatus || mongoose.model('JobStatus', JobStatusSchema);
package/models/Run.js CHANGED
@@ -1,74 +1,74 @@
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
- GPT4TurboPreview: 'gpt-4-turbo-preview',
12
- GPT4Turbo: 'gpt-4-turbo',
13
- GPT4Turbo20240409: 'gpt-4-turbo-2024-04-09',
14
- GPT40125Preview: 'gpt-4-0125-preview',
15
- GPT41106Preview: 'gpt-4-1106-preview',
16
- GPT4: 'gpt-4',
17
- GPT40613: 'gpt-4-0613',
18
- GPT432K: 'gpt-4-32k',
19
- GPT432K0613: 'gpt-4-32k-0613',
20
- GPT3_5Turbo0125: 'gpt-3.5-turbo-0125',
21
- GPT3_5Turbo: 'gpt-3.5-turbo',
22
- GPT3_5Turbo1106: 'gpt-3.5-turbo-1106',
23
- GPT3_5TurboInstruct: 'gpt-3.5-turbo-instruct',
24
- };
25
-
26
- const RunType = {
27
- SINGLE_LOOP: 'single-loop',
28
- PAIR_WISE_COMPARE: 'pair-wise-compare',
29
- };
30
-
31
- const AnswerSchema = new Schema({
32
- prediction: { type: String, required: true },
33
- assistantModel: {
34
- type: String,
35
- enum: Object.values(AssistantModel),
36
- required: true,
37
- },
38
- }, { versionKey: false });
39
-
40
- const EvalSchema = new Schema({
41
- evalData: [
42
- {
43
- answers: { type: [AnswerSchema] },
44
- llmScore: { type: String },
45
- llmReasoning: { type: String },
46
- humanScore: { type: String },
47
- humanReasoning: { type: String },
48
- },
49
- ],
50
- question: { type: String },
51
- expectedAnswer: { type: String },
52
- }, { versionKey: false });
53
-
54
- const RunSchema = new mongoose.Schema({
55
- name: { type: String },
56
- description: { type: String },
57
- type: {
58
- type: String,
59
- enum: Object.values(RunType),
60
- },
61
- instruction: { type: String },
62
- modelName: {
63
- type: String,
64
- enum: Object.values(ModelName),
65
- },
66
- evalResults: { type: [EvalSchema], required: true },
67
- llmPassRate: { type: Number },
68
- humanPassRate: { type: Number },
69
- }, { timestamps: true, versionKey: false });
70
-
71
- // const Run = mongoose.models.Run || mongoose.model('Run', RunSchema);
72
- // module.exports = { Run, AssistantModel, ModelName, RunType };
73
-
74
- module.exports = 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
+ GPT4TurboPreview: 'gpt-4-turbo-preview',
12
+ GPT4Turbo: 'gpt-4-turbo',
13
+ GPT4Turbo20240409: 'gpt-4-turbo-2024-04-09',
14
+ GPT40125Preview: 'gpt-4-0125-preview',
15
+ GPT41106Preview: 'gpt-4-1106-preview',
16
+ GPT4: 'gpt-4',
17
+ GPT40613: 'gpt-4-0613',
18
+ GPT432K: 'gpt-4-32k',
19
+ GPT432K0613: 'gpt-4-32k-0613',
20
+ GPT3_5Turbo0125: 'gpt-3.5-turbo-0125',
21
+ GPT3_5Turbo: 'gpt-3.5-turbo',
22
+ GPT3_5Turbo1106: 'gpt-3.5-turbo-1106',
23
+ GPT3_5TurboInstruct: 'gpt-3.5-turbo-instruct',
24
+ };
25
+
26
+ const RunType = {
27
+ SINGLE_LOOP: 'single-loop',
28
+ PAIR_WISE_COMPARE: 'pair-wise-compare',
29
+ };
30
+
31
+ const AnswerSchema = new Schema({
32
+ prediction: { type: String, required: true },
33
+ assistantModel: {
34
+ type: String,
35
+ enum: Object.values(AssistantModel),
36
+ required: true,
37
+ },
38
+ }, { versionKey: false });
39
+
40
+ const EvalSchema = new Schema({
41
+ evalData: [
42
+ {
43
+ answers: { type: [AnswerSchema] },
44
+ llmScore: { type: String },
45
+ llmReasoning: { type: String },
46
+ humanScore: { type: String },
47
+ humanReasoning: { type: String },
48
+ },
49
+ ],
50
+ question: { type: String },
51
+ expectedAnswer: { type: String },
52
+ }, { versionKey: false });
53
+
54
+ const RunSchema = new mongoose.Schema({
55
+ name: { type: String },
56
+ description: { type: String },
57
+ type: {
58
+ type: String,
59
+ enum: Object.values(RunType),
60
+ },
61
+ instruction: { type: String },
62
+ modelName: {
63
+ type: String,
64
+ enum: Object.values(ModelName),
65
+ },
66
+ evalResults: { type: [EvalSchema], required: true },
67
+ llmPassRate: { type: Number },
68
+ humanPassRate: { type: Schema.Types.Mixed },
69
+ }, { timestamps: true, versionKey: false });
70
+
71
+ // const Run = mongoose.models.Run || mongoose.model('Run', RunSchema);
72
+ // module.exports = { Run, AssistantModel, ModelName, RunType };
73
+
74
+ module.exports = mongoose.models.Run || mongoose.model('Run', RunSchema);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
- {
2
- "name": "ben-ai-models-registry",
3
- "version": "1.0.2",
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.4",
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
+ }