only_ever_generator 0.5.5 → 0.5.6

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.
Files changed (37) hide show
  1. package/dist/bootstrap/app.js +5 -5
  2. package/dist/card_gen/generate_cards.js +2 -1
  3. package/dist/config.js +1 -1
  4. package/dist/constants/api_constants.js +1 -1
  5. package/dist/constants/prompt_data.js +4 -4
  6. package/dist/constants/source_data.js +382 -382
  7. package/dist/logger.js +4 -4
  8. package/dist/parse/parse_card/parse_cloze_card.js +11 -9
  9. package/dist/parse/parse_card/parse_flash_cards.js +33 -0
  10. package/dist/parse/parse_card_response.js +8 -31
  11. package/dist/parse/parse_source_content.js +30 -20
  12. package/dist/parse/response_format_typology.js +16 -16
  13. package/dist/services/open_ai_service.js +13 -10
  14. package/dist/typology_gen/generate_typology.js +16 -15
  15. package/dist/utils/generate_args.js +3 -3
  16. package/dist/utils/parse_openai_response.js +7 -7
  17. package/package.json +1 -1
  18. package/src/bootstrap/app.ts +69 -79
  19. package/src/card_gen/generate_cards.ts +6 -1
  20. package/src/config.ts +3 -3
  21. package/src/constants/api_constants.ts +3 -3
  22. package/src/constants/prompt_data.ts +24 -26
  23. package/src/constants/prompts/card_gen_prompt.ts +2 -4
  24. package/src/constants/source_data.ts +440 -390
  25. package/src/index.ts +1 -2
  26. package/src/logger.ts +24 -25
  27. package/src/parse/parse_card/parse_cloze_card.ts +54 -42
  28. package/src/parse/parse_card/parse_flash_cards.ts +33 -0
  29. package/src/parse/parse_card/parse_match_card.ts +32 -32
  30. package/src/parse/parse_card_response.ts +28 -47
  31. package/src/parse/parse_source_content.ts +173 -168
  32. package/src/parse/response_format_card.ts +0 -2
  33. package/src/parse/response_format_typology.ts +42 -42
  34. package/src/services/open_ai_service.ts +50 -48
  35. package/src/typology_gen/generate_typology.ts +68 -60
  36. package/src/utils/generate_args.ts +25 -23
  37. package/src/utils/parse_openai_response.ts +17 -19
package/dist/logger.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /// this method will call out atlas function and will write to a doc, incase of any errors:
2
+ /// this method will call out atlas function and will write to a doc, incase of any errors:
3
3
  /// this is only for developmemt use
4
4
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
5
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -23,12 +23,12 @@ class ErrorLogger {
23
23
  log() {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
25
  try {
26
- let response = yield axios_1.default.post('https://us-east-1.aws.data.mongodb-api.com/app/oe-phase1-tkmsy/endpoint/oe_gen_logger', {
26
+ let response = yield axios_1.default.post("https://us-east-1.aws.data.mongodb-api.com/app/oe-phase1-tkmsy/endpoint/oe_gen_logger", {
27
27
  data: this.data,
28
28
  }, {
29
29
  headers: {
30
- "Content-Type": ['application/json']
31
- }
30
+ "Content-Type": ["application/json"],
31
+ },
32
32
  });
33
33
  return response;
34
34
  }
@@ -14,11 +14,14 @@ class ParseClozeCard {
14
14
  let parsedCorrectOptions = preparedData.options;
15
15
  let parsedIncorrectoptions = incorrectOptions.map((e) => {
16
16
  return {
17
- "option": e,
18
- "cloze": "null"
17
+ option: e,
18
+ cloze: "null",
19
19
  };
20
20
  });
21
- const finalParsedOptions = [...parsedCorrectOptions, ...parsedIncorrectoptions];
21
+ const finalParsedOptions = [
22
+ ...parsedCorrectOptions,
23
+ ...parsedIncorrectoptions,
24
+ ];
22
25
  let clozeCardData = {
23
26
  type: {
24
27
  category: "learning",
@@ -44,8 +47,7 @@ class ParseClozeCard {
44
47
  try {
45
48
  let optionsString = "";
46
49
  if (answers.length !== 0) {
47
- optionsString = answers
48
- .join(", ");
50
+ optionsString = answers.join(", ");
49
51
  }
50
52
  return `${question} ---- ${optionsString}`;
51
53
  }
@@ -71,16 +73,16 @@ class ParseClozeCard {
71
73
  if (idx !== -1) {
72
74
  let cloze = `c${idx}`;
73
75
  finalCorrectOptions.push({
74
- "option": p1,
75
- "cloze": cloze,
76
+ option: p1,
77
+ cloze: cloze,
76
78
  });
77
79
  return `{{c${idx}:${p1}}}`;
78
80
  }
79
81
  return match; // If not found in correct_options, leave as is or handle accordingly
80
82
  });
81
83
  return {
82
- "prompt": transformed,
83
- "options": finalCorrectOptions
84
+ prompt: transformed,
85
+ options: finalCorrectOptions,
84
86
  };
85
87
  }
86
88
  catch (e) {
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParseFlashCard = void 0;
4
+ class ParseFlashCard {
5
+ parse(data) {
6
+ try {
7
+ let displayTitle = this.generateFlashCardDisplayTitle(data.card_content.front, data.card_content.back);
8
+ let flashCardData = {
9
+ type: {
10
+ category: "learning",
11
+ sub_type: data.type,
12
+ },
13
+ heading: "",
14
+ displayTitle: displayTitle,
15
+ content: {
16
+ front_content: data.card_content.front,
17
+ back_content: data.card_content.back,
18
+ },
19
+ concepts: data.concepts,
20
+ explanation: data.card_content.explanation,
21
+ facts: data.facts,
22
+ };
23
+ return flashCardData;
24
+ }
25
+ catch (e) {
26
+ return null;
27
+ }
28
+ }
29
+ generateFlashCardDisplayTitle(front, back) {
30
+ return `${front} ---- ${back}`;
31
+ }
32
+ }
33
+ exports.ParseFlashCard = ParseFlashCard;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ParseCardResponse = void 0;
4
4
  const logger_1 = require("../logger");
5
5
  const parse_cloze_card_1 = require("./parse_card/parse_cloze_card");
6
+ const parse_flash_cards_1 = require("./parse_card/parse_flash_cards");
6
7
  const parse_match_card_1 = require("./parse_card/parse_match_card");
7
8
  const parse_mcq_card_1 = require("./parse_card/parse_mcq_card");
8
9
  class ParseCardResponse {
@@ -15,7 +16,7 @@ class ParseCardResponse {
15
16
  if (unparsedTestCards !== undefined && unparsedTestCards.length != 0) {
16
17
  for (let elem of unparsedTestCards) {
17
18
  if (elem.type == "flash") {
18
- const flashCard = this.parseFlashCard(elem);
19
+ const flashCard = new parse_flash_cards_1.ParseFlashCard().parse(elem);
19
20
  if (flashCard != null && flashCard) {
20
21
  flashCard.heading = this._getCardReference(flashCard, sourceTaxonomy);
21
22
  cardData.push(flashCard);
@@ -74,33 +75,6 @@ class ParseCardResponse {
74
75
  };
75
76
  }
76
77
  }
77
- parseFlashCard(data) {
78
- try {
79
- let displayTitle = this.generateFlashCardDisplayTitle(data.card_content.front, data.card_content.back);
80
- let flashCardData = {
81
- type: {
82
- category: "learning",
83
- sub_type: data.type,
84
- },
85
- heading: "",
86
- displayTitle: displayTitle,
87
- content: {
88
- front_content: data.card_content.front,
89
- back_content: data.card_content.back,
90
- },
91
- concepts: data.concepts,
92
- explanation: data.card_content.explanation,
93
- facts: data.facts,
94
- };
95
- return flashCardData;
96
- }
97
- catch (e) {
98
- return null;
99
- }
100
- }
101
- generateFlashCardDisplayTitle(front, back) {
102
- return `${front} ---- ${back}`;
103
- }
104
78
  _getCardReference(generatedCardData, sourceTaxonomy) {
105
79
  var _a, _b, _c, _d;
106
80
  const cardConcepts = (_a = generatedCardData.concepts) !== null && _a !== void 0 ? _a : [];
@@ -110,17 +84,20 @@ class ParseCardResponse {
110
84
  const sourceFacts = (_d = sourceTaxonomy.facts) !== null && _d !== void 0 ? _d : [];
111
85
  const mappedSourceConcepts = sourceConcepts.map((elem) => {
112
86
  return {
113
- "text": elem.concept_text,
87
+ text: elem.concept_text,
114
88
  reference: elem.reference,
115
89
  };
116
90
  });
117
91
  const mappedSourceFacts = sourceFacts.map((elem) => {
118
92
  return {
119
- "text": elem.fact_text,
93
+ text: elem.fact_text,
120
94
  reference: elem.reference,
121
95
  };
122
96
  });
123
- const compinedConceptsAndFacts = [...mappedSourceConcepts, ...mappedSourceFacts];
97
+ const compinedConceptsAndFacts = [
98
+ ...mappedSourceConcepts,
99
+ ...mappedSourceFacts,
100
+ ];
124
101
  const firstMatchedConcept = compinedConceptsAndFacts.find((elem) => combinedCardFactsAndConcepts.includes(elem.text));
125
102
  if (firstMatchedConcept) {
126
103
  return firstMatchedConcept.reference;
@@ -12,8 +12,17 @@ class ParseSourceContent {
12
12
  // taxonomy: source.source_taxonomy,
13
13
  // type: source.source_type
14
14
  // },
15
- this.titles_to_remove = ['See also', 'References', 'Further reading', 'External links', 'Notes and references', 'Bibliography', 'Notes', 'Cited sources'];
16
- this.block_types_toremove = ['table', 'empty_line'];
15
+ this.titles_to_remove = [
16
+ "See also",
17
+ "References",
18
+ "Further reading",
19
+ "External links",
20
+ "Notes and references",
21
+ "Bibliography",
22
+ "Notes",
23
+ "Cited sources",
24
+ ];
25
+ this.block_types_toremove = ["table", "empty_line"];
17
26
  this.content = sourceContent;
18
27
  }
19
28
  parseData() {
@@ -37,7 +46,8 @@ class ParseSourceContent {
37
46
  removeSectionsByTitle(data) {
38
47
  let dataAfterRemoving = [];
39
48
  for (let elem of data) {
40
- if (elem.block_type == 'heading' && this.titles_to_remove.includes(elem.content)) {
49
+ if (elem.block_type == "heading" &&
50
+ this.titles_to_remove.includes(elem.content)) {
41
51
  continue;
42
52
  }
43
53
  /// remove unwanted blcok types , for now `table` and `empty_line`
@@ -53,26 +63,26 @@ class ParseSourceContent {
53
63
  }
54
64
  sanitizeTextContent(content) {
55
65
  // Remove newline characters
56
- content = content.replace(/\\n/g, ' ');
66
+ content = content.replace(/\\n/g, " ");
57
67
  // Remove internal link references, keeping only the link text
58
68
  // Pattern explanation: [[link|text|index|wiki]] --> text
59
- content = content.replace(/\[\[.*?\|(.*?)\|.*?\|wiki\]\]/g, '$1');
69
+ content = content.replace(/\[\[.*?\|(.*?)\|.*?\|wiki\]\]/g, "$1");
60
70
  // Remove external links, keeping only the link text
61
71
  // Pattern explanation: [url text] --> text
62
- content = content.replace(/\[http[s]?:\/\/[^\s]+ ([^\]]+)\]/g, '$1');
72
+ content = content.replace(/\[http[s]?:\/\/[^\s]+ ([^\]]+)\]/g, "$1");
63
73
  // Remove Markdown link references, keeping only the link text
64
74
  // Pattern explanation: ![link text](url) --> link text
65
- content = content.replace(/\!\[([^\]]+)\]\([^\)]+\)/g, '$1');
75
+ content = content.replace(/\!\[([^\]]+)\]\([^\)]+\)/g, "$1");
66
76
  return content;
67
77
  }
68
78
  sanitizeBlocks(blocks) {
69
79
  let sanitizedBlocks = [];
70
- blocks = blocks.filter((item) => item.block_type != 'table');
71
- blocks.forEach(block => {
80
+ blocks = blocks.filter((item) => item.block_type != "table");
81
+ blocks.forEach((block) => {
72
82
  let sanitizedBlock = {};
73
83
  for (let key in block) {
74
84
  let value = block[key];
75
- if (typeof value === 'string') {
85
+ if (typeof value === "string") {
76
86
  sanitizedBlock[key] = this.sanitizeTextContent(value);
77
87
  }
78
88
  else if (Array.isArray(value)) {
@@ -92,10 +102,10 @@ class ParseSourceContent {
92
102
  data.forEach((e) => {
93
103
  let combinedContent = this.cleanTranscript(e);
94
104
  finalChapters.push({
95
- "startTime": e.startTime,
96
- "endTime": e.endTime,
97
- "content": combinedContent,
98
- "title": e.content
105
+ startTime: e.startTime,
106
+ endTime: e.endTime,
107
+ content: combinedContent,
108
+ title: e.content,
99
109
  });
100
110
  });
101
111
  return finalChapters;
@@ -108,13 +118,13 @@ class ParseSourceContent {
108
118
  // remove non-essential content
109
119
  cleanTranscript(data) {
110
120
  var _a;
111
- let finalContent = '';
121
+ let finalContent = "";
112
122
  let children = (_a = data.children) !== null && _a !== void 0 ? _a : [];
113
123
  children.forEach((e) => {
114
124
  let content = (e.content || "").trim();
115
125
  if (this.isNonSpeech(content))
116
126
  return;
117
- content = content.replace(/\s+/g, ' ');
127
+ content = content.replace(/\s+/g, " ");
118
128
  finalContent += content;
119
129
  });
120
130
  return finalContent;
@@ -127,7 +137,7 @@ class ParseSourceContent {
127
137
  let bucketEndTime = null;
128
138
  let bucketContent = [];
129
139
  let bucketDuration = 0.0;
130
- data.forEach(entry => {
140
+ data.forEach((entry) => {
131
141
  const startTime = entry.start_time;
132
142
  const endTime = entry.end_time;
133
143
  const content = entry.content;
@@ -139,7 +149,7 @@ class ParseSourceContent {
139
149
  bucketContent.push(content);
140
150
  bucketDuration = entryDuration;
141
151
  }
142
- else if ((bucketDuration + entryDuration) <= maxDuration) {
152
+ else if (bucketDuration + entryDuration <= maxDuration) {
143
153
  // Add to current bucket
144
154
  bucketEndTime = endTime;
145
155
  bucketContent.push(content);
@@ -150,7 +160,7 @@ class ParseSourceContent {
150
160
  const collapsedEntry = {
151
161
  start_time: bucketStartTime,
152
162
  end_time: bucketEndTime,
153
- content: bucketContent.join(' ')
163
+ content: bucketContent.join(" "),
154
164
  };
155
165
  collapsedData.push(collapsedEntry);
156
166
  // Start new bucket with current entry
@@ -165,7 +175,7 @@ class ParseSourceContent {
165
175
  const collapsedEntry = {
166
176
  start_time: bucketStartTime,
167
177
  end_time: bucketEndTime,
168
- content: bucketContent.join(' ')
178
+ content: bucketContent.join(" "),
169
179
  };
170
180
  collapsedData.push(collapsedEntry);
171
181
  }
@@ -2,18 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.returnTypologyData = returnTypologyData;
4
4
  const typologyResponse = {
5
- "usage_data": {
6
- "prompt_tokens": 11611,
7
- "completion_tokens": 441,
8
- "total_tokens": 12052
5
+ usage_data: {
6
+ prompt_tokens: 11611,
7
+ completion_tokens: 441,
8
+ total_tokens: 12052,
9
9
  },
10
- "generated_content": {
11
- "field": [
10
+ generated_content: {
11
+ field: [
12
12
  "Sciences",
13
13
  "Technology & Engineering",
14
- "Education, Learning & Personal Development"
14
+ "Education, Learning & Personal Development",
15
15
  ],
16
- "concepts": [
16
+ concepts: [
17
17
  "Electrolysis",
18
18
  "Faraday's Laws of Electrolysis",
19
19
  "Electrolytic Cell",
@@ -21,25 +21,25 @@ const typologyResponse = {
21
21
  "Oxidation and Reduction at the Electrodes",
22
22
  "Electrolysis of Water",
23
23
  "Electrolysis of Carbon Dioxide",
24
- "Electrocrystallization"
24
+ "Electrocrystallization",
25
25
  ],
26
- "facts": [
26
+ facts: [
27
27
  "Electrolysis is the passing of a direct electric current through an electrolyte producing chemical reactions at the electrodes and decomposition of the materials.",
28
28
  "In electrolysis, the quantity of the products is proportional to the current, and when two or more electrolytic cells are connected in series to the same power source, the products produced in the cells are proportional to their equivalent weight.",
29
29
  "The main components required to achieve electrolysis are an electrolyte, electrodes, and an external power source.",
30
30
  "Faraday's laws of electrolysis detail the amount of the products of electrolysis is related to the number of electrons in the reaction at the electrodes.",
31
31
  "Decomposition potential or decomposition voltage refers to the minimum voltage between anode and cathode of an electrolytic cell that is needed for electrolysis to occur.",
32
- "The electrochemical reduction of carbon dioxide can produce value-added chemicals such as methane, ethylene, and ethanol."
32
+ "The electrochemical reduction of carbon dioxide can produce value-added chemicals such as methane, ethylene, and ethanol.",
33
33
  ],
34
- "generate_cards": true,
35
- "summary_cards": [
34
+ generate_cards: true,
35
+ summary_cards: [
36
36
  "Electrolysis is the process of passing direct electric current through an electrolyte, resulting in chemical reactions and the decomposition of materials.",
37
37
  "Faraday's laws of electrolysis determine the relationship between the amounts of products generated and the electrons involved in the reaction at the electrodes.",
38
38
  "Decomposition potential is the minimum voltage required between anode and cathode for electrolysis to occur.",
39
- "The electrochemical reduction of carbon dioxide is a potential method for producing valuable chemicals such as methane, ethylene, and ethanol."
40
- ]
39
+ "The electrochemical reduction of carbon dioxide is a potential method for producing valuable chemicals such as methane, ethylene, and ethanol.",
40
+ ],
41
41
  },
42
- "generated_at": "Tue, 20 Jan 1970 21:17:46 GMT"
42
+ generated_at: "Tue, 20 Jan 1970 21:17:46 GMT",
43
43
  };
44
44
  function returnTypologyData() {
45
45
  return typologyResponse;
@@ -26,28 +26,31 @@ class OpenAiService {
26
26
  try {
27
27
  let message = [
28
28
  {
29
- "role": "system", "content": prompt
30
- }, {
31
- "role": "user", "content": content
32
- }
29
+ role: "system",
30
+ content: prompt,
31
+ },
32
+ {
33
+ role: "user",
34
+ content: content,
35
+ },
33
36
  ];
34
37
  const url = (0, api_constants_1.openAiEndPoint)();
35
38
  let response = yield axios_1.default.post(url, {
36
- "model": this.model,
37
- "messages": message,
38
- "response_format": { "type": "json_object" },
39
+ model: this.model,
40
+ messages: message,
41
+ response_format: { type: "json_object" },
39
42
  }, {
40
43
  headers: {
41
44
  Authorization: "Bearer " + this.api_key,
42
- "Content-Type": ['application/json']
45
+ "Content-Type": ["application/json"],
43
46
  },
44
47
  });
45
48
  if (response.status == 200) {
46
- console.log('success');
49
+ console.log("success");
47
50
  return (0, parse_openai_response_1.parseOpenAiSuccessResponse)(response.data);
48
51
  }
49
52
  else {
50
- console.log('failed');
53
+ console.log("failed");
51
54
  return response.statusText;
52
55
  }
53
56
  }
@@ -13,8 +13,8 @@ exports.GenerateTypology = void 0;
13
13
  const logger_1 = require("../logger");
14
14
  class GenerateTypology {
15
15
  constructor(openAiService, prompt, content, expected_fields) {
16
- this.prompt = '';
17
- this.content = '';
16
+ this.prompt = "";
17
+ this.content = "";
18
18
  this.openAiService = openAiService;
19
19
  this.prompt = prompt;
20
20
  this.content = content;
@@ -22,16 +22,17 @@ class GenerateTypology {
22
22
  }
23
23
  generate() {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- var _a, _b, _c, _d;
25
+ var _a, _b, _c, _d, _e;
26
26
  try {
27
27
  const response = yield ((_a = this.openAiService) === null || _a === void 0 ? void 0 : _a.sendRequest(this.prompt, this.content));
28
- response['type'] = 'typology';
28
+ response["type"] = "typology";
29
29
  response.metadata = {
30
- "req_time": (_b = response.generated_at) !== null && _b !== void 0 ? _b : new Date(),
31
- "req_type": response.type,
32
- "req_tokens": (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.prompt_tokens,
33
- "res_tokens": (_d = response.usage_data) === null || _d === void 0 ? void 0 : _d.completion_tokens,
34
- "model": this.openAiService.model
30
+ req_time: (_b = response.generated_at) !== null && _b !== void 0 ? _b : new Date(),
31
+ req_type: response.type,
32
+ req_tokens: (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.prompt_tokens,
33
+ res_tokens: (_d = response.usage_data) === null || _d === void 0 ? void 0 : _d.completion_tokens,
34
+ prompt_tokens_details: (_e = response.usage_data) === null || _e === void 0 ? void 0 : _e.prompt_tokens_details,
35
+ model: this.openAiService.model,
35
36
  };
36
37
  if (response.status_code == 200) {
37
38
  return this.parseTypologyOnSuccess(response);
@@ -43,8 +44,8 @@ class GenerateTypology {
43
44
  }
44
45
  catch (e) {
45
46
  yield new logger_1.ErrorLogger({
46
- "type": 'typology_parsing',
47
- "data": e.message
47
+ type: "typology_parsing",
48
+ data: e.message,
48
49
  }).log();
49
50
  }
50
51
  });
@@ -60,19 +61,19 @@ class GenerateTypology {
60
61
  facts: generatedContent.facts,
61
62
  generate_cards: generatedContent.generate_cards,
62
63
  summary_cards: generatedContent.summary_cards,
63
- type: responseData.type
64
+ type: responseData.type,
64
65
  };
65
66
  }
66
67
  parseFields(fields) {
67
- const fieldKeys = ['primary_field', 'secondary_field', 'tertiary_field'];
68
+ const fieldKeys = ["primary_field", "secondary_field", "tertiary_field"];
68
69
  return fields.slice(0, 3).map((item, index) => ({
69
70
  [fieldKeys[index]]: item,
70
- "reconcile": !(this.expectedFields.includes(item.toLowerCase()))
71
+ reconcile: !this.expectedFields.includes(item.toLowerCase()),
71
72
  }));
72
73
  }
73
74
  parseTypologyOnFailure(responseData) {
74
75
  return __awaiter(this, void 0, void 0, function* () {
75
- responseData.metadata.status = 'failed';
76
+ responseData.metadata.status = "failed";
76
77
  return {
77
78
  status_code: responseData.status_code,
78
79
  metadata: responseData.metadata,
@@ -13,13 +13,13 @@ class GenerateArgs {
13
13
  getWhatNeedsToBeGenerated() {
14
14
  let returnData = [];
15
15
  if (this.generate_typology == true) {
16
- returnData.push('generate_tyopology');
16
+ returnData.push("generate_tyopology");
17
17
  }
18
18
  if (this.generate_summary == true) {
19
- returnData.push('generate_summary');
19
+ returnData.push("generate_summary");
20
20
  }
21
21
  if (this.generate_card == true) {
22
- returnData.push('generate_card');
22
+ returnData.push("generate_card");
23
23
  }
24
24
  return returnData;
25
25
  }
@@ -7,17 +7,17 @@ function parseOpenAiSuccessResponse(responseData) {
7
7
  let usuage = responseData.usage;
8
8
  let createdTime = responseData.created;
9
9
  return {
10
- 'status_code': 200,
11
- 'usage_data': usuage,
12
- 'generated_content': choices,
13
- 'generated_at': new Date(createdTime * 1000)
10
+ status_code: 200,
11
+ usage_data: usuage,
12
+ generated_content: choices,
13
+ generated_at: new Date(createdTime * 1000),
14
14
  };
15
15
  }
16
16
  function parseOpenAiFailureResponse(errorResponse) {
17
17
  var _a, _b;
18
- // let statusCode =
18
+ // let statusCode =
19
19
  return {
20
- 'status_code': errorResponse.status,
21
- 'message': (_b = (_a = errorResponse.data) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.code
20
+ status_code: errorResponse.status,
21
+ message: (_b = (_a = errorResponse.data) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.code,
22
22
  };
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "only_ever_generator",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "start": "npm run build && nodemon dist/index.js",