only_ever_generator 0.5.9 → 0.6.1

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.
@@ -100,9 +100,9 @@ class OnlyEverGenerator {
100
100
  return response;
101
101
  });
102
102
  }
103
- generateCard(prompt, additionalContent, isGapFill) {
104
- return __awaiter(this, void 0, void 0, function* () {
105
- let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService).generateCards(prompt !== null && prompt !== void 0 ? prompt : "", JSON.stringify(this.parsedContent) + additionalContent, isGapFill, this.parsedContent.taxonomy);
103
+ generateCard(prompt_1, additionalContent_1, isGapFill_1) {
104
+ return __awaiter(this, arguments, void 0, function* (prompt, additionalContent, isGapFill, n = 0) {
105
+ let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService).generateCards(prompt !== null && prompt !== void 0 ? prompt : "", JSON.stringify(this.parsedContent) + additionalContent, isGapFill, this.parsedContent.taxonomy, n);
106
106
  // let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
107
107
  // response['type'] = 'card_gen';
108
108
  return generateCardsResp;
@@ -114,8 +114,8 @@ class OnlyEverGenerator {
114
114
  return response;
115
115
  });
116
116
  }
117
- gapFill(factsMaps, aiCards) {
118
- return __awaiter(this, void 0, void 0, function* () {
117
+ gapFill(factsMaps_1, aiCards_1) {
118
+ return __awaiter(this, arguments, void 0, function* (factsMaps, aiCards, n = 0) {
119
119
  /// factsmap
120
120
  /// {
121
121
  /// remaining_facts: [],
@@ -126,7 +126,7 @@ class OnlyEverGenerator {
126
126
  response = yield this.generateCard(this.promptForCardGen +
127
127
  "Generate cards only suitable for the given remaining concepts and facts" +
128
128
  JSON.stringify(factsMaps) +
129
- "Exclude generating cards with content in the following", JSON.stringify(aiCards), true);
129
+ "Exclude generating cards with content in the following", JSON.stringify(aiCards), true, n);
130
130
  return response;
131
131
  });
132
132
  }
@@ -15,8 +15,8 @@ class GenerateCards {
15
15
  constructor(openAiService) {
16
16
  this.openAiService = openAiService;
17
17
  }
18
- generateCards(prompt, parsedContent, isGapFill, taxonomy) {
19
- return __awaiter(this, void 0, void 0, function* () {
18
+ generateCards(prompt_1, parsedContent_1, isGapFill_1, taxonomy_1) {
19
+ return __awaiter(this, arguments, void 0, function* (prompt, parsedContent, isGapFill, taxonomy, n = 0) {
20
20
  var _a, _b, _c, _d, _e;
21
21
  let response = yield ((_a = this.openAiService) === null || _a === void 0 ? void 0 : _a.sendRequest(prompt, parsedContent));
22
22
  // console.log("response to card generation ", response);
@@ -25,7 +25,7 @@ class GenerateCards {
25
25
  req_time: (_b = response.generated_at) !== null && _b !== void 0 ? _b : new Date(),
26
26
  req_type: {
27
27
  type: "depth",
28
- n: isGapFill ? 1 : 2,
28
+ n: n++,
29
29
  bloom_level: 1,
30
30
  },
31
31
  req_tokens: (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.prompt_tokens,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "only_ever_generator",
3
- "version": "0.5.9",
3
+ "version": "0.6.1",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "start": "npm run build && nodemon dist/index.js",
@@ -97,7 +97,7 @@ export class OnlyEverGenerator {
97
97
  }
98
98
  }
99
99
 
100
- async _generationForGapFill(typologyData: any, cardGenData: any) {
100
+ async _generationForGapFill(typologyData: any, cardGenData: any,) {
101
101
  let gapFill = gapFilling(typologyData, cardGenData);
102
102
  let response: any;
103
103
  if (
@@ -112,7 +112,7 @@ export class OnlyEverGenerator {
112
112
  JSON.stringify(gapFill),
113
113
 
114
114
  "",
115
- true
115
+ true,
116
116
  );
117
117
  }
118
118
  return response;
@@ -121,7 +121,8 @@ export class OnlyEverGenerator {
121
121
  async generateCard(
122
122
  prompt: string,
123
123
  additionalContent: string,
124
- isGapFill: boolean
124
+ isGapFill: boolean,
125
+ n: number = 0,
125
126
  ) {
126
127
  let generateCardsResp = await new GenerateCards(
127
128
  this.openAiService
@@ -129,7 +130,7 @@ export class OnlyEverGenerator {
129
130
  prompt ?? "",
130
131
  JSON.stringify(this.parsedContent) + additionalContent,
131
132
  isGapFill,
132
- this.parsedContent.taxonomy
133
+ this.parsedContent.taxonomy, n,
133
134
  );
134
135
 
135
136
  // let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
@@ -147,7 +148,7 @@ export class OnlyEverGenerator {
147
148
  return response;
148
149
  }
149
150
 
150
- async gapFill(factsMaps: any, aiCards: Array<any>) {
151
+ async gapFill(factsMaps: any, aiCards: Array<any>, n: number = 0) {
151
152
  /// factsmap
152
153
  /// {
153
154
  /// remaining_facts: [],
@@ -163,7 +164,8 @@ export class OnlyEverGenerator {
163
164
  JSON.stringify(factsMaps) +
164
165
  "Exclude generating cards with content in the following",
165
166
  JSON.stringify(aiCards),
166
- true
167
+ true,
168
+ n,
167
169
  );
168
170
 
169
171
  return response;
@@ -12,7 +12,8 @@ export class GenerateCards {
12
12
  prompt: string,
13
13
  parsedContent: string,
14
14
  isGapFill: boolean,
15
- taxonomy: any
15
+ taxonomy: any,
16
+ n: number = 0,
16
17
  ) {
17
18
  let response = await this.openAiService?.sendRequest(prompt, parsedContent);
18
19
  // console.log("response to card generation ", response);
@@ -21,7 +22,7 @@ export class GenerateCards {
21
22
  req_time: response.generated_at ?? new Date(),
22
23
  req_type: {
23
24
  type: "depth",
24
- n: isGapFill ? 1 : 2,
25
+ n: n++,
25
26
  bloom_level: 1,
26
27
  },
27
28
  req_tokens: response.usage_data?.prompt_tokens,