ben-ai-models-registry 1.0.7 → 1.0.8
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/models/Dataset.js +34 -0
- package/models/Files.js +29 -0
- package/models/Program.js +120 -0
- package/models/QA.js +69 -0
- package/package.json +1 -1
|
@@ -0,0 +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);
|
package/models/Files.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
},
|
|
26
|
+
{ timestamps: true, versionKey: false }
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
module.exports = mongoose.models.Files || mongoose.model("Files", FileSchema);
|
|
@@ -0,0 +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);
|
package/models/QA.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
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: [
|
|
19
|
+
"langchain-assistant",
|
|
20
|
+
"openAI-assistant"
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
instruction: {
|
|
24
|
+
type: String,
|
|
25
|
+
},
|
|
26
|
+
modelName: {
|
|
27
|
+
type: String,
|
|
28
|
+
enum: [
|
|
29
|
+
"gpt-4o",
|
|
30
|
+
"gpt-4-turbo-preview",
|
|
31
|
+
"gpt-4-turbo",
|
|
32
|
+
"gpt-4-turbo-2024-04-09",
|
|
33
|
+
"gpt-4-0125-preview",
|
|
34
|
+
"gpt-4-1106-preview",
|
|
35
|
+
"gpt-4",
|
|
36
|
+
"gpt-4-0613",
|
|
37
|
+
"gpt-4-32k",
|
|
38
|
+
"gpt-4-32k-0613",
|
|
39
|
+
"gpt-3.5-turbo-0125",
|
|
40
|
+
"gpt-3.5-turbo",
|
|
41
|
+
"gpt-3.5-turbo-1106",
|
|
42
|
+
"gpt-3.5-turbo-instruct"
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
score: {
|
|
46
|
+
type: Number,
|
|
47
|
+
enum: [
|
|
48
|
+
0,
|
|
49
|
+
1,
|
|
50
|
+
2,
|
|
51
|
+
3,
|
|
52
|
+
4,
|
|
53
|
+
5
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
messageId: {
|
|
57
|
+
type: String,
|
|
58
|
+
},
|
|
59
|
+
batchId: {
|
|
60
|
+
type: String,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
timestamps: true,
|
|
65
|
+
versionKey: false,
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
module.exports = mongoose.models.QA || mongoose.model("QA", QASchema);
|