only_ever_generator 5.0.9 → 6.0.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.
- package/dist/bootstrap/app.d.ts +2 -1
- package/dist/bootstrap/app.d.ts.map +1 -1
- package/dist/bootstrap/app.js +6 -4
- package/dist/bootstrap/app.js.map +1 -1
- package/dist/card_gen/generate_cards.d.ts +2 -1
- package/dist/card_gen/generate_cards.d.ts.map +1 -1
- package/dist/card_gen/generate_cards.js +14 -9
- package/dist/card_gen/generate_cards.js.map +1 -1
- package/dist/logger.d.ts +0 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js.map +1 -1
- package/dist/typology_gen/generate_concept_facts.d.ts +2 -1
- package/dist/typology_gen/generate_concept_facts.d.ts.map +1 -1
- package/dist/typology_gen/generate_concept_facts.js +5 -4
- package/dist/typology_gen/generate_concept_facts.js.map +1 -1
- package/dist/typology_gen/generate_typology.d.ts +2 -1
- package/dist/typology_gen/generate_typology.d.ts.map +1 -1
- package/dist/typology_gen/generate_typology.js +8 -5
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/package.json +1 -1
- package/src/bootstrap/app.ts +10 -4
- package/src/card_gen/generate_cards.ts +16 -9
- package/src/logger.ts +0 -1
- package/src/typology_gen/generate_concept_facts.ts +7 -4
- package/src/typology_gen/generate_typology.ts +10 -5
package/dist/bootstrap/app.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class OnlyEverGenerator {
|
|
|
14
14
|
};
|
|
15
15
|
promptForTypology: string;
|
|
16
16
|
promptForCardGen: string;
|
|
17
|
+
generationCurriculum: boolean;
|
|
17
18
|
promptIdForTypology: string;
|
|
18
19
|
promptIdForConceptFacts: string;
|
|
19
20
|
promptIdForCardsGeneration: string;
|
|
@@ -30,7 +31,7 @@ export declare class OnlyEverGenerator {
|
|
|
30
31
|
bloom_instructions: string;
|
|
31
32
|
card_instructions: string;
|
|
32
33
|
card_examples: string;
|
|
33
|
-
});
|
|
34
|
+
}, generationCurriculum: boolean);
|
|
34
35
|
generate(generate_typology?: boolean, generate_card?: boolean): Promise<Array<any>>;
|
|
35
36
|
shouldTheCardBeGeneratedAfterTypologyResponse(): boolean;
|
|
36
37
|
generateCard(n?: number): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/bootstrap/app.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAO5D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D,qBAAa,iBAAiB;IACrB,OAAO,EAAE,MAAM,CAAM;IACrB,aAAa,EAAE,aAAa,CAAC;IAGpC,aAAa,CAAC,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC;QACf,QAAQ,EAAE,cAAc,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAa;IACd,iBAAiB,EAAE,MAAM,CAAM;IAC/B,gBAAgB,EAAE,MAAM,CAAM;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;IAChC,0BAA0B,EAAE,MAAM,CAAC;IAC1C,mBAAmB,EAAE;QACnB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,CAIC;IACF,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IACnC,gBAAgB,CAAC,EAAE,GAAG,CAAa;IACnC,eAAe,EAAE,GAAG,CAAa;IACjC,iBAAiB,KAAM;gBAGrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE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AM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,aAAa,EAChC,mBAAmB,EAAE,MAAM,EAC3B,uBAAuB,EAAE,MAAM,EAC/B,0BAA0B,EAAE,MAAM,EAClC,mBAAmB,EAAE;QACnB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,EACD,oBAAoB,EAAE,OAAO;IA+BzB,QAAQ,CACZ,iBAAiB,GAAE,OAAe,EAClC,aAAa,GAAE,OAAe,GAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAwFtB,6CAA6C;IAQvC,YAAY,CAAC,CAAC,GAAE,MAAU;IAkB1B,gBAAgB;IAyBhB,oBAAoB,CAAC,gBAAgB,EAAE,GAAG;;;;IAuB1C,kBAAkB,CAAC,gBAAgB,EAAE,GAAG;;;;;;;;;;;;;;;;;;IASxC,kBAAkB,CACtB,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,EAAE,EACH,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;IASZ,mBAAmB,CACvB,cAAc,EAAE;QACd,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,EAAE,EACH,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;CAUpB"}
|
package/dist/bootstrap/app.js
CHANGED
|
@@ -20,12 +20,13 @@ const local_consolidation_1 = require("../embedding_generation/consolidation/loc
|
|
|
20
20
|
const global_consolidation_1 = require("../embedding_generation/consolidation/global_consolidation");
|
|
21
21
|
const generate_concept_facts_1 = require("../typology_gen/generate_concept_facts");
|
|
22
22
|
class OnlyEverGenerator {
|
|
23
|
-
constructor(apiKey, model, generationContent, promptIdForTypology, promptIdForConceptFacts, promptIdForCardsGeneration, generationVariables) {
|
|
23
|
+
constructor(apiKey, model, generationContent, promptIdForTypology, promptIdForConceptFacts, promptIdForCardsGeneration, generationVariables, generationCurriculum) {
|
|
24
24
|
this.api_key = "";
|
|
25
25
|
/// these fields will be populated inside the constructor
|
|
26
26
|
this.parsedContent = undefined;
|
|
27
27
|
this.promptForTypology = "";
|
|
28
28
|
this.promptForCardGen = "";
|
|
29
|
+
this.generationCurriculum = false;
|
|
29
30
|
this.generationVariables = {
|
|
30
31
|
bloom_instructions: "",
|
|
31
32
|
card_instructions: "",
|
|
@@ -40,6 +41,7 @@ class OnlyEverGenerator {
|
|
|
40
41
|
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
41
42
|
this.api_key = apiKey;
|
|
42
43
|
this.generationVariables = generationVariables;
|
|
44
|
+
this.generationCurriculum = generationCurriculum;
|
|
43
45
|
this.openAiService = new open_ai_service_1.OpenAiService(apiKey, model !== null && model !== void 0 ? model : "gpt-3.5-turbo-1106");
|
|
44
46
|
const parsedData = new parse_source_content_1.ParseSourceContent(generationContent.content).parseData();
|
|
45
47
|
(this.parsedContent = {
|
|
@@ -151,7 +153,7 @@ class OnlyEverGenerator {
|
|
|
151
153
|
concepts_facts: (_b = this.typologyResponse) === null || _b === void 0 ? void 0 : _b.concepts_facts,
|
|
152
154
|
content: (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.content,
|
|
153
155
|
};
|
|
154
|
-
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService, (_e = (_d = this.parsedContent) === null || _d === void 0 ? void 0 : _d.source_id) !== null && _e !== void 0 ? _e : "", JSON.stringify(content), this.parsedContent.taxonomy, this.generationVariables, this.promptIdForCardsGeneration).generateCards(n);
|
|
156
|
+
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService, (_e = (_d = this.parsedContent) === null || _d === void 0 ? void 0 : _d.source_id) !== null && _e !== void 0 ? _e : "", JSON.stringify(content), this.parsedContent.taxonomy, this.generationVariables, this.promptIdForCardsGeneration, this.generationCurriculum).generateCards(n);
|
|
155
157
|
return generateCardsResp;
|
|
156
158
|
});
|
|
157
159
|
}
|
|
@@ -163,7 +165,7 @@ class OnlyEverGenerator {
|
|
|
163
165
|
? { h1_headings: (_f = (_e = this.parsedContent) === null || _e === void 0 ? void 0 : _e.headings) !== null && _f !== void 0 ? _f : [""] }
|
|
164
166
|
: { timecodes: (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.headings) !== null && _h !== void 0 ? _h : [""] })), { content: (_k = (_j = this.parsedContent) === null || _j === void 0 ? void 0 : _j.content) !== null && _k !== void 0 ? _k : [] });
|
|
165
167
|
try {
|
|
166
|
-
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, type, (_m = (_l = this.parsedContent) === null || _l === void 0 ? void 0 : _l.source_id) !== null && _m !== void 0 ? _m : "", content, this.expectedFields, this.promptIdForTypology).generate();
|
|
168
|
+
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, type, (_m = (_l = this.parsedContent) === null || _l === void 0 ? void 0 : _l.source_id) !== null && _m !== void 0 ? _m : "", content, this.expectedFields, this.promptIdForTypology, this.generationCurriculum).generate();
|
|
167
169
|
return response;
|
|
168
170
|
}
|
|
169
171
|
catch (error) {
|
|
@@ -180,7 +182,7 @@ class OnlyEverGenerator {
|
|
|
180
182
|
: { timecodes: (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.headings) !== null && _h !== void 0 ? _h : [""] })), { content: (_k = (_j = this.parsedContent) === null || _j === void 0 ? void 0 : _j.content) !== null && _k !== void 0 ? _k : [] }), (typologyResponse && typeof typologyResponse === "object"
|
|
181
183
|
? typologyResponse
|
|
182
184
|
: {}));
|
|
183
|
-
let response = yield new generate_concept_facts_1.GenerateConceptFacts(this.openAiService, (_m = (_l = this.parsedContent) === null || _l === void 0 ? void 0 : _l.source_id) !== null && _m !== void 0 ? _m : "", content, type, this.promptIdForConceptFacts).generate();
|
|
185
|
+
let response = yield new generate_concept_facts_1.GenerateConceptFacts(this.openAiService, (_m = (_l = this.parsedContent) === null || _l === void 0 ? void 0 : _l.source_id) !== null && _m !== void 0 ? _m : "", content, type, this.promptIdForConceptFacts, this.generationCurriculum).generate();
|
|
184
186
|
return response;
|
|
185
187
|
});
|
|
186
188
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/bootstrap/app.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA2D;AAC3D,wEAAmE;AACnE,iEAA4D;AAC5D,yEAAqE;AACrE,0DAAsD;AACtD,qFAAiF;AACjF,mGAA+F;AAC/F,qGAAiG;AAMjG,mFAA8E;AAE9E,MAAa,iBAAiB;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/bootstrap/app.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA2D;AAC3D,wEAAmE;AACnE,iEAA4D;AAC5D,yEAAqE;AACrE,0DAAsD;AACtD,qFAAiF;AACjF,mGAA+F;AAC/F,qGAAiG;AAMjG,mFAA8E;AAE9E,MAAa,iBAAiB;IAiC5B,YACE,MAAc,EACd,KAAa,EACb,iBAAgC,EAChC,mBAA2B,EAC3B,uBAA+B,EAC/B,0BAAkC,EAClC,mBAIC,EACD,oBAA6B;QA5CxB,YAAO,GAAW,EAAE,CAAC;QAG5B,yDAAyD;QACzD,kBAAa,GAOT,SAAS,CAAC;QACd,sBAAiB,GAAW,EAAE,CAAC;QAC/B,qBAAgB,GAAW,EAAE,CAAC;QACvB,yBAAoB,GAAY,KAAK,CAAC;QAI7C,wBAAmB,GAIf;YACF,kBAAkB,EAAE,EAAE;YACtB,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,EAAE;SAClB,C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C,aAAa,0CAAE,SAAS,mCAAI,EAAE,EACnC,OAAO,EACP,IAAI,EACJ,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CAAC,oBAAoB,CAC1B,CAAC,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IAEK,kBAAkB,CAAC,gBAAqB;;YAC5C,MAAM,cAAc,GAAG,gBAAgB,CAAC,cAAc,CAAC;YACvD,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAyB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACxE,MAAM,UAAU,GAAG,MAAM,IAAI,wCAAkB,CAC7C,IAAI,CAAC,aAAa,CACnB,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;YACrC,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;IAEK,kBAAkB,CACtB,cAKG,EACH,QAAgB;;YAEhB,MAAM,UAAU,GAAG,IAAI,wCAAkB,EAAE,CAAC,WAAW,CACrD,cAAc,EACd,QAAQ,CACT,CAAC;YACF,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;IAEK,mBAAmB,CACvB,cAMG,EACH,QAAgB,EAChB,SAAiB;;YAEjB,MAAM,UAAU,GAAG,MAAM,IAAI,0CAAmB,EAAE,CAAC,WAAW,CAC5D,cAAc,EACd,QAAQ,EACR,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CACjB,CAAC;YAEF,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;CACF;AA7RD,8CA6RC"}
|
|
@@ -13,11 +13,12 @@ export declare class GenerateCards {
|
|
|
13
13
|
};
|
|
14
14
|
openAIHelper: OpenAIHelper;
|
|
15
15
|
promptIdForCardsGeneration: string;
|
|
16
|
+
generationCurriculum: boolean;
|
|
16
17
|
constructor(openAiService: OpenAiService, sourceId: string, content: string, taxonomy: SourceTaxonomy, generationVariables: {
|
|
17
18
|
bloom_instructions: string;
|
|
18
19
|
card_instructions: string;
|
|
19
20
|
card_examples: string;
|
|
20
|
-
}, promptIdForCardsGeneration: string);
|
|
21
|
+
}, promptIdForCardsGeneration: string, generationCurriculum: boolean);
|
|
21
22
|
openAIResponse(): Promise<any>;
|
|
22
23
|
generateCards(n?: number): Promise<any>;
|
|
23
24
|
parseJson(response: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_cards.d.ts","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,qBAAa,aAAa;IACxB,aAAa,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,cAAc,CAAC;IACzB,mBAAmB,EAAE;QAC1B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,YAAY,EAAE,YAAY,CAAC;IACpB,0BAA0B,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"generate_cards.d.ts","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,qBAAa,aAAa;IACxB,aAAa,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,cAAc,CAAC;IACzB,mBAAmB,EAAE;QAC1B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,YAAY,EAAE,YAAY,CAAC;IACpB,0BAA0B,EAAE,MAAM,CAAC;IACnC,oBAAoB,EAAE,OAAO,CAAC;gBAEnC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,cAAc,EACxB,mBAAmB,EAAE;QACnB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,EACD,0BAA0B,EAAE,MAAM,EAClC,oBAAoB,EAAE,OAAO;IAYzB,cAAc;IAuFd,aAAa,CAAC,CAAC,GAAE,MAAU;IAyEjC,SAAS,CAAC,QAAQ,EAAE,GAAG;CAWxB"}
|
|
@@ -15,7 +15,7 @@ const build_card_schema_1 = require("../helper/schema_helper/build_card_schema")
|
|
|
15
15
|
const logger_1 = require("../logger");
|
|
16
16
|
const parse_card_response_1 = require("../parse/parse_card_response");
|
|
17
17
|
class GenerateCards {
|
|
18
|
-
constructor(openAiService, sourceId, content, taxonomy, generationVariables, promptIdForCardsGeneration) {
|
|
18
|
+
constructor(openAiService, sourceId, content, taxonomy, generationVariables, promptIdForCardsGeneration, generationCurriculum) {
|
|
19
19
|
this.openAiService = openAiService;
|
|
20
20
|
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key);
|
|
21
21
|
this.sourceId = sourceId;
|
|
@@ -23,6 +23,7 @@ class GenerateCards {
|
|
|
23
23
|
this.taxonomy = taxonomy;
|
|
24
24
|
this.generationVariables = generationVariables;
|
|
25
25
|
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
26
|
+
this.generationCurriculum = generationCurriculum;
|
|
26
27
|
}
|
|
27
28
|
openAIResponse() {
|
|
28
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -61,11 +62,12 @@ class GenerateCards {
|
|
|
61
62
|
});
|
|
62
63
|
if (!response) {
|
|
63
64
|
yield (0, logger_1.log_error)({
|
|
64
|
-
flow:
|
|
65
|
+
flow: this.generationCurriculum
|
|
66
|
+
? "curriculum_manual_generation"
|
|
67
|
+
: "manual_generation",
|
|
65
68
|
data: JSON.stringify(response),
|
|
66
69
|
timestamp: new Date(),
|
|
67
70
|
error: "empty_openai_response",
|
|
68
|
-
title: this.content,
|
|
69
71
|
source_id: this.sourceId,
|
|
70
72
|
type: {
|
|
71
73
|
request_type: "depth",
|
|
@@ -79,11 +81,12 @@ class GenerateCards {
|
|
|
79
81
|
catch (error) {
|
|
80
82
|
if (error instanceof logger_1.ParsingError) {
|
|
81
83
|
yield (0, logger_1.log_error)({
|
|
82
|
-
flow:
|
|
84
|
+
flow: this.generationCurriculum
|
|
85
|
+
? "curriculum_manual_generation"
|
|
86
|
+
: "manual_generation",
|
|
83
87
|
data: error,
|
|
84
88
|
timestamp: new Date(),
|
|
85
89
|
error: "parsing_error",
|
|
86
|
-
title: this.content,
|
|
87
90
|
source_id: this.sourceId,
|
|
88
91
|
type: {
|
|
89
92
|
request_type: "depth",
|
|
@@ -94,11 +97,12 @@ class GenerateCards {
|
|
|
94
97
|
else {
|
|
95
98
|
console.log(error);
|
|
96
99
|
yield (0, logger_1.log_error)({
|
|
97
|
-
flow:
|
|
100
|
+
flow: this.generationCurriculum
|
|
101
|
+
? "curriculum_manual_generation"
|
|
102
|
+
: "manual_generation",
|
|
98
103
|
data: error,
|
|
99
104
|
timestamp: new Date(),
|
|
100
105
|
error: "error_in_card_generation",
|
|
101
|
-
title: this.content,
|
|
102
106
|
source_id: this.sourceId,
|
|
103
107
|
type: {
|
|
104
108
|
request_type: "depth",
|
|
@@ -166,11 +170,12 @@ class GenerateCards {
|
|
|
166
170
|
}
|
|
167
171
|
catch (e) {
|
|
168
172
|
yield (0, logger_1.log_error)({
|
|
169
|
-
flow:
|
|
173
|
+
flow: this.generationCurriculum
|
|
174
|
+
? "curriculum_manual_generation"
|
|
175
|
+
: "manual_generation",
|
|
170
176
|
data: e,
|
|
171
177
|
timestamp: new Date(),
|
|
172
178
|
error: "error_in_card_generation",
|
|
173
|
-
title: this.content,
|
|
174
179
|
source_id: this.sourceId,
|
|
175
180
|
type: {
|
|
176
181
|
request_type: "depth",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_cards.js","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAuD;AACvD,iFAAuE;AACvE,sCAAiE;AACjE,sEAAiE;AAKjE,MAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"generate_cards.js","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAuD;AACvD,iFAAuE;AACvE,sCAAiE;AACjE,sEAAiE;AAKjE,MAAa,aAAa;IAaxB,YACE,aAA4B,EAC5B,QAAgB,EAChB,OAAe,EACf,QAAwB,EACxB,mBAIC,EACD,0BAAkC,EAClC,oBAA6B;QAE7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;QAC7D,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAEK,cAAc;;YAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,m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AI,qBAAY,CACpB,0CAA0C,EAC1C,QAAQ,CACT,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA/MD,sCA+MC"}
|
package/dist/logger.d.ts
CHANGED
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAMA,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAMA,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QACJ,YAAY,EAAE,MAAM,CAAC;QACrB,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;CACH,CAAC;AAEF,qBAAa,YAAa,SAAQ,KAAK;IAC9B,QAAQ,EAAE,GAAG,CAAC;gBACT,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG;CAM3C;AAED,qBAAa,WAAW;IACtB,IAAI,EAAE,GAAG,CAAC;gBACE,IAAI,EAAE,GAAG;IAIf,GAAG;CAkBV;AACD,wBAAsB,SAAS,CAAC,KAAK,EAAE,QAAQ,mFAS9C"}
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA,2FAA2F;AAC3F,oCAAoC;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mapp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,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -4,6 +4,7 @@ export declare class GenerateConceptFacts {
|
|
|
4
4
|
openAiService: OpenAiService;
|
|
5
5
|
openAIHelper: OpenAIHelper;
|
|
6
6
|
sourceId: string;
|
|
7
|
+
generationCurriculum: boolean;
|
|
7
8
|
content: {
|
|
8
9
|
title: string;
|
|
9
10
|
h1_headings?: string[];
|
|
@@ -17,7 +18,7 @@ export declare class GenerateConceptFacts {
|
|
|
17
18
|
h1_headings?: string[];
|
|
18
19
|
timecodes?: string[];
|
|
19
20
|
content: any[];
|
|
20
|
-
}, type: string, promptIdForConceptFacts: string);
|
|
21
|
+
}, type: string, promptIdForConceptFacts: string, generationCurriculum: boolean);
|
|
21
22
|
generate(): Promise<{
|
|
22
23
|
concepts_facts: any;
|
|
23
24
|
metadata: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_concept_facts.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,qBAAa,oBAAoB;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,CAAC;IACK,IAAI,EAAE,MAAM,CAAM;IAClB,uBAAuB,EAAE,MAAM,CAAC;gBAErC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,EACD,IAAI,EAAE,MAAM,EACZ,uBAAuB,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"generate_concept_facts.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,qBAAa,oBAAoB;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,CAAC;IACK,IAAI,EAAE,MAAM,CAAM;IAClB,uBAAuB,EAAE,MAAM,CAAC;gBAErC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,EACD,IAAI,EAAE,MAAM,EACZ,uBAAuB,EAAE,MAAM,EAC/B,oBAAoB,EAAE,OAAO;IAWzB,QAAQ;;;;IA+Fd,SAAS,CAAC,QAAQ,EAAE,GAAG;CAWxB"}
|
|
@@ -14,7 +14,7 @@ const build_concept_facts_schema_1 = require("../helper/schema_helper/build_conc
|
|
|
14
14
|
const openai_helper_1 = require("../helper/openai_helper");
|
|
15
15
|
const logger_1 = require("../logger");
|
|
16
16
|
class GenerateConceptFacts {
|
|
17
|
-
constructor(openAiService, sourceId, content, type, promptIdForConceptFacts) {
|
|
17
|
+
constructor(openAiService, sourceId, content, type, promptIdForConceptFacts, generationCurriculum) {
|
|
18
18
|
this.type = "";
|
|
19
19
|
this.openAiService = openAiService;
|
|
20
20
|
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key);
|
|
@@ -22,6 +22,7 @@ class GenerateConceptFacts {
|
|
|
22
22
|
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
23
23
|
this.type = type;
|
|
24
24
|
this.sourceId = sourceId;
|
|
25
|
+
this.generationCurriculum = generationCurriculum;
|
|
25
26
|
}
|
|
26
27
|
generate() {
|
|
27
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -66,7 +67,6 @@ class GenerateConceptFacts {
|
|
|
66
67
|
flow: "manual_generation",
|
|
67
68
|
data: openAiResponse,
|
|
68
69
|
error: "empty_openai_response",
|
|
69
|
-
title: this.content.title,
|
|
70
70
|
timestamp: new Date(),
|
|
71
71
|
source_id: this.sourceId,
|
|
72
72
|
type: {
|
|
@@ -99,11 +99,12 @@ class GenerateConceptFacts {
|
|
|
99
99
|
catch (error) {
|
|
100
100
|
console.log(error);
|
|
101
101
|
yield (0, logger_1.log_error)({
|
|
102
|
-
flow:
|
|
102
|
+
flow: this.generationCurriculum
|
|
103
|
+
? "curriculum_manual_generation"
|
|
104
|
+
: "manual_generation",
|
|
103
105
|
data: error,
|
|
104
106
|
timestamp: new Date(),
|
|
105
107
|
error: "error_in_concept_facts_generation",
|
|
106
|
-
title: this.content.title,
|
|
107
108
|
source_id: this.sourceId,
|
|
108
109
|
type: {
|
|
109
110
|
request_type: "concept_fact",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_concept_facts.js","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":";;;;;;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6IC"}
|
|
@@ -3,6 +3,7 @@ export declare class GenerateTypology {
|
|
|
3
3
|
openAiService: OpenAiService;
|
|
4
4
|
type: string;
|
|
5
5
|
sourceId: string;
|
|
6
|
+
generationCurriculum: boolean;
|
|
6
7
|
content: {
|
|
7
8
|
title: string;
|
|
8
9
|
h1_headings?: string[];
|
|
@@ -16,7 +17,7 @@ export declare class GenerateTypology {
|
|
|
16
17
|
h1_headings?: string[];
|
|
17
18
|
timecodes?: string[];
|
|
18
19
|
content: any[];
|
|
19
|
-
}, expected_fields: Array<string>, promptIdForTypology: string);
|
|
20
|
+
}, expected_fields: Array<string>, promptIdForTypology: string, generationCurriculum: boolean);
|
|
20
21
|
generate(): Promise<any>;
|
|
21
22
|
parseTypologyOnSuccess(responseData: any): {
|
|
22
23
|
status_code: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI5D,qBAAa,gBAAgB;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAM;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,CAAC;IACK,mBAAmB,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAE5B,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,E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|
|
@@ -14,7 +14,7 @@ const openai_helper_1 = require("../helper/openai_helper");
|
|
|
14
14
|
const logger_1 = require("../logger");
|
|
15
15
|
const build_classify_summarize_schema_1 = require("../helper/schema_helper/build_classify_summarize_schema");
|
|
16
16
|
class GenerateTypology {
|
|
17
|
-
constructor(openAiService, type, sourceId, content, expected_fields, promptIdForTypology) {
|
|
17
|
+
constructor(openAiService, type, sourceId, content, expected_fields, promptIdForTypology, generationCurriculum) {
|
|
18
18
|
this.type = "";
|
|
19
19
|
this.openAiService = openAiService;
|
|
20
20
|
this.type = type;
|
|
@@ -22,6 +22,7 @@ class GenerateTypology {
|
|
|
22
22
|
this.content = content;
|
|
23
23
|
this.expectedFields = expected_fields.map((elem) => elem.toLowerCase());
|
|
24
24
|
this.promptIdForTypology = promptIdForTypology;
|
|
25
|
+
this.generationCurriculum = generationCurriculum;
|
|
25
26
|
}
|
|
26
27
|
generate() {
|
|
27
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -62,10 +63,11 @@ class GenerateTypology {
|
|
|
62
63
|
console.log(openAiResponse);
|
|
63
64
|
if (!openAiResponse) {
|
|
64
65
|
yield (0, logger_1.log_error)({
|
|
65
|
-
flow:
|
|
66
|
+
flow: this.generationCurriculum
|
|
67
|
+
? "curriculum_manual_generation"
|
|
68
|
+
: "manual_generation",
|
|
66
69
|
data: openAiResponse,
|
|
67
70
|
error: "empty_openai_response",
|
|
68
|
-
title: this.content.title,
|
|
69
71
|
timestamp: new Date(),
|
|
70
72
|
source_id: this.sourceId,
|
|
71
73
|
type: {
|
|
@@ -104,11 +106,12 @@ class GenerateTypology {
|
|
|
104
106
|
catch (e) {
|
|
105
107
|
console.log(e);
|
|
106
108
|
yield (0, logger_1.log_error)({
|
|
107
|
-
flow:
|
|
109
|
+
flow: this.generationCurriculum
|
|
110
|
+
? "curriculum_manual_generation"
|
|
111
|
+
: "manual_generation",
|
|
108
112
|
data: e,
|
|
109
113
|
timestamp: new Date(),
|
|
110
114
|
error: "error_in_typology_generation",
|
|
111
|
-
title: this.content.title,
|
|
112
115
|
source_id: this.sourceId,
|
|
113
116
|
type: {
|
|
114
117
|
request_type: "breadth",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAkE;AAClE,sCAAiE;AAGjE,6GAAuG;AAEvG,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAkE;AAClE,sCAAiE;AAGjE,6GAAuG;AAEvG,MAAa,gBAAgB;IAa3B,YACE,aAA4B,EAC5B,IAAY,EACZ,QAAgB,EAChB,OAKC,EACD,eAA8B,EAC9B,mBAA2B,EAC3B,oBAA6B;QAvBxB,SAAI,GAAW,EAAE,CAAC;QAyBvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CACzD,IAAI,CAAC,WAAW,EAAE,CACnB,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IACK,QAAQ;;;YACZ,IAAI,CAAC;gBACH,MAAM,QAAQ,GACZ,IAAI,CAAC,IAAI,IAAI,OAAO;oBAClB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,EAAE,CAAC;oBAChC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,CAAC;g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C;YAC9C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI;YACxB,SAAS,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;SAC7D,CAAC,CAAC,CAAC;IACN,CAAC;IAEK,sBAAsB,CAAC,YAAiB;;YAC5C,YAAY,CAAC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC;YAExC,OAAO;gBACL,WAAW,EAAE,YAAY,CAAC,WAAW;gBACrC,QAAQ,EAAE,YAAY,CAAC,QAAQ;aAChC,CAAC;QACJ,CAAC;KAAA;CACF;AAlLD,4CAkLC"}
|
package/package.json
CHANGED
package/src/bootstrap/app.ts
CHANGED
|
@@ -28,6 +28,7 @@ export class OnlyEverGenerator {
|
|
|
28
28
|
} = undefined;
|
|
29
29
|
promptForTypology: string = "";
|
|
30
30
|
promptForCardGen: string = "";
|
|
31
|
+
public generationCurriculum: boolean = false;
|
|
31
32
|
public promptIdForTypology: string;
|
|
32
33
|
public promptIdForConceptFacts: string;
|
|
33
34
|
public promptIdForCardsGeneration: string;
|
|
@@ -56,13 +57,15 @@ export class OnlyEverGenerator {
|
|
|
56
57
|
bloom_instructions: string;
|
|
57
58
|
card_instructions: string;
|
|
58
59
|
card_examples: string;
|
|
59
|
-
}
|
|
60
|
+
},
|
|
61
|
+
generationCurriculum: boolean
|
|
60
62
|
) {
|
|
61
63
|
this.promptIdForTypology = promptIdForTypology;
|
|
62
64
|
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
63
65
|
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
64
66
|
this.api_key = apiKey;
|
|
65
67
|
this.generationVariables = generationVariables;
|
|
68
|
+
this.generationCurriculum = generationCurriculum;
|
|
66
69
|
this.openAiService = new OpenAiService(
|
|
67
70
|
apiKey,
|
|
68
71
|
model ?? "gpt-3.5-turbo-1106"
|
|
@@ -197,7 +200,8 @@ export class OnlyEverGenerator {
|
|
|
197
200
|
JSON.stringify(content),
|
|
198
201
|
this.parsedContent!.taxonomy,
|
|
199
202
|
this.generationVariables,
|
|
200
|
-
this.promptIdForCardsGeneration
|
|
203
|
+
this.promptIdForCardsGeneration,
|
|
204
|
+
this.generationCurriculum
|
|
201
205
|
).generateCards(n);
|
|
202
206
|
return generateCardsResp;
|
|
203
207
|
}
|
|
@@ -218,7 +222,8 @@ export class OnlyEverGenerator {
|
|
|
218
222
|
this.parsedContent?.source_id ?? "",
|
|
219
223
|
content,
|
|
220
224
|
this.expectedFields,
|
|
221
|
-
this.promptIdForTypology
|
|
225
|
+
this.promptIdForTypology,
|
|
226
|
+
this.generationCurriculum
|
|
222
227
|
).generate();
|
|
223
228
|
return response;
|
|
224
229
|
} catch (error) {
|
|
@@ -243,7 +248,8 @@ export class OnlyEverGenerator {
|
|
|
243
248
|
this.parsedContent?.source_id ?? "",
|
|
244
249
|
content,
|
|
245
250
|
type,
|
|
246
|
-
this.promptIdForConceptFacts
|
|
251
|
+
this.promptIdForConceptFacts,
|
|
252
|
+
this.generationCurriculum
|
|
247
253
|
).generate();
|
|
248
254
|
return response;
|
|
249
255
|
}
|
|
@@ -18,6 +18,7 @@ export class GenerateCards {
|
|
|
18
18
|
};
|
|
19
19
|
openAIHelper: OpenAIHelper;
|
|
20
20
|
public promptIdForCardsGeneration: string;
|
|
21
|
+
public generationCurriculum: boolean;
|
|
21
22
|
constructor(
|
|
22
23
|
openAiService: OpenAiService,
|
|
23
24
|
sourceId: string,
|
|
@@ -28,7 +29,8 @@ export class GenerateCards {
|
|
|
28
29
|
card_instructions: string;
|
|
29
30
|
card_examples: string;
|
|
30
31
|
},
|
|
31
|
-
promptIdForCardsGeneration: string
|
|
32
|
+
promptIdForCardsGeneration: string,
|
|
33
|
+
generationCurriculum: boolean
|
|
32
34
|
) {
|
|
33
35
|
this.openAiService = openAiService;
|
|
34
36
|
this.openAIHelper = new OpenAIHelper(this.openAiService.api_key);
|
|
@@ -37,6 +39,7 @@ export class GenerateCards {
|
|
|
37
39
|
this.taxonomy = taxonomy;
|
|
38
40
|
this.generationVariables = generationVariables;
|
|
39
41
|
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
42
|
+
this.generationCurriculum = generationCurriculum;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
async openAIResponse() {
|
|
@@ -76,11 +79,12 @@ export class GenerateCards {
|
|
|
76
79
|
});
|
|
77
80
|
if (!response) {
|
|
78
81
|
await log_error({
|
|
79
|
-
flow:
|
|
82
|
+
flow: this.generationCurriculum
|
|
83
|
+
? "curriculum_manual_generation"
|
|
84
|
+
: "manual_generation",
|
|
80
85
|
data: JSON.stringify(response),
|
|
81
86
|
timestamp: new Date(),
|
|
82
87
|
error: "empty_openai_response",
|
|
83
|
-
title: this.content,
|
|
84
88
|
source_id: this.sourceId,
|
|
85
89
|
type: {
|
|
86
90
|
request_type: "depth",
|
|
@@ -94,11 +98,12 @@ export class GenerateCards {
|
|
|
94
98
|
} catch (error) {
|
|
95
99
|
if (error instanceof ParsingError) {
|
|
96
100
|
await log_error({
|
|
97
|
-
flow:
|
|
101
|
+
flow: this.generationCurriculum
|
|
102
|
+
? "curriculum_manual_generation"
|
|
103
|
+
: "manual_generation",
|
|
98
104
|
data: error,
|
|
99
105
|
timestamp: new Date(),
|
|
100
106
|
error: "parsing_error",
|
|
101
|
-
title: this.content,
|
|
102
107
|
source_id: this.sourceId,
|
|
103
108
|
type: {
|
|
104
109
|
request_type: "depth",
|
|
@@ -108,11 +113,12 @@ export class GenerateCards {
|
|
|
108
113
|
} else {
|
|
109
114
|
console.log(error);
|
|
110
115
|
await log_error({
|
|
111
|
-
flow:
|
|
116
|
+
flow: this.generationCurriculum
|
|
117
|
+
? "curriculum_manual_generation"
|
|
118
|
+
: "manual_generation",
|
|
112
119
|
data: error,
|
|
113
120
|
timestamp: new Date(),
|
|
114
121
|
error: "error_in_card_generation",
|
|
115
|
-
title: this.content,
|
|
116
122
|
source_id: this.sourceId,
|
|
117
123
|
type: {
|
|
118
124
|
request_type: "depth",
|
|
@@ -181,11 +187,12 @@ export class GenerateCards {
|
|
|
181
187
|
}
|
|
182
188
|
} catch (e: any) {
|
|
183
189
|
await log_error({
|
|
184
|
-
flow:
|
|
190
|
+
flow: this.generationCurriculum
|
|
191
|
+
? "curriculum_manual_generation"
|
|
192
|
+
: "manual_generation",
|
|
185
193
|
data: e,
|
|
186
194
|
timestamp: new Date(),
|
|
187
195
|
error: "error_in_card_generation",
|
|
188
|
-
title: this.content,
|
|
189
196
|
source_id: this.sourceId,
|
|
190
197
|
type: {
|
|
191
198
|
request_type: "depth",
|
package/src/logger.ts
CHANGED
|
@@ -7,6 +7,7 @@ export class GenerateConceptFacts {
|
|
|
7
7
|
public openAiService: OpenAiService;
|
|
8
8
|
public openAIHelper: OpenAIHelper;
|
|
9
9
|
public sourceId: string;
|
|
10
|
+
public generationCurriculum: boolean;
|
|
10
11
|
public content: {
|
|
11
12
|
title: string;
|
|
12
13
|
h1_headings?: string[];
|
|
@@ -25,7 +26,8 @@ export class GenerateConceptFacts {
|
|
|
25
26
|
content: any[];
|
|
26
27
|
},
|
|
27
28
|
type: string,
|
|
28
|
-
promptIdForConceptFacts: string
|
|
29
|
+
promptIdForConceptFacts: string,
|
|
30
|
+
generationCurriculum: boolean
|
|
29
31
|
) {
|
|
30
32
|
this.openAiService = openAiService;
|
|
31
33
|
this.openAIHelper = new OpenAIHelper(this.openAiService.api_key);
|
|
@@ -33,6 +35,7 @@ export class GenerateConceptFacts {
|
|
|
33
35
|
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
34
36
|
this.type = type;
|
|
35
37
|
this.sourceId = sourceId;
|
|
38
|
+
this.generationCurriculum = generationCurriculum;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
async generate() {
|
|
@@ -82,7 +85,6 @@ export class GenerateConceptFacts {
|
|
|
82
85
|
flow: "manual_generation",
|
|
83
86
|
data: openAiResponse,
|
|
84
87
|
error: "empty_openai_response",
|
|
85
|
-
title: this.content.title,
|
|
86
88
|
timestamp: new Date(),
|
|
87
89
|
source_id: this.sourceId,
|
|
88
90
|
type: {
|
|
@@ -115,11 +117,12 @@ export class GenerateConceptFacts {
|
|
|
115
117
|
} catch (error) {
|
|
116
118
|
console.log(error);
|
|
117
119
|
await log_error({
|
|
118
|
-
flow:
|
|
120
|
+
flow: this.generationCurriculum
|
|
121
|
+
? "curriculum_manual_generation"
|
|
122
|
+
: "manual_generation",
|
|
119
123
|
data: error,
|
|
120
124
|
timestamp: new Date(),
|
|
121
125
|
error: "error_in_concept_facts_generation",
|
|
122
|
-
title: this.content.title,
|
|
123
126
|
source_id: this.sourceId,
|
|
124
127
|
type: {
|
|
125
128
|
request_type: "concept_fact",
|
|
@@ -9,6 +9,7 @@ export class GenerateTypology {
|
|
|
9
9
|
public openAiService: OpenAiService;
|
|
10
10
|
public type: string = "";
|
|
11
11
|
public sourceId: string;
|
|
12
|
+
public generationCurriculum: boolean;
|
|
12
13
|
public content: {
|
|
13
14
|
title: string;
|
|
14
15
|
h1_headings?: string[];
|
|
@@ -28,7 +29,8 @@ export class GenerateTypology {
|
|
|
28
29
|
content: any[];
|
|
29
30
|
},
|
|
30
31
|
expected_fields: Array<string>,
|
|
31
|
-
promptIdForTypology: string
|
|
32
|
+
promptIdForTypology: string,
|
|
33
|
+
generationCurriculum: boolean
|
|
32
34
|
) {
|
|
33
35
|
this.openAiService = openAiService;
|
|
34
36
|
this.type = type;
|
|
@@ -38,6 +40,7 @@ export class GenerateTypology {
|
|
|
38
40
|
elem.toLowerCase()
|
|
39
41
|
);
|
|
40
42
|
this.promptIdForTypology = promptIdForTypology;
|
|
43
|
+
this.generationCurriculum = generationCurriculum;
|
|
41
44
|
}
|
|
42
45
|
async generate() {
|
|
43
46
|
try {
|
|
@@ -80,10 +83,11 @@ export class GenerateTypology {
|
|
|
80
83
|
console.log(openAiResponse);
|
|
81
84
|
if (!openAiResponse) {
|
|
82
85
|
await log_error({
|
|
83
|
-
flow:
|
|
86
|
+
flow: this.generationCurriculum
|
|
87
|
+
? "curriculum_manual_generation"
|
|
88
|
+
: "manual_generation",
|
|
84
89
|
data: openAiResponse,
|
|
85
90
|
error: "empty_openai_response",
|
|
86
|
-
title: this.content.title,
|
|
87
91
|
timestamp: new Date(),
|
|
88
92
|
source_id: this.sourceId,
|
|
89
93
|
type: {
|
|
@@ -121,11 +125,12 @@ export class GenerateTypology {
|
|
|
121
125
|
} catch (e: any) {
|
|
122
126
|
console.log(e);
|
|
123
127
|
await log_error({
|
|
124
|
-
flow:
|
|
128
|
+
flow: this.generationCurriculum
|
|
129
|
+
? "curriculum_manual_generation"
|
|
130
|
+
: "manual_generation",
|
|
125
131
|
data: e,
|
|
126
132
|
timestamp: new Date(),
|
|
127
133
|
error: "error_in_typology_generation",
|
|
128
|
-
title: this.content.title,
|
|
129
134
|
source_id: this.sourceId,
|
|
130
135
|
type: {
|
|
131
136
|
request_type: "breadth",
|