only_ever_generator 0.5.1 → 0.5.2

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.
@@ -297,6 +297,6 @@ const promptData = {
297
297
  function returnPromptData() {
298
298
  return {
299
299
  "typology": (0, typology_prompt_1.returnTypologyPrompt)(),
300
- "card_generation": (0, card_gen_prompt_1.returnCardGenPrompt)(''),
300
+ "card_generation": (0, card_gen_prompt_1.returnCardGenPrompt)(),
301
301
  };
302
302
  }
@@ -66,7 +66,6 @@ Test cards must be one of the following types:
66
66
 
67
67
  1. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
68
68
 
69
- json
70
69
  {
71
70
  "type": "mcq",
72
71
  "card_content": {
@@ -107,13 +106,13 @@ json
107
106
  • Minimum choices required: 2
108
107
  • Maximum choices allowed: 8
109
108
  • Minimum correct choices required: 1
110
- • Maximum character length for the prompt: 320
111
- • Maximum character length for each choice: 42
109
+ • Maximum character length for the prompt: 90
110
+ • Maximum character length for each choice: 40
112
111
  • Do not add numbering to the choice content since these will be randomly sorted when displaying to the user
113
112
 
114
113
  2. Cloze: A test card where a portion of text is masked for the learner to identify from the provided options. Use double curly braces {{c<n>: cloze_text}} to indicate a cloze, where n is the index number of the cloze (starting from 0) and cloze_text is the word or phrase being clozed.
114
+ Strictly follow the above double curly braces {{c<n>: cloze_text}} for the clozes.
115
115
 
116
- json
117
116
  {
118
117
  "type": "cloze",
119
118
  "card_content": {
@@ -161,14 +160,13 @@ json
161
160
 
162
161
  4. Match: Pairing items.
163
162
 
164
- json
163
+
165
164
  {
166
165
  "type": "match",
167
-
168
166
  "card_content" : [
169
167
  {
170
168
  "left_item" : "left_item text",
171
- "right_item" : ["right_item text" ]
169
+ "right_item" : ["right_item text"]
172
170
  },
173
171
  {
174
172
  "left_item" : "left_item text",
@@ -203,7 +201,7 @@ json
203
201
  "bloom_level": <1-5>
204
202
  }
205
203
 
206
- * Maximum character length for each item in a pair: 42
204
+ * Maximum character length for each item in a pair: 24
207
205
  * Duplicate items are allowed on the left side but not on the right side. Or in other words the same item on the left can be paired with multiple items on the right.
208
206
 
209
207
 
@@ -215,7 +213,6 @@ json
215
213
  3. For each concept and fact start by trying to create a card at the highest bloom level possible.
216
214
  4. Do not skip any concepts or facts, and be thorough in your coverage.
217
215
  5. Cards should span across different levels of Bloom’s Taxonomy, from level 1 (Remembering) to level 5 (Evaluating), but exclude level 6 (Creating).
218
- Once you are done generating the test cards. Go back and evaulate the full list of concepts and facts provided as the input.
219
216
 
220
217
  Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
221
218
 
@@ -229,6 +226,6 @@ Once you are done generating the test cards, review the full list of concepts an
229
226
 
230
227
  Only stop generating test questions once you believe there is sufficient testing material for learners to fully understand the concepts and remember the facts. The same concept or fact can have multiple test cards, so continue creating test cards until you are confident that there are enough for learners to fully grasp the source material.
231
228
  `;
232
- function returnCardGenPrompt(cardGenPrompt) {
229
+ function returnCardGenPrompt() {
233
230
  return promptString;
234
231
  }
@@ -30,10 +30,10 @@ json
30
30
  },
31
31
  {...}
32
32
  ],
33
- "generate_cards": [
33
+ "generate_cards": {
34
34
  state: true or false,
35
35
  reason: "reason for marking the source as false. Leave empty for true."
36
- ],
36
+ },
37
37
  "summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
38
38
  }
39
39
 
package/dist/index.js CHANGED
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.OnlyEverGenerator = void 0;
13
13
  const app_1 = require("./bootstrap/app");
14
14
  Object.defineProperty(exports, "OnlyEverGenerator", { enumerable: true, get: function () { return app_1.OnlyEverGenerator; } });
15
- // //. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
16
- // //below this line
15
+ //. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
16
+ //below this line
17
17
  // let oeGen = new OnlyEverGenerator(config.openAIKey, "gpt-4o", {
18
18
  // prompt: returnPromptData(),
19
19
  // content: returnSourceData(),
@@ -46,24 +46,24 @@ Object.defineProperty(exports, "OnlyEverGenerator", { enumerable: true, get: fun
46
46
  // let parsedData = new ParseCardResponse().parse(cardResp,false);
47
47
  // res.send(parsedData)
48
48
  // });
49
- // app.get("/typology", async (req, res) => {
50
- // {
51
- // let typologyPrompt = returnTypologyPrompt();
52
- // let cardPrompt = returnCardGenPrompt();
53
- // let args = new GenerateArgs(
54
- // true,
55
- // true,
56
- // false,
57
- // {
58
- // typology_prompt: typologyPrompt,
59
- // card_gen_prompt: cardPrompt,
60
- // summary_prompt: "",
61
- // }
62
- // )
63
- // let typologyRequest = await oeGen.generate(false, true);
64
- // res.send(typologyRequest);
65
- // }
66
- // });
49
+ // // app.get("/typology", async (req, res) => {
50
+ // // {
51
+ // // let typologyPrompt = returnTypologyPrompt();
52
+ // // let cardPrompt = returnCardGenPrompt();
53
+ // // let args = new GenerateArgs(
54
+ // // true,
55
+ // // true,
56
+ // // false,
57
+ // // {
58
+ // // typology_prompt: typologyPrompt,
59
+ // // card_gen_prompt: cardPrompt,
60
+ // // summary_prompt: "",
61
+ // // }
62
+ // // )
63
+ // // let typologyRequest = await oeGen.generate(false, true);
64
+ // // res.send(typologyRequest);
65
+ // // }
66
+ // // });
67
67
  // app.listen(port, () => {
68
68
  // console.log(`Example app listening at http://localhost:${port}`);
69
69
  // });
@@ -45,8 +45,11 @@ class ParseCardResponse {
45
45
  usage_data.status = "failed";
46
46
  }
47
47
  }
48
+ if (cardData.length == 0) {
49
+ usage_data.status = "failed";
50
+ }
48
51
  return {
49
- status_code: 200,
52
+ status_code: cardData.length == 0 ? 400 : 200,
50
53
  metadata: usage_data,
51
54
  type: type,
52
55
  missing_concepts: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "only_ever_generator",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "start": "npm run build && nodemon dist/index.js",
@@ -298,6 +298,6 @@ const promptData: any = {
298
298
  export function returnPromptData(){
299
299
  return {
300
300
  "typology": returnTypologyPrompt(),
301
- "card_generation": returnCardGenPrompt(''),
301
+ "card_generation": returnCardGenPrompt(),
302
302
  };
303
303
  }
@@ -63,7 +63,6 @@ Test cards must be one of the following types:
63
63
 
64
64
  1. Multiple Choice Questions (MCQ): Provide multiple choices to pick from. One or more should be correct.
65
65
 
66
- json
67
66
  {
68
67
  "type": "mcq",
69
68
  "card_content": {
@@ -104,13 +103,13 @@ json
104
103
  • Minimum choices required: 2
105
104
  • Maximum choices allowed: 8
106
105
  • Minimum correct choices required: 1
107
- • Maximum character length for the prompt: 320
108
- • Maximum character length for each choice: 42
106
+ • Maximum character length for the prompt: 90
107
+ • Maximum character length for each choice: 40
109
108
  • Do not add numbering to the choice content since these will be randomly sorted when displaying to the user
110
109
 
111
110
  2. Cloze: A test card where a portion of text is masked for the learner to identify from the provided options. Use double curly braces {{c<n>: cloze_text}} to indicate a cloze, where n is the index number of the cloze (starting from 0) and cloze_text is the word or phrase being clozed.
111
+ Strictly follow the above double curly braces {{c<n>: cloze_text}} for the clozes.
112
112
 
113
- json
114
113
  {
115
114
  "type": "cloze",
116
115
  "card_content": {
@@ -158,14 +157,13 @@ json
158
157
 
159
158
  4. Match: Pairing items.
160
159
 
161
- json
160
+
162
161
  {
163
162
  "type": "match",
164
-
165
163
  "card_content" : [
166
164
  {
167
165
  "left_item" : "left_item text",
168
- "right_item" : ["right_item text" ]
166
+ "right_item" : ["right_item text"]
169
167
  },
170
168
  {
171
169
  "left_item" : "left_item text",
@@ -200,7 +198,7 @@ json
200
198
  "bloom_level": <1-5>
201
199
  }
202
200
 
203
- * Maximum character length for each item in a pair: 42
201
+ * Maximum character length for each item in a pair: 24
204
202
  * Duplicate items are allowed on the left side but not on the right side. Or in other words the same item on the left can be paired with multiple items on the right.
205
203
 
206
204
 
@@ -212,7 +210,6 @@ json
212
210
  3. For each concept and fact start by trying to create a card at the highest bloom level possible.
213
211
  4. Do not skip any concepts or facts, and be thorough in your coverage.
214
212
  5. Cards should span across different levels of Bloom’s Taxonomy, from level 1 (Remembering) to level 5 (Evaluating), but exclude level 6 (Creating).
215
- Once you are done generating the test cards. Go back and evaulate the full list of concepts and facts provided as the input.
216
213
 
217
214
  Are there any concept or fact that don't have a test card yet? If yes, go back and create one.
218
215
 
@@ -226,7 +223,7 @@ Once you are done generating the test cards, review the full list of concepts an
226
223
 
227
224
  Only stop generating test questions once you believe there is sufficient testing material for learners to fully understand the concepts and remember the facts. The same concept or fact can have multiple test cards, so continue creating test cards until you are confident that there are enough for learners to fully grasp the source material.
228
225
  `;
229
- export function returnCardGenPrompt(cardGenPrompt: any){
226
+ export function returnCardGenPrompt(){
230
227
  return promptString;
231
228
  }
232
229
 
@@ -27,10 +27,10 @@ json
27
27
  },
28
28
  {...}
29
29
  ],
30
- "generate_cards": [
30
+ "generate_cards": {
31
31
  state: true or false,
32
32
  reason: "reason for marking the source as false. Leave empty for true."
33
- ],
33
+ },
34
34
  "summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
35
35
  }
36
36
 
package/src/index.ts CHANGED
@@ -13,13 +13,16 @@ import { OnlyEverGenerator } from "./bootstrap/app";
13
13
  // import { GenerateCards } from "./card_gen/generate_cards";
14
14
  // import { OpenAiService } from "./services/open_ai_service";
15
15
  // import { ParseCardResponse } from "./parse/parse_card_response";
16
+ // import { returnTypologyPrompt } from "./constants/prompts/typology_prompt";
17
+ // import { returnCardGenPrompt } from "./constants/prompts/card_gen_prompt";
18
+ // import { GenerateArgs } from "./utils/generate_args";
16
19
 
17
20
  /// While Publishing the package , and using this code as a separate npm module
18
21
  /// uncomment the below line and comment all the others, expect the import of OnlyEverGenerator
19
22
  export {OnlyEverGenerator};
20
23
 
21
- // //. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
22
- // //below this line
24
+ //. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
25
+ //below this line
23
26
  // let oeGen = new OnlyEverGenerator(config.openAIKey, "gpt-4o", {
24
27
  // prompt: returnPromptData(),
25
28
  // content: returnSourceData(),
@@ -57,24 +60,24 @@ import { OnlyEverGenerator } from "./bootstrap/app";
57
60
  // res.send(parsedData)
58
61
  // });
59
62
 
60
- // app.get("/typology", async (req, res) => {
61
- // {
62
- // let typologyPrompt = returnTypologyPrompt();
63
- // let cardPrompt = returnCardGenPrompt();
64
- // let args = new GenerateArgs(
65
- // true,
66
- // true,
67
- // false,
68
- // {
69
- // typology_prompt: typologyPrompt,
70
- // card_gen_prompt: cardPrompt,
71
- // summary_prompt: "",
72
- // }
73
- // )
74
- // let typologyRequest = await oeGen.generate(false, true);
75
- // res.send(typologyRequest);
76
- // }
77
- // });
63
+ // // app.get("/typology", async (req, res) => {
64
+ // // {
65
+ // // let typologyPrompt = returnTypologyPrompt();
66
+ // // let cardPrompt = returnCardGenPrompt();
67
+ // // let args = new GenerateArgs(
68
+ // // true,
69
+ // // true,
70
+ // // false,
71
+ // // {
72
+ // // typology_prompt: typologyPrompt,
73
+ // // card_gen_prompt: cardPrompt,
74
+ // // summary_prompt: "",
75
+ // // }
76
+ // // )
77
+ // // let typologyRequest = await oeGen.generate(false, true);
78
+ // // res.send(typologyRequest);
79
+ // // }
80
+ // // });
78
81
 
79
82
  // app.listen(port, () => {
80
83
  // console.log(`Example app listening at http://localhost:${port}`);
@@ -39,9 +39,13 @@ export class ParseCardResponse {
39
39
  usage_data.status = "failed";
40
40
  }
41
41
  }
42
+ if(cardData.length == 0){
43
+ usage_data.status="failed";
44
+
45
+ }
42
46
 
43
47
  return {
44
- status_code: 200,
48
+ status_code: cardData.length == 0 ? 400:200,
45
49
  metadata: usage_data,
46
50
  type: type,
47
51
  missing_concepts: [],