only_ever_generator 0.6.7 → 0.6.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/dist/bootstrap/app.js
CHANGED
|
@@ -95,14 +95,14 @@ class OnlyEverGenerator {
|
|
|
95
95
|
this.typologyResponse.concepts = gapFill.remainingConcepts;
|
|
96
96
|
response = yield this.generateCard(this.promptForCardGen +
|
|
97
97
|
"Generate cards only suitable for the given remaining concepts and facts" +
|
|
98
|
-
JSON.stringify(gapFill), "", true
|
|
98
|
+
JSON.stringify(gapFill), "", true);
|
|
99
99
|
}
|
|
100
100
|
return response;
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
generateCard(
|
|
104
|
-
return __awaiter(this,
|
|
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, 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);
|
|
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(
|
|
118
|
-
return __awaiter(this,
|
|
117
|
+
gapFill(factsMaps, aiCards) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
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);
|
|
130
130
|
return response;
|
|
131
131
|
});
|
|
132
132
|
}
|
|
@@ -15,20 +15,20 @@ class GenerateCards {
|
|
|
15
15
|
constructor(openAiService) {
|
|
16
16
|
this.openAiService = openAiService;
|
|
17
17
|
}
|
|
18
|
-
generateCards(
|
|
19
|
-
return __awaiter(this,
|
|
18
|
+
generateCards(prompt, parsedContent, isGapFill, taxonomy) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
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
|
-
var updatedNumber = n + 1;
|
|
23
22
|
// console.log("response to card generation ", response);
|
|
24
|
-
|
|
23
|
+
response["request_type"] = {
|
|
24
|
+
type: "breadth",
|
|
25
|
+
sub_type: isGapFill ? "gap_fill" : "card_gen",
|
|
26
|
+
n: isGapFill ? 1 : 2,
|
|
27
|
+
bloom_level: 1,
|
|
28
|
+
};
|
|
25
29
|
response.metadata = {
|
|
26
30
|
req_time: (_b = response.generated_at) !== null && _b !== void 0 ? _b : new Date(),
|
|
27
|
-
req_type:
|
|
28
|
-
type: "depth",
|
|
29
|
-
n: updatedNumber,
|
|
30
|
-
bloom_level: 1,
|
|
31
|
-
},
|
|
31
|
+
req_type: response.request_type,
|
|
32
32
|
req_tokens: (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.prompt_tokens,
|
|
33
33
|
res_tokens: (_d = response.usage_data) === null || _d === void 0 ? void 0 : _d.completion_tokens,
|
|
34
34
|
prompt_tokens_details: (_e = response.usage_data) === null || _e === void 0 ? void 0 : _e.prompt_tokens_details,
|
|
@@ -31,10 +31,7 @@ class GenerateTypology {
|
|
|
31
31
|
};
|
|
32
32
|
response.metadata = {
|
|
33
33
|
req_time: (_b = response.generated_at) !== null && _b !== void 0 ? _b : new Date(),
|
|
34
|
-
req_type:
|
|
35
|
-
type: "breadth",
|
|
36
|
-
n: 1,
|
|
37
|
-
},
|
|
34
|
+
req_type: response.request_type,
|
|
38
35
|
req_tokens: (_c = response.usage_data) === null || _c === void 0 ? void 0 : _c.prompt_tokens,
|
|
39
36
|
res_tokens: (_d = response.usage_data) === null || _d === void 0 ? void 0 : _d.completion_tokens,
|
|
40
37
|
prompt_tokens_details: (_e = response.usage_data) === null || _e === void 0 ? void 0 : _e.prompt_tokens_details,
|
|
@@ -63,11 +60,11 @@ class GenerateTypology {
|
|
|
63
60
|
status_code: 200,
|
|
64
61
|
metadata: responseData.metadata,
|
|
65
62
|
field: this.parseFields(generatedContent.field),
|
|
66
|
-
concepts: generatedContent.concepts,
|
|
67
|
-
facts: generatedContent.facts,
|
|
63
|
+
concepts: generatedContent.concepts + generatedContent.facts,
|
|
64
|
+
// facts: generatedContent.facts,
|
|
68
65
|
generate_cards: generatedContent.generate_cards,
|
|
69
66
|
summary_cards: generatedContent.summary_cards,
|
|
70
|
-
|
|
67
|
+
type: responseData.type,
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
70
|
parseFields(fields) {
|
package/package.json
CHANGED
package/src/bootstrap/app.ts
CHANGED
|
@@ -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 (
|
|
@@ -108,12 +108,11 @@ export class OnlyEverGenerator {
|
|
|
108
108
|
this.typologyResponse.concepts = gapFill.remainingConcepts;
|
|
109
109
|
response = await this.generateCard(
|
|
110
110
|
this.promptForCardGen +
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
"Generate cards only suitable for the given remaining concepts and facts" +
|
|
112
|
+
JSON.stringify(gapFill),
|
|
113
113
|
|
|
114
114
|
"",
|
|
115
|
-
true
|
|
116
|
-
1,
|
|
115
|
+
true
|
|
117
116
|
);
|
|
118
117
|
}
|
|
119
118
|
return response;
|
|
@@ -122,8 +121,7 @@ export class OnlyEverGenerator {
|
|
|
122
121
|
async generateCard(
|
|
123
122
|
prompt: string,
|
|
124
123
|
additionalContent: string,
|
|
125
|
-
isGapFill: boolean
|
|
126
|
-
n: number = 0,
|
|
124
|
+
isGapFill: boolean
|
|
127
125
|
) {
|
|
128
126
|
let generateCardsResp = await new GenerateCards(
|
|
129
127
|
this.openAiService
|
|
@@ -131,7 +129,7 @@ export class OnlyEverGenerator {
|
|
|
131
129
|
prompt ?? "",
|
|
132
130
|
JSON.stringify(this.parsedContent) + additionalContent,
|
|
133
131
|
isGapFill,
|
|
134
|
-
this.parsedContent.taxonomy
|
|
132
|
+
this.parsedContent.taxonomy
|
|
135
133
|
);
|
|
136
134
|
|
|
137
135
|
// let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
|
|
@@ -149,7 +147,7 @@ export class OnlyEverGenerator {
|
|
|
149
147
|
return response;
|
|
150
148
|
}
|
|
151
149
|
|
|
152
|
-
async gapFill(factsMaps: any, aiCards: Array<any
|
|
150
|
+
async gapFill(factsMaps: any, aiCards: Array<any>) {
|
|
153
151
|
/// factsmap
|
|
154
152
|
/// {
|
|
155
153
|
/// remaining_facts: [],
|
|
@@ -161,12 +159,11 @@ export class OnlyEverGenerator {
|
|
|
161
159
|
|
|
162
160
|
response = await this.generateCard(
|
|
163
161
|
this.promptForCardGen +
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
"Generate cards only suitable for the given remaining concepts and facts" +
|
|
163
|
+
JSON.stringify(factsMaps) +
|
|
164
|
+
"Exclude generating cards with content in the following",
|
|
167
165
|
JSON.stringify(aiCards),
|
|
168
|
-
true
|
|
169
|
-
n,
|
|
166
|
+
true
|
|
170
167
|
);
|
|
171
168
|
|
|
172
169
|
return response;
|
|
@@ -12,20 +12,19 @@ export class GenerateCards {
|
|
|
12
12
|
prompt: string,
|
|
13
13
|
parsedContent: string,
|
|
14
14
|
isGapFill: boolean,
|
|
15
|
-
taxonomy: any
|
|
16
|
-
n: number = 0,
|
|
15
|
+
taxonomy: any
|
|
17
16
|
) {
|
|
18
17
|
let response = await this.openAiService?.sendRequest(prompt, parsedContent);
|
|
19
|
-
var updatedNumber = n + 1;
|
|
20
18
|
// console.log("response to card generation ", response);
|
|
21
|
-
|
|
19
|
+
response["request_type"] = {
|
|
20
|
+
type: "breadth",
|
|
21
|
+
sub_type: isGapFill ? "gap_fill" : "card_gen",
|
|
22
|
+
n: isGapFill ? 1 : 2,
|
|
23
|
+
bloom_level: 1,
|
|
24
|
+
};
|
|
22
25
|
response.metadata = {
|
|
23
26
|
req_time: response.generated_at ?? new Date(),
|
|
24
|
-
req_type:
|
|
25
|
-
type: "depth",
|
|
26
|
-
n: updatedNumber,
|
|
27
|
-
bloom_level: 1,
|
|
28
|
-
},
|
|
27
|
+
req_type: response.request_type,
|
|
29
28
|
req_tokens: response.usage_data?.prompt_tokens,
|
|
30
29
|
res_tokens: response.usage_data?.completion_tokens,
|
|
31
30
|
prompt_tokens_details: response.usage_data?.prompt_tokens_details,
|
|
@@ -32,10 +32,7 @@ export class GenerateTypology {
|
|
|
32
32
|
};
|
|
33
33
|
response.metadata = {
|
|
34
34
|
req_time: response.generated_at ?? new Date(),
|
|
35
|
-
req_type:
|
|
36
|
-
type: "breadth",
|
|
37
|
-
n: 1,
|
|
38
|
-
},
|
|
35
|
+
req_type: response.request_type,
|
|
39
36
|
req_tokens: response.usage_data?.prompt_tokens,
|
|
40
37
|
res_tokens: response.usage_data?.completion_tokens,
|
|
41
38
|
prompt_tokens_details: response.usage_data?.prompt_tokens_details,
|
|
@@ -62,11 +59,11 @@ export class GenerateTypology {
|
|
|
62
59
|
status_code: 200,
|
|
63
60
|
metadata: responseData.metadata,
|
|
64
61
|
field: this.parseFields(generatedContent.field),
|
|
65
|
-
concepts: generatedContent.concepts,
|
|
66
|
-
facts: generatedContent.facts,
|
|
62
|
+
concepts: generatedContent.concepts + generatedContent.facts,
|
|
63
|
+
// facts: generatedContent.facts,
|
|
67
64
|
generate_cards: generatedContent.generate_cards,
|
|
68
65
|
summary_cards: generatedContent.summary_cards,
|
|
69
|
-
|
|
66
|
+
type: responseData.type,
|
|
70
67
|
};
|
|
71
68
|
}
|
|
72
69
|
|