only_ever_generator 0.1.7 → 0.1.9

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.
@@ -1,30 +1,108 @@
1
1
  "use strict";
2
+ // const typologyPromptString = `
3
+ // As a dedicated assistant at a learning company, your role involves analyzing educational content to categorize and summarize it. You will process content (in JSON format) that represents text and images from diverse sources such as PDFs, book chapters, videos, and websites. Follow these steps:
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  exports.returnTypologyPrompt = void 0;
4
- const typologyPromptString = `
6
+ // 1. Classify the content into one to three predefined fields of knowledge.
7
+ // 2. Identify key concepts within the content.
8
+ // 3. Detect concrete facts that are empirically verified and relevant to the subject.
9
+ // 4. Decide whether the identified concepts and facts should be used to generate learning materials like flashcards based on their educational value.
10
+ // 5. If the generate_cards is true then summarize the content using a series of summary cards.
11
+ // Please format your findings in this JSON schema:
12
+ // json
13
+ // {
14
+ // "field": ["primary_field", "secondary_field", "tertiary_field"],
15
+ // "concepts": ["concept1", "concept2", "concept3", "..."],
16
+ // "facts": ["fact1", "fact2", "fact3", "..."],
17
+ // "generate_cards": [
18
+ // state: true or false,
19
+ // false_reason: "reason for marking the source as false. Leave empty for true."
20
+ // ],
21
+ // "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
22
+ // }
23
+ // Further instruction on how to perform these tasks are below.
24
+ // Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
25
+ // 1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
26
+ // 2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
27
+ // 3. Humanities & Cultural Studies: Highlight History, Literature, Languages, Arts, Philosophy, and Anthropological Studies.
28
+ // 4. Social Sciences & Global Studies: Include Sociology, Psychology, Economics, Political Science, Anthropology, and International Relations.
29
+ // 5. Business & Management: Encompass Entrepreneurship, Marketing, Finance, Leadership, and Ethics.
30
+ // 6. Health & Medicine: Cover Medical Sciences, Public Health, Nutrition, Wellness, and Mental Health.
31
+ // 7. Environmental Studies & Earth Sciences: Discuss Ecology, Climate Science, Geology, and Environmental Policy.
32
+ // 8. Education, Learning & Personal Development: Talk about Educational Theories, Teaching Methods, and Personal Skills.
33
+ // 9. Creative & Performing Arts: Include Visual Arts, Music, Theater, Dance, and Design Principles.
34
+ // 10. Law, Governance & Ethics: Focus on Legal Studies, Public Administration, Policy Analysis, and Ethical Decision-Making.
35
+ // 11. Recreation, Lifestyle & Practical Skills: Highlight Hobbies, Sports, Travel, Lifestyle Choices, and Practical Skills.
36
+ // 12. Technology & Media Literacy: Discuss Digital Literacy, Media Studies, and the Impact of Digital Media.
37
+ // 13. Philosophy & Critical Thinking: Emphasize Moral Philosophy, Ethical Frameworks, and Critical Thinking.
38
+ // 14. Space & Astronomical Sciences: Focus on Space Exploration, Astronomy, and Astrophysics.
39
+ // 15. Agriculture & Food Sciences: Discuss Sustainable Farming, Food Technology, and Nutrition.
40
+ // 16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
41
+ // 17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
42
+ // 18. Other: Use for content that doesn’t fit into the above categories.
43
+ // Identify key concepts within the content after classifying the field. Concepts are the fundamental ideas or categories that form the basis of knowledge within any discipline. They help organize and explain information, making it accessible and relatable.
44
+ // 1. **Definition of a Concept**: Concepts should be significant ideas that recur within the content and are essential for understanding the main themes.
45
+ // 2. **Inclusion Criteria**: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
46
+ // List the concepts in the following JSON format:
47
+ // json
48
+ // {
49
+ // "concepts": ["concept1", "concept2", "concept3", "..."]
50
+ // }
51
+ // After classifying the content and identifying key concepts, proceed to extract and list verifiable facts. Facts are objective statements that must be supported by empirical evidence or observation, such as specific data on events, people, numbers, dates, or well-established ideas.
52
+ // 1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
53
+ // 2. **Selection Criteria**: Choose facts based on their significance to the content's main themes or concepts, their educational value, or their foundational role in the subject.
54
+ // Record the facts in the following JSON format:
55
+ // json
56
+ // {
57
+ // "facts": ["fact1", "fact2", "fact3", "..."]
58
+ // }
59
+ // After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing materials. Consider if these elements provide significant educational value to an average learner by enhancing understanding, offering practical applications, or supporting crucial educational goals. If you decide that testing cards don't need to be generated then please provide a reason in less than 90 characters.
60
+ // 1. **Value Assessment**: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
61
+ // 2. **Criteria for Material Generation**: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
62
+ // Make your decision using this criterion and reflect it in the JSON format as follows:
63
+ // json
64
+ // "generate_cards":
65
+ // { state: true or false,
66
+ // false_reason: "reason for marking the source as false. Leave empty for true."
67
+ // }
68
+ // After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards. These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
69
+ // 1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
70
+ // 2. **Summarization Objective**: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
71
+ // 3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
72
+ // 4. **Engagement and Flow**: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
73
+ // Format your output in JSON as follows:
74
+ // json
75
+ // {
76
+ // "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
77
+ // }
78
+ // `;
79
+ const typologyPromptString = {
80
+ role: `
5
81
  As a dedicated assistant at a learning company, your role involves analyzing educational content to categorize and summarize it. You will process content (in JSON format) that represents text and images from diverse sources such as PDFs, book chapters, videos, and websites. Follow these steps:
6
82
 
7
83
  1. Classify the content into one to three predefined fields of knowledge.
8
- 2. Identify key concepts within the content.
9
- 3. Detect concrete facts that are empirically verified and relevant to the subject.
84
+ 2. Extract key concepts within the content.
85
+ 3. Extract concrete facts that are relevant to the subject and referenced in the content.
10
86
  4. Decide whether the identified concepts and facts should be used to generate learning materials like flashcards based on their educational value.
11
87
  5. If the generate_cards is true then summarize the content using a series of summary cards.
12
88
 
13
89
  Please format your findings in this JSON schema:
14
- json
15
90
  {
16
- "field": ["primary_field", "secondary_field", "tertiary_field"],
17
- "concepts": ["concept1", "concept2", "concept3", "..."],
18
- "facts": ["fact1", "fact2", "fact3", "..."],
19
- "generate_cards": [
20
- state: true or false,
21
- false_reason: "reason for marking the source as false. Leave empty for true."
22
- ],
23
- "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
91
+ "field": ["primary_field", "secondary_field", "tertiary_field"],
92
+ "concepts": ["concept1", "concept2", "concept3", "..."],
93
+ "facts": ["fact1", "fact2", "fact3", "..."],
94
+ "generate_cards": {
95
+ "state": true or false,
96
+ "false_reason": "reason for marking the source as false. Leave empty for true."
97
+ },
98
+ "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
24
99
  }
25
100
 
101
+
26
102
  Further instruction on how to perform these tasks are below.
27
- Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
103
+ `,
104
+ fields: `
105
+ Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
28
106
 
29
107
  1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
30
108
  2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
@@ -44,54 +122,68 @@ Every source must be placed under a field. This is the broadest category of know
44
122
  16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
45
123
  17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
46
124
  18. Other: Use for content that doesn’t fit into the above categories.
125
+ `,
126
+ concepts: `
127
+ Extract key concepts within the content after classifying the field. Please be as exhaustive as possible.
47
128
 
48
- Identify key concepts within the content after classifying the field. Concepts are the fundamental ideas or categories that form the basis of knowledge within any discipline. They help organize and explain information, making it accessible and relatable.
49
-
50
- 1. **Definition of a Concept**: Concepts should be significant ideas that recur within the content and are essential for understanding the main themes.
51
- 2. **Inclusion Criteria**: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
52
-
129
+ Definition of a Concept: Concepts are fundamental ideas that form the basis of knowledge in any discipline. They help organize and explain information, making it accessible and relatable.
130
+ Inclusion Criteria: Include a concept only if it is discussed in detail, meaning it is explained thoroughly, tied to specific examples, or highlighted as a critical part of the subject matter.
53
131
  List the concepts in the following JSON format:
54
- json
132
+
55
133
  {
56
- "concepts": ["concept1", "concept2", "concept3", "..."]
134
+ "concepts":
135
+ [
136
+ "concept1",
137
+ "concept2",
138
+ "concept3",
139
+ "..."
140
+ ]
57
141
  }
58
- After classifying the content and identifying key concepts, proceed to extract and list verifiable facts. Facts are objective statements that must be supported by empirical evidence or observation, such as specific data on events, people, numbers, dates, or well-established ideas.
59
-
60
- 1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
61
- 2. **Selection Criteria**: Choose facts based on their significance to the content's main themes or concepts, their educational value, or their foundational role in the subject.
142
+ `,
143
+ facts: `
144
+ After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
62
145
 
146
+ Definition of a Fact: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
147
+ Selection Criteria: Choose facts based on their significance to the content's main themes or concepts, their educational value, or their foundational role in the subject.
63
148
  Record the facts in the following JSON format:
64
- json
149
+
65
150
  {
66
- "facts": ["fact1", "fact2", "fact3", "..."]
151
+ "facts": ["fact1", "fact2", "fact3", "..."]
67
152
  }
153
+ `,
154
+ generate: `
68
155
  After analyzing the content, classifying its field, and identifying key concepts, and facts, assess whether the discovered elements warrant the creation of testing materials. Consider if these elements provide significant educational value to an average learner by enhancing understanding, offering practical applications, or supporting crucial educational goals. If you decide that testing cards don't need to be generated then please provide a reason in less than 90 characters.
69
156
 
70
- 1. **Value Assessment**: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
71
- 2. **Criteria for Material Generation**: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
72
-
157
+ Value Assessment: Determine if the concepts and facts are essential for understanding the broader topic, are likely to be used in practical scenarios, or help in achieving educational benchmarks.
158
+ Criteria for Material Generation: Generate testing materials if the concepts and facts are central to the content, have broad applicability, and are likely to reinforce or expand the learner’s knowledge significantly.
73
159
  Make your decision using this criterion and reflect it in the JSON format as follows:
74
- json
75
- "generate_cards":
76
- { state: true or false,
77
- false_reason: "reason for marking the source as false. Leave empty for true."
78
- }
79
160
 
161
+ "generate_cards":
162
+ { state: true or false,
163
+ false_reason: "reason for marking the source as false. Leave empty for true."
164
+ }
165
+ `,
166
+ summarize: `
80
167
  After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards. These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
81
168
 
82
-
83
- 1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
84
- 2. **Summarization Objective**: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
85
- 3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
86
- 4. **Engagement and Flow**: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
87
-
169
+ Inclusion Criteria: The generate_cards should be true. Return an empty array if the generate_cards is false.
170
+ Summarization Objective: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
171
+ Character Limit: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
172
+ Engagement and Flow: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
88
173
  Format your output in JSON as follows:
89
- json
174
+
90
175
  {
91
- "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
176
+ "summary_cards": ["summary_card1", "summary_card2", "summary_card3", "..."]
92
177
  }
93
- `;
178
+ `,
179
+ };
94
180
  function returnTypologyPrompt() {
95
- return typologyPromptString;
181
+ let concatenatedString = '';
182
+ for (let key in typologyPromptString) {
183
+ if (typologyPromptString.hasOwnProperty(key)) {
184
+ concatenatedString += typologyPromptString[key];
185
+ }
186
+ }
187
+ return concatenatedString;
96
188
  }
97
189
  exports.returnTypologyPrompt = returnTypologyPrompt;
@@ -10,6 +10,8 @@ function gapFilling(typologyResponse, cardgenResponse) {
10
10
  let allFacts = [];
11
11
  let generatedConceptsList = [];
12
12
  let generatedFactsList = [];
13
+ let remainingConcepts = [];
14
+ let remainingFacts = [];
13
15
  if (!isEmpty(typologyResponse)) {
14
16
  allConcepts.push(...((_a = typologyResponse.concepts) !== null && _a !== void 0 ? _a : []));
15
17
  allFacts.push(...((_b = typologyResponse === null || typologyResponse === void 0 ? void 0 : typologyResponse.facts) !== null && _b !== void 0 ? _b : []));
@@ -18,18 +20,20 @@ function gapFilling(typologyResponse, cardgenResponse) {
18
20
  allConcepts.push(...((_c = cardgenResponse.missing_concepts) !== null && _c !== void 0 ? _c : []));
19
21
  allFacts.push(...((_d = cardgenResponse.missing_facts) !== null && _d !== void 0 ? _d : []));
20
22
  }
21
- for (let card of cardgenResponse.cards_data) {
22
- if (card.concepts.length != 0) {
23
- generatedConceptsList.push(...card.concepts);
24
- }
25
- if (card.facts.length != 0) {
26
- generatedFactsList.push(...card.facts);
23
+ if (cardgenResponse.cards_data !== undefined && cardgenResponse.cards_data.length != 0) {
24
+ for (let card of cardgenResponse.cards_data) {
25
+ if (card.concepts.length != 0) {
26
+ generatedConceptsList.push(...card.concepts);
27
+ }
28
+ if (card.facts.length != 0) {
29
+ generatedFactsList.push(...card.facts);
30
+ }
27
31
  }
32
+ let generatedConceptsSet = Array.from(new Set(generatedConceptsList));
33
+ let generatedFactsSet = Array.from(new Set(generatedFactsList));
34
+ remainingConcepts = allConcepts.filter((item) => !generatedConceptsSet.includes(item));
35
+ remainingFacts = allFacts.filter((item) => !generatedFactsSet.includes(item));
28
36
  }
29
- let generatedConceptsSet = Array.from(new Set(generatedConceptsList));
30
- let generatedFactsSet = Array.from(new Set(generatedFactsList));
31
- let remainingConcepts = allConcepts.filter((item) => !generatedConceptsSet.includes(item));
32
- let remainingFacts = allFacts.filter((item) => !generatedFactsSet.includes(item));
33
37
  return {
34
38
  // allConcepts: allConcepts,
35
39
  // allFacts: allFacts,
package/dist/index.js CHANGED
@@ -1,59 +1,55 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
2
+ // import express from "express";
3
+ // import { returnCardGenPrompt } from "./constants/prompts/card_gen_prompt";
4
+ // import { returnTypologyPrompt } from "./constants/prompts/typology_prompt";
5
+ // import { GenerateArgs } from "./utils/generate_args";
6
+ // import { returnFields, returnHeadings, returnSourceData } from "./constants/source_data";
7
+ // import config from "./config";
8
+ // const app = express();
9
+ // const port = 3000;
14
10
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const express_1 = __importDefault(require("express"));
16
- const card_gen_prompt_1 = require("./constants/prompts/card_gen_prompt");
17
- const typology_prompt_1 = require("./constants/prompts/typology_prompt");
18
- const generate_args_1 = require("./utils/generate_args");
19
- const source_data_1 = require("./constants/source_data");
20
- const config_1 = __importDefault(require("./config"));
21
- const app = (0, express_1.default)();
22
- const port = 3000;
11
+ exports.OnlyEverGenerator = void 0;
23
12
  const app_1 = require("./bootstrap/app");
24
- /// While Publishing the package , and using this code as a separate npm module
25
- /// uncomment the below line and comment all the others, expect the import of OnlyEverGenerator
26
- // export {OnlyEverGenerator};
27
- /// All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
28
- /// below this line
29
- let oeGen = new app_1.OnlyEverGenerator(config_1.default.openAIKey, "gpt-3.5-turbo-1106", (0, source_data_1.returnSourceData)(), (0, source_data_1.returnFields)());
30
- app.get('/', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
31
- // let data = oeGen.returnParsedContent();
32
- // let parsedData = parseResponse()
33
- res.send(200);
34
- }));
35
- app.get('/openAI', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
36
- // let prompt = returnPromt();
37
- let prompt = (0, card_gen_prompt_1.returnCardGenPrompt)();
38
- let content = (0, source_data_1.returnSourceData)().toString();
39
- let headings = (0, source_data_1.returnHeadings)();
40
- // let aiRequest = await openAIRequest(prompt,content);
41
- let aiRequest = yield oeGen.generateCard(prompt, content, false);
42
- res.send(aiRequest);
43
- }));
44
- app.get('/typology', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
45
- {
46
- let typologyPrompt = (0, typology_prompt_1.returnTypologyPrompt)();
47
- let cardPrompt = (0, card_gen_prompt_1.returnCardGenPrompt)();
48
- let args = new generate_args_1.GenerateArgs(true, true, false, {
49
- typology_prompt: typologyPrompt,
50
- card_gen_prompt: cardPrompt,
51
- summary_prompt: "",
52
- });
53
- let typologyRequest = yield oeGen.generate(true, true);
54
- res.send(typologyRequest);
55
- }
56
- }));
57
- app.listen(port, () => {
58
- console.log(`Example app listening at http://localhost:${port}`);
59
- });
13
+ Object.defineProperty(exports, "OnlyEverGenerator", { enumerable: true, get: function () { return app_1.OnlyEverGenerator; } });
14
+ //. All the Codes Below uses express and are strictly for development purpose, while publishing the package, comment everything
15
+ // below this line
16
+ //let oeGen = new OnlyEverGenerator(config.openAIKey,"gpt-3.5-turbo-1106" ,'',returnSourceData(),returnFields())
17
+ // app.get('/', async (req, res) => {
18
+ // // let data = oeGen.returnParsedContent();
19
+ // // let parsedData = parseResponse()
20
+ // let cardPrompt = returnCardGenPrompt();
21
+ // res.send(cardPrompt);
22
+ // });
23
+ // app.get('/openAI', async (req,res)=> {
24
+ // // let prompt = returnPromt();
25
+ // let prompt = returnCardGenPrompt();
26
+ // let content = returnSourceData().toString()
27
+ // let headings = returnHeadings();
28
+ // // let aiRequest = await openAIRequest(prompt,content);
29
+ // let aiRequest = await oeGen.generateCard(prompt,content, false);
30
+ // res.send(aiRequest);
31
+ // });
32
+ // app.get('/typology', async(req,res)=>{
33
+ // {
34
+ // let typologyPrompt = returnTypologyPrompt();
35
+ // let cardPrompt = returnCardGenPrompt();
36
+ // let args = new GenerateArgs(
37
+ // true,
38
+ // true,
39
+ // false,
40
+ // {
41
+ // typology_prompt: typologyPrompt,
42
+ // card_gen_prompt: cardPrompt,
43
+ // summary_prompt: "",
44
+ // }
45
+ // )
46
+ // let typologyRequest = await oeGen.generate(
47
+ // true,
48
+ // true
49
+ // );
50
+ // res.send(typologyRequest);
51
+ // }
52
+ // });
53
+ // app.listen(port, () => {
54
+ // console.log(`Example app listening at http://localhost:${port}`);
55
+ // });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "only_ever_generator",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "start": "npm run build && nodemon dist/index.js",
@@ -16,10 +16,12 @@ export class OnlyEverGenerator {
16
16
  public api_key: string = "";
17
17
  public openAiService: OpenAiService;
18
18
  parsedContent: string = "";
19
+ prompt: any;
19
20
  expectedFields: Array<string>;
20
21
  constructor(
21
22
  apiKey: string,
22
23
  model: string,
24
+ prompt: any,
23
25
  content: Array<any>,
24
26
  expected_fields: Array<string>
25
27
  ) {
@@ -99,6 +101,7 @@ export class OnlyEverGenerator {
99
101
  }
100
102
 
101
103
  return responseToReturn;
104
+ // return [typologyPrompt, cardPrompt];
102
105
 
103
106
  }
104
107
 
@@ -18,7 +18,8 @@ export class GenerateCards {
18
18
  };
19
19
  if(response.status_code == 200){
20
20
  response.metadata.status = "completed";
21
- return this.parse(response);
21
+ // return response;
22
+ return this.parse(response);
22
23
  } else {
23
24
  response.metadata.status = "failed";
24
25
  return response;
@@ -75,6 +76,7 @@ if(unparsedTestCards !== undefined && unparsedTestCards.length != 0) {
75
76
  },
76
77
  concepts: data.concepts,
77
78
  facts: data.facts,
79
+ bloomLevel: data.bloom_level,
78
80
  };
79
81
 
80
82
  return flashCardData;
@@ -107,6 +109,8 @@ if(unparsedTestCards !== undefined && unparsedTestCards.length != 0) {
107
109
  },
108
110
  concepts: data.concepts,
109
111
  facts: data.facts,
112
+ bloomLevel: data.bloom_level,
113
+
110
114
  };
111
115
  return mcqCard;
112
116
  }
@@ -138,15 +142,27 @@ if(unparsedTestCards !== undefined && unparsedTestCards.length != 0) {
138
142
  },
139
143
  concepts: data.concepts,
140
144
  facts: data.facts,
145
+ bloomLevel: data.bloom_level,
146
+
141
147
  };
142
148
 
143
149
  return clozeCardData;
144
150
  }
145
151
 
146
- generateClozeCardDisplayTitle(question: string, answers: any) {
147
- let optionsString = answers
148
- .map((item: { option: any }) => item.option)
152
+ generateClozeCardDisplayTitle(question: string, answers: Array<any>) {
153
+ let optionsString = '';
154
+ if(answers.length !== 0) {
155
+ optionsString = answers
156
+ .map((item: { option: any }) => {
157
+ if(item.option !== undefined) {
158
+ return item.option;
159
+ } else {
160
+ return '';
161
+ }
162
+ })
149
163
  .join(", ");
164
+ }
165
+
150
166
  return `${question} ---- ${optionsString}`;
151
167
  }
152
168
 
@@ -171,6 +187,8 @@ if(unparsedTestCards !== undefined && unparsedTestCards.length != 0) {
171
187
  displayTitle: displayTitle,
172
188
  concepts: cardData.concepts,
173
189
  facts: cardData.facts,
190
+ bloomLevel: cardData.bloom_level,
191
+
174
192
  };
175
193
 
176
194
  return matchCard;