only_ever_generator 3.0.1 → 3.0.2
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 +4 -15
- package/dist/bootstrap/app.d.ts.map +1 -1
- package/dist/bootstrap/app.js +9 -14
- package/dist/bootstrap/app.js.map +1 -1
- package/dist/card_gen/generate_cards.d.ts +2 -5
- package/dist/card_gen/generate_cards.d.ts.map +1 -1
- package/dist/card_gen/generate_cards.js +4 -7
- package/dist/card_gen/generate_cards.js.map +1 -1
- package/dist/helper/openai_helper.d.ts +1 -4
- package/dist/helper/openai_helper.d.ts.map +1 -1
- package/dist/helper/openai_helper.js +1 -4
- package/dist/helper/openai_helper.js.map +1 -1
- package/dist/typology_gen/generate_concept_facts.d.ts +2 -8
- package/dist/typology_gen/generate_concept_facts.d.ts.map +1 -1
- package/dist/typology_gen/generate_concept_facts.js +4 -10
- package/dist/typology_gen/generate_concept_facts.js.map +1 -1
- package/dist/typology_gen/generate_typology.d.ts +2 -8
- package/dist/typology_gen/generate_typology.d.ts.map +1 -1
- package/dist/typology_gen/generate_typology.js +4 -10
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/package.json +1 -1
- package/src/bootstrap/app.ts +11 -27
- package/src/card_gen/generate_cards.ts +6 -15
- package/src/helper/openai_helper.ts +1 -12
- package/src/typology_gen/generate_concept_facts.ts +5 -21
- package/src/typology_gen/generate_typology.ts +5 -21
package/dist/bootstrap/app.d.ts
CHANGED
|
@@ -14,14 +14,9 @@ export declare class OnlyEverGenerator {
|
|
|
14
14
|
};
|
|
15
15
|
promptForTypology: string;
|
|
16
16
|
promptForCardGen: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
promptForConceptFacts: {
|
|
22
|
-
promptId: string;
|
|
23
|
-
version: string;
|
|
24
|
-
};
|
|
17
|
+
promptIdForTypology: string;
|
|
18
|
+
promptIdForConceptFacts: string;
|
|
19
|
+
promptIdForCardsGeneration: string;
|
|
25
20
|
generationVariables: {
|
|
26
21
|
bloom_instructions: string;
|
|
27
22
|
card_instructions: string;
|
|
@@ -31,13 +26,7 @@ export declare class OnlyEverGenerator {
|
|
|
31
26
|
typologyResponse?: any;
|
|
32
27
|
cardgenResponse: any;
|
|
33
28
|
summarizeResponse: {};
|
|
34
|
-
constructor(apiKey: string, model: string, generationContent: BaseParamType,
|
|
35
|
-
promptId: string;
|
|
36
|
-
version: string;
|
|
37
|
-
}, promptForConceptFacts: {
|
|
38
|
-
promptId: string;
|
|
39
|
-
version: string;
|
|
40
|
-
}, generationVariables: {
|
|
29
|
+
constructor(apiKey: string, model: string, generationContent: BaseParamType, promptIdForTypology: string, promptIdForConceptFacts: string, generationVariables: {
|
|
41
30
|
bloom_instructions: string;
|
|
42
31
|
card_instructions: string;
|
|
43
32
|
card_examples: string;
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src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E,OAAe,GAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAuEtB,6CAA6C;IAQvC,YAAY,CAAC,CAAC,GAAE,MAAU;IAgB1B,gBAAgB;IAoBhB,oBAAoB;IAepB,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,20 +20,15 @@ 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,
|
|
23
|
+
constructor(apiKey, model, generationContent, promptIdForTypology, promptIdForConceptFacts, generationVariables) {
|
|
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.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
this.promptForConceptFacts = {
|
|
34
|
-
promptId: "",
|
|
35
|
-
version: "",
|
|
36
|
-
};
|
|
29
|
+
this.promptIdForTypology = "";
|
|
30
|
+
this.promptIdForConceptFacts = "";
|
|
31
|
+
this.promptIdForCardsGeneration = "";
|
|
37
32
|
this.generationVariables = {
|
|
38
33
|
bloom_instructions: "",
|
|
39
34
|
card_instructions: "",
|
|
@@ -43,8 +38,8 @@ class OnlyEverGenerator {
|
|
|
43
38
|
this.typologyResponse = undefined;
|
|
44
39
|
this.cardgenResponse = undefined;
|
|
45
40
|
this.summarizeResponse = {};
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
41
|
+
this.promptIdForTypology = promptIdForTypology;
|
|
42
|
+
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
48
43
|
this.api_key = apiKey;
|
|
49
44
|
this.generationVariables = generationVariables;
|
|
50
45
|
this.openAiService = new open_ai_service_1.OpenAiService(apiKey, model !== null && model !== void 0 ? model : "gpt-3.5-turbo-1106");
|
|
@@ -144,7 +139,7 @@ class OnlyEverGenerator {
|
|
|
144
139
|
concepts_facts: (_b = this.typologyResponse) === null || _b === void 0 ? void 0 : _b.concepts_facts,
|
|
145
140
|
content: (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.content,
|
|
146
141
|
};
|
|
147
|
-
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService, JSON.stringify(content), this.parsedContent.taxonomy, this.generationVariables).generateCards(n);
|
|
142
|
+
let generateCardsResp = yield new generate_cards_1.GenerateCards(this.openAiService, JSON.stringify(content), this.parsedContent.taxonomy, this.generationVariables, this.promptIdForCardsGeneration).generateCards(n);
|
|
148
143
|
return generateCardsResp;
|
|
149
144
|
});
|
|
150
145
|
}
|
|
@@ -157,7 +152,7 @@ class OnlyEverGenerator {
|
|
|
157
152
|
content: (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.content,
|
|
158
153
|
};
|
|
159
154
|
try {
|
|
160
|
-
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, (_e = (_d = this.parsedContent) === null || _d === void 0 ? void 0 : _d.type) !== null && _e !== void 0 ? _e : "text", JSON.stringify(content), this.expectedFields, this.
|
|
155
|
+
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, (_e = (_d = this.parsedContent) === null || _d === void 0 ? void 0 : _d.type) !== null && _e !== void 0 ? _e : "text", JSON.stringify(content), this.expectedFields, this.promptIdForTypology).generate();
|
|
161
156
|
return response;
|
|
162
157
|
}
|
|
163
158
|
catch (error) {
|
|
@@ -173,7 +168,7 @@ class OnlyEverGenerator {
|
|
|
173
168
|
headings: (_d = (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.headings) !== null && _d !== void 0 ? _d : [],
|
|
174
169
|
content: (_f = (_e = this.parsedContent) === null || _e === void 0 ? void 0 : _e.content) !== null && _f !== void 0 ? _f : [],
|
|
175
170
|
};
|
|
176
|
-
let response = yield new generate_concept_facts_1.GenerateConceptFacts(this.openAiService, content, (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.type) !== null && _h !== void 0 ? _h : "text", this.
|
|
171
|
+
let response = yield new generate_concept_facts_1.GenerateConceptFacts(this.openAiService, content, (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.type) !== null && _h !== void 0 ? _h : "text", this.promptIdForConceptFacts).generate();
|
|
177
172
|
return response;
|
|
178
173
|
});
|
|
179
174
|
}
|
|
@@ -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,+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aAC3C,CAAC;YACF,IAAI,QAAQ,GAAG,MAAM,IAAI,6CAAoB,CAC3C,IAAI,CAAC,aAAa,EAClB,OAAO,EACP,MAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,mCAAI,MAAM,EAClC,IAAI,CAAC,uBAAuB,CAC7B,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;AAxPD,8CAwPC"}
|
|
@@ -11,15 +11,12 @@ export declare class GenerateCards {
|
|
|
11
11
|
card_examples: string;
|
|
12
12
|
};
|
|
13
13
|
openAIHelper: OpenAIHelper;
|
|
14
|
-
|
|
15
|
-
promptId: string;
|
|
16
|
-
version: string;
|
|
17
|
-
};
|
|
14
|
+
promptIdForCardsGeneration: string;
|
|
18
15
|
constructor(openAiService: OpenAiService, content: string, taxonomy: SourceTaxonomy, generationVariables: {
|
|
19
16
|
bloom_instructions: string;
|
|
20
17
|
card_instructions: string;
|
|
21
18
|
card_examples: string;
|
|
22
|
-
});
|
|
19
|
+
}, promptIdForCardsGeneration: string);
|
|
23
20
|
openAIResponse(): Promise<any>;
|
|
24
21
|
generateCards(n?: number): Promise<any>;
|
|
25
22
|
}
|
|
@@ -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,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;
|
|
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,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;gBAExC,aAAa,EAAE,aAAa,EAC5B,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;IAU9B,cAAc;IAsCd,aAAa,CAAC,CAAC,GAAE,MAAU;CA6DlC"}
|
|
@@ -15,16 +15,13 @@ 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, content, taxonomy, generationVariables) {
|
|
19
|
-
this.promptForCardsGeneration = {
|
|
20
|
-
promptId: "",
|
|
21
|
-
version: "",
|
|
22
|
-
};
|
|
18
|
+
constructor(openAiService, content, taxonomy, generationVariables, promptIdForCardsGeneration) {
|
|
23
19
|
this.openAiService = openAiService;
|
|
24
|
-
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key
|
|
20
|
+
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key);
|
|
25
21
|
this.content = content;
|
|
26
22
|
this.taxonomy = taxonomy;
|
|
27
23
|
this.generationVariables = generationVariables;
|
|
24
|
+
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
28
25
|
}
|
|
29
26
|
openAIResponse() {
|
|
30
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -32,7 +29,7 @@ class GenerateCards {
|
|
|
32
29
|
try {
|
|
33
30
|
let response = yield this.openAIHelper.openAI.responses.create({
|
|
34
31
|
prompt: {
|
|
35
|
-
id:
|
|
32
|
+
id: this.promptIdForCardsGeneration,
|
|
36
33
|
variables: {
|
|
37
34
|
bloom_level: "1",
|
|
38
35
|
card_types: "mcq,cloze,match,flash",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_cards.js","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAuD;AACvD,iFAAuE;AACvE,sCAAwC;AACxC,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,sCAAwC;AACxC,sEAAiE;AAKjE,MAAa,aAAa;IAWxB,YACE,aAA4B,EAC5B,OAAe,EACf,QAAwB,EACxB,mBAIC,EACD,0BAAkC;QAElC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACjE,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;IAC/D,CAAC;IAEK,cAAc;;YAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACtC,IAAI,CAAC;gBACH,IAAI,QAAQ,GAAQ,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;oBAClE,MAAM,EAAE;wBACN,EAAE,EAAE,IAAI,CAAC,0BAA0B;wBACnC,SAAS,EAAE;4BACT,WAAW,EAAE,GAAG;4BAChB,UAAU,EAAE,uBAAuB;4BACnC,kBAAkB,EAAE,IAAI,C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CAAC,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC;oBACjD,OAAO,QAAQ,CAAC;gBAClB,CAAC;YACH,CAAC;YAAC,OAAO,CAAM,EAAE,CAAC;gBAChB,IAAI,oBAAW,CAAC;oBACd,IAAI,EAAE,iBAAiB;oBACvB,IAAI,EAAE,CAAC,CAAC,OAAO;iBAChB,CAAC,CAAC,GAAG,EAAE,CAAC;YACX,CAAC;QACH,CAAC;KAAA;CACF;AAjID,sCAiIC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
2
|
export declare class OpenAIHelper {
|
|
3
3
|
openAI: OpenAI;
|
|
4
|
-
model: string;
|
|
5
|
-
promptId: string;
|
|
6
4
|
openAIKey: string;
|
|
7
|
-
|
|
8
|
-
constructor(openAIKey: string, model: string, promptId: string, version: string);
|
|
5
|
+
constructor(openAIKey: string);
|
|
9
6
|
}
|
|
10
7
|
declare const getOpenAI: (openAIKey: string) => OpenAI;
|
|
11
8
|
export { getOpenAI, OpenAI };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai_helper.d.ts","sourceRoot":"","sources":["../../src/helper/openai_helper.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,qBAAa,YAAY;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"openai_helper.d.ts","sourceRoot":"","sources":["../../src/helper/openai_helper.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,qBAAa,YAAY;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;gBACb,SAAS,EAAE,MAAM;CAI9B;AAED,QAAA,MAAM,SAAS,GAAI,WAAW,MAAM,WAMnC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -7,12 +7,9 @@ exports.OpenAI = exports.getOpenAI = exports.OpenAIHelper = void 0;
|
|
|
7
7
|
const openai_1 = __importDefault(require("openai"));
|
|
8
8
|
exports.OpenAI = openai_1.default;
|
|
9
9
|
class OpenAIHelper {
|
|
10
|
-
constructor(openAIKey
|
|
10
|
+
constructor(openAIKey) {
|
|
11
11
|
this.openAI = getOpenAI(openAIKey);
|
|
12
|
-
this.model = model;
|
|
13
|
-
this.promptId = promptId;
|
|
14
12
|
this.openAIKey = openAIKey;
|
|
15
|
-
this.version = version;
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
15
|
exports.OpenAIHelper = OpenAIHelper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai_helper.js","sourceRoot":"","sources":["../../src/helper/openai_helper.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;
|
|
1
|
+
{"version":3,"file":"openai_helper.js","sourceRoot":"","sources":["../../src/helper/openai_helper.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAmBR,iBAnBb,gBAAM,CAmBa;AAjB1B,MAAa,YAAY;IAGvB,YAAY,SAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAPD,oCAOC;AAED,MAAM,SAAS,GAAG,CAAC,SAAiB,EAAE,EAAE;IACtC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC;QACxB,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEO,8BAAS"}
|
|
@@ -9,18 +9,12 @@ export declare class GenerateConceptFacts {
|
|
|
9
9
|
content: any[];
|
|
10
10
|
};
|
|
11
11
|
type: string;
|
|
12
|
-
|
|
13
|
-
promptId: string;
|
|
14
|
-
version: string;
|
|
15
|
-
};
|
|
12
|
+
promptIdForConceptFacts: string;
|
|
16
13
|
constructor(openAiService: OpenAiService, content: {
|
|
17
14
|
title: string;
|
|
18
15
|
headings: string[];
|
|
19
16
|
content: any[];
|
|
20
|
-
}, type: string,
|
|
21
|
-
promptId: string;
|
|
22
|
-
version: string;
|
|
23
|
-
});
|
|
17
|
+
}, type: string, promptIdForConceptFacts: string);
|
|
24
18
|
generate(): Promise<any>;
|
|
25
19
|
}
|
|
26
20
|
//# sourceMappingURL=generate_concept_facts.d.ts.map
|
|
@@ -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;AAE5D,qBAAa,oBAAoB;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,CAAC;IACK,IAAI,EAAE,MAAM,CAAM;IAClB,
|
|
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;AAE5D,qBAAa,oBAAoB;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,CAAC;IACK,IAAI,EAAE,MAAM,CAAM;IAClB,uBAAuB,EAAE,MAAM,CAAC;gBAErC,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC;KAChB,EACD,IAAI,EAAE,MAAM,EACZ,uBAAuB,EAAE,MAAM;IAS3B,QAAQ;CA+Bf"}
|
|
@@ -13,16 +13,12 @@ exports.GenerateConceptFacts = void 0;
|
|
|
13
13
|
const build_concept_facts_schema_1 = require("../helper/schema_helper/build_concept_facts_schema");
|
|
14
14
|
const openai_helper_1 = require("../helper/openai_helper");
|
|
15
15
|
class GenerateConceptFacts {
|
|
16
|
-
constructor(openAiService, content, type,
|
|
16
|
+
constructor(openAiService, content, type, promptIdForConceptFacts) {
|
|
17
17
|
this.type = "";
|
|
18
|
-
this.promptForConceptFacts = {
|
|
19
|
-
promptId: "",
|
|
20
|
-
version: "",
|
|
21
|
-
};
|
|
22
18
|
this.openAiService = openAiService;
|
|
23
|
-
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key
|
|
19
|
+
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key);
|
|
24
20
|
this.content = content;
|
|
25
|
-
this.
|
|
21
|
+
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
26
22
|
this.type = type;
|
|
27
23
|
}
|
|
28
24
|
generate() {
|
|
@@ -30,10 +26,8 @@ class GenerateConceptFacts {
|
|
|
30
26
|
try {
|
|
31
27
|
const schema = (0, build_concept_facts_schema_1.buildConceptFactSchema)(this.content.headings, "concept_fact_gen_schema", true);
|
|
32
28
|
const openAiResponse = yield this.openAIHelper.openAI.responses.create({
|
|
33
|
-
model: this.openAIHelper.model,
|
|
34
29
|
prompt: {
|
|
35
|
-
id: this.
|
|
36
|
-
version: this.promptForConceptFacts.version,
|
|
30
|
+
id: this.promptIdForConceptFacts,
|
|
37
31
|
variables: {
|
|
38
32
|
heading_type: this.type == "video" ? "timecode" : "h1 heading",
|
|
39
33
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_concept_facts.js","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mGAA4F;AAC5F,2DAAuD;AAGvD,MAAa,oBAAoB;
|
|
1
|
+
{"version":3,"file":"generate_concept_facts.js","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mGAA4F;AAC5F,2DAAuD;AAGvD,MAAa,oBAAoB;IAU/B,YACE,aAA4B,EAC5B,OAIC,EACD,IAAY,EACZ,uBAA+B;QAV1B,SAAI,GAAW,EAAE,CAAC;QAYvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEK,QAAQ;;YACZ,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAA,mDAAsB,EACnC,IAAI,CAAC,OAAO,CAAC,QAAQ,EACrB,yBAAyB,EACzB,IAAI,CACL,CAAC;gBACF,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;oBACrE,MAAM,EAAE;wBACN,EAAE,EAAE,IAAI,CAAC,uBAAuB;wBAChC,SAAS,EAAE;4BACT,YAAY,EAAE,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;yBAC/D;qBACF;oBACD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;oBACnC,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE;wBACJ,MAAM,EAAE;4BACN,IAAI,EAAE,aAAa;4BACnB,IAAI,EAAE,MAAM,CAAC,IAAI;4BACjB,MAAM,EAAE,MAAM,CAAC,MAAM;4BACrB,MAAM,EAAE,MAAM,CAAC,MAAM;yBACtB;qBACF;iBACF,CAAC,CAAC;gBAEH,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YAChD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;KAAA;CACF;AA1DD,oDA0DC"}
|
|
@@ -3,15 +3,9 @@ export declare class GenerateTypology {
|
|
|
3
3
|
openAiService: OpenAiService;
|
|
4
4
|
type: string;
|
|
5
5
|
content: string;
|
|
6
|
-
|
|
7
|
-
promptId: string;
|
|
8
|
-
version: string;
|
|
9
|
-
};
|
|
6
|
+
promptIdForTypology: string;
|
|
10
7
|
expectedFields: Array<string>;
|
|
11
|
-
constructor(openAiService: OpenAiService, type: string, content: string, expected_fields: Array<string>,
|
|
12
|
-
promptId: string;
|
|
13
|
-
version: string;
|
|
14
|
-
});
|
|
8
|
+
constructor(openAiService: OpenAiService, type: string, content: string, expected_fields: Array<string>, promptIdForTypology: string);
|
|
15
9
|
generate(): Promise<any>;
|
|
16
10
|
parseTypologyOnSuccess(responseData: any): {
|
|
17
11
|
status_code: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBAAa,gBAAgB;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAM;IAClB,OAAO,EAAE,MAAM,CAAM;IACrB,
|
|
1
|
+
{"version":3,"file":"generate_typology.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBAAa,gBAAgB;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAM;IAClB,OAAO,EAAE,MAAM,CAAM;IACrB,mBAAmB,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAE5B,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,EAC9B,mBAAmB,EAAE,MAAM;IAUvB,QAAQ;IAkDd,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;;;;;;;IAexC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;;;;IAQ3B,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;CAQ/C"}
|
|
@@ -13,30 +13,24 @@ exports.GenerateTypology = void 0;
|
|
|
13
13
|
const openai_helper_1 = require("../helper/openai_helper");
|
|
14
14
|
const logger_1 = require("../logger");
|
|
15
15
|
class GenerateTypology {
|
|
16
|
-
constructor(openAiService, type, content, expected_fields,
|
|
16
|
+
constructor(openAiService, type, content, expected_fields, promptIdForTypology) {
|
|
17
17
|
this.type = "";
|
|
18
18
|
this.content = "";
|
|
19
|
-
this.promptForTypology = {
|
|
20
|
-
promptId: "",
|
|
21
|
-
version: "",
|
|
22
|
-
};
|
|
23
19
|
this.openAiService = openAiService;
|
|
24
20
|
this.type = type;
|
|
25
21
|
this.content = content;
|
|
26
22
|
this.expectedFields = expected_fields.map((elem) => elem.toLowerCase());
|
|
27
|
-
this.
|
|
23
|
+
this.promptIdForTypology = promptIdForTypology;
|
|
28
24
|
}
|
|
29
25
|
generate() {
|
|
30
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
27
|
var _a, _b, _c, _d, _e;
|
|
32
28
|
try {
|
|
33
29
|
// Use OpenAI Responses API
|
|
34
|
-
const openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key
|
|
30
|
+
const openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key);
|
|
35
31
|
const openAiResponse = yield openAIHelper.openAI.responses.create({
|
|
36
|
-
// model: openAIHelper.model,
|
|
37
32
|
prompt: {
|
|
38
|
-
id:
|
|
39
|
-
version: openAIHelper.version,
|
|
33
|
+
id: this.promptIdForTypology,
|
|
40
34
|
variables: {
|
|
41
35
|
heading_type: this.type == "video" ? "timecode" : "h1 heading",
|
|
42
36
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAkE;AAClE,sCAAwC;AAGxC,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAkE;AAClE,sCAAwC;AAGxC,MAAa,gBAAgB;IAM3B,YACE,aAA4B,EAC5B,IAAY,EACZ,OAAe,EACf,eAA8B,EAC9B,mBAA2B;QATtB,SAAI,GAAW,EAAE,CAAC;QAClB,YAAO,GAAW,EAAE,CAAC;QAU1B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,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;IACjD,CAAC;IACK,QAAQ;;;YACZ,IAAI,CAAC;gBACH,2BAA2B;gBAC3B,MAAM,YAAY,GAAG,IAAI,4BAAY,CAAC,IAA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AO;gBACL,WAAW,EAAE,YAAY,CAAC,WAAW;gBACrC,QAAQ,EAAE,YAAY,CAAC,QAAQ;aAChC,CAAC;QACJ,CAAC;KAAA;CACF;AAtGD,4CAsGC"}
|
package/package.json
CHANGED
package/src/bootstrap/app.ts
CHANGED
|
@@ -28,20 +28,9 @@ export class OnlyEverGenerator {
|
|
|
28
28
|
} = undefined;
|
|
29
29
|
promptForTypology: string = "";
|
|
30
30
|
promptForCardGen: string = "";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = {
|
|
35
|
-
promptId: "",
|
|
36
|
-
version: "",
|
|
37
|
-
};
|
|
38
|
-
promptForConceptFacts: {
|
|
39
|
-
promptId: string;
|
|
40
|
-
version: string;
|
|
41
|
-
} = {
|
|
42
|
-
promptId: "",
|
|
43
|
-
version: "",
|
|
44
|
-
};
|
|
31
|
+
public promptIdForTypology: string = "";
|
|
32
|
+
public promptIdForConceptFacts: string = "";
|
|
33
|
+
public promptIdForCardsGeneration: string = "";
|
|
45
34
|
generationVariables: {
|
|
46
35
|
bloom_instructions: string;
|
|
47
36
|
card_instructions: string;
|
|
@@ -60,22 +49,16 @@ export class OnlyEverGenerator {
|
|
|
60
49
|
apiKey: string,
|
|
61
50
|
model: string,
|
|
62
51
|
generationContent: BaseParamType,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
version: string;
|
|
66
|
-
},
|
|
67
|
-
promptForConceptFacts: {
|
|
68
|
-
promptId: string;
|
|
69
|
-
version: string;
|
|
70
|
-
},
|
|
52
|
+
promptIdForTypology: string,
|
|
53
|
+
promptIdForConceptFacts: string,
|
|
71
54
|
generationVariables: {
|
|
72
55
|
bloom_instructions: string;
|
|
73
56
|
card_instructions: string;
|
|
74
57
|
card_examples: string;
|
|
75
58
|
}
|
|
76
59
|
) {
|
|
77
|
-
this.
|
|
78
|
-
this.
|
|
60
|
+
this.promptIdForTypology = promptIdForTypology;
|
|
61
|
+
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
79
62
|
this.api_key = apiKey;
|
|
80
63
|
this.generationVariables = generationVariables;
|
|
81
64
|
this.openAiService = new OpenAiService(
|
|
@@ -193,7 +176,8 @@ export class OnlyEverGenerator {
|
|
|
193
176
|
this.openAiService,
|
|
194
177
|
JSON.stringify(content),
|
|
195
178
|
this.parsedContent!.taxonomy,
|
|
196
|
-
this.generationVariables
|
|
179
|
+
this.generationVariables,
|
|
180
|
+
this.promptIdForCardsGeneration
|
|
197
181
|
).generateCards(n);
|
|
198
182
|
return generateCardsResp;
|
|
199
183
|
}
|
|
@@ -210,7 +194,7 @@ export class OnlyEverGenerator {
|
|
|
210
194
|
this.parsedContent?.type ?? "text",
|
|
211
195
|
JSON.stringify(content),
|
|
212
196
|
this.expectedFields,
|
|
213
|
-
this.
|
|
197
|
+
this.promptIdForTypology
|
|
214
198
|
).generate();
|
|
215
199
|
return response;
|
|
216
200
|
} catch (error) {
|
|
@@ -228,7 +212,7 @@ export class OnlyEverGenerator {
|
|
|
228
212
|
this.openAiService,
|
|
229
213
|
content,
|
|
230
214
|
this.parsedContent?.type ?? "text",
|
|
231
|
-
this.
|
|
215
|
+
this.promptIdForConceptFacts
|
|
232
216
|
).generate();
|
|
233
217
|
return response;
|
|
234
218
|
}
|
|
@@ -16,13 +16,7 @@ export class GenerateCards {
|
|
|
16
16
|
card_examples: string;
|
|
17
17
|
};
|
|
18
18
|
openAIHelper: OpenAIHelper;
|
|
19
|
-
|
|
20
|
-
promptId: string;
|
|
21
|
-
version: string;
|
|
22
|
-
} = {
|
|
23
|
-
promptId: "",
|
|
24
|
-
version: "",
|
|
25
|
-
};
|
|
19
|
+
public promptIdForCardsGeneration: string;
|
|
26
20
|
constructor(
|
|
27
21
|
openAiService: OpenAiService,
|
|
28
22
|
content: string,
|
|
@@ -31,18 +25,15 @@ export class GenerateCards {
|
|
|
31
25
|
bloom_instructions: string;
|
|
32
26
|
card_instructions: string;
|
|
33
27
|
card_examples: string;
|
|
34
|
-
}
|
|
28
|
+
},
|
|
29
|
+
promptIdForCardsGeneration: string
|
|
35
30
|
) {
|
|
36
31
|
this.openAiService = openAiService;
|
|
37
|
-
this.openAIHelper = new OpenAIHelper(
|
|
38
|
-
this.openAiService.api_key,
|
|
39
|
-
this.openAiService.model,
|
|
40
|
-
this.promptForCardsGeneration.promptId,
|
|
41
|
-
this.promptForCardsGeneration.version
|
|
42
|
-
);
|
|
32
|
+
this.openAIHelper = new OpenAIHelper(this.openAiService.api_key);
|
|
43
33
|
this.content = content;
|
|
44
34
|
this.taxonomy = taxonomy;
|
|
45
35
|
this.generationVariables = generationVariables;
|
|
36
|
+
this.promptIdForCardsGeneration = promptIdForCardsGeneration;
|
|
46
37
|
}
|
|
47
38
|
|
|
48
39
|
async openAIResponse() {
|
|
@@ -50,7 +41,7 @@ export class GenerateCards {
|
|
|
50
41
|
try {
|
|
51
42
|
let response: any = await this.openAIHelper.openAI.responses.create({
|
|
52
43
|
prompt: {
|
|
53
|
-
id:
|
|
44
|
+
id: this.promptIdForCardsGeneration,
|
|
54
45
|
variables: {
|
|
55
46
|
bloom_level: "1",
|
|
56
47
|
card_types: "mcq,cloze,match,flash",
|
|
@@ -2,21 +2,10 @@ import OpenAI from "openai";
|
|
|
2
2
|
|
|
3
3
|
export class OpenAIHelper {
|
|
4
4
|
public openAI: OpenAI;
|
|
5
|
-
public model: string;
|
|
6
|
-
public promptId: string;
|
|
7
5
|
public openAIKey: string;
|
|
8
|
-
|
|
9
|
-
constructor(
|
|
10
|
-
openAIKey: string,
|
|
11
|
-
model: string,
|
|
12
|
-
promptId: string,
|
|
13
|
-
version: string
|
|
14
|
-
) {
|
|
6
|
+
constructor(openAIKey: string) {
|
|
15
7
|
this.openAI = getOpenAI(openAIKey);
|
|
16
|
-
this.model = model;
|
|
17
|
-
this.promptId = promptId;
|
|
18
8
|
this.openAIKey = openAIKey;
|
|
19
|
-
this.version = version;
|
|
20
9
|
}
|
|
21
10
|
}
|
|
22
11
|
|
|
@@ -11,13 +11,7 @@ export class GenerateConceptFacts {
|
|
|
11
11
|
content: any[];
|
|
12
12
|
};
|
|
13
13
|
public type: string = "";
|
|
14
|
-
public
|
|
15
|
-
promptId: string;
|
|
16
|
-
version: string;
|
|
17
|
-
} = {
|
|
18
|
-
promptId: "",
|
|
19
|
-
version: "",
|
|
20
|
-
};
|
|
14
|
+
public promptIdForConceptFacts: string;
|
|
21
15
|
constructor(
|
|
22
16
|
openAiService: OpenAiService,
|
|
23
17
|
content: {
|
|
@@ -26,20 +20,12 @@ export class GenerateConceptFacts {
|
|
|
26
20
|
content: any[];
|
|
27
21
|
},
|
|
28
22
|
type: string,
|
|
29
|
-
|
|
30
|
-
promptId: string;
|
|
31
|
-
version: string;
|
|
32
|
-
}
|
|
23
|
+
promptIdForConceptFacts: string
|
|
33
24
|
) {
|
|
34
25
|
this.openAiService = openAiService;
|
|
35
|
-
this.openAIHelper = new OpenAIHelper(
|
|
36
|
-
this.openAiService.api_key,
|
|
37
|
-
this.openAiService.model,
|
|
38
|
-
this.promptForConceptFacts.promptId,
|
|
39
|
-
this.promptForConceptFacts.version
|
|
40
|
-
);
|
|
26
|
+
this.openAIHelper = new OpenAIHelper(this.openAiService.api_key);
|
|
41
27
|
this.content = content;
|
|
42
|
-
this.
|
|
28
|
+
this.promptIdForConceptFacts = promptIdForConceptFacts;
|
|
43
29
|
this.type = type;
|
|
44
30
|
}
|
|
45
31
|
|
|
@@ -51,10 +37,8 @@ export class GenerateConceptFacts {
|
|
|
51
37
|
true
|
|
52
38
|
);
|
|
53
39
|
const openAiResponse = await this.openAIHelper.openAI.responses.create({
|
|
54
|
-
model: this.openAIHelper.model,
|
|
55
40
|
prompt: {
|
|
56
|
-
id: this.
|
|
57
|
-
version: this.promptForConceptFacts.version,
|
|
41
|
+
id: this.promptIdForConceptFacts,
|
|
58
42
|
variables: {
|
|
59
43
|
heading_type: this.type == "video" ? "timecode" : "h1 heading",
|
|
60
44
|
},
|
|
@@ -6,23 +6,14 @@ export class GenerateTypology {
|
|
|
6
6
|
public openAiService: OpenAiService;
|
|
7
7
|
public type: string = "";
|
|
8
8
|
public content: string = "";
|
|
9
|
-
public
|
|
10
|
-
promptId: string;
|
|
11
|
-
version: string;
|
|
12
|
-
} = {
|
|
13
|
-
promptId: "",
|
|
14
|
-
version: "",
|
|
15
|
-
};
|
|
9
|
+
public promptIdForTypology: string;
|
|
16
10
|
expectedFields: Array<string>;
|
|
17
11
|
constructor(
|
|
18
12
|
openAiService: OpenAiService,
|
|
19
13
|
type: string,
|
|
20
14
|
content: string,
|
|
21
15
|
expected_fields: Array<string>,
|
|
22
|
-
|
|
23
|
-
promptId: string;
|
|
24
|
-
version: string;
|
|
25
|
-
}
|
|
16
|
+
promptIdForTypology: string
|
|
26
17
|
) {
|
|
27
18
|
this.openAiService = openAiService;
|
|
28
19
|
this.type = type;
|
|
@@ -30,23 +21,16 @@ export class GenerateTypology {
|
|
|
30
21
|
this.expectedFields = expected_fields.map((elem: string) =>
|
|
31
22
|
elem.toLowerCase()
|
|
32
23
|
);
|
|
33
|
-
this.
|
|
24
|
+
this.promptIdForTypology = promptIdForTypology;
|
|
34
25
|
}
|
|
35
26
|
async generate() {
|
|
36
27
|
try {
|
|
37
28
|
// Use OpenAI Responses API
|
|
38
|
-
const openAIHelper = new OpenAIHelper(
|
|
39
|
-
this.openAiService.api_key,
|
|
40
|
-
this.openAiService.model,
|
|
41
|
-
this.promptForTypology.promptId,
|
|
42
|
-
this.promptForTypology.version
|
|
43
|
-
);
|
|
29
|
+
const openAIHelper = new OpenAIHelper(this.openAiService.api_key);
|
|
44
30
|
|
|
45
31
|
const openAiResponse: any = await openAIHelper.openAI.responses.create({
|
|
46
|
-
// model: openAIHelper.model,
|
|
47
32
|
prompt: {
|
|
48
|
-
id:
|
|
49
|
-
version: openAIHelper.version,
|
|
33
|
+
id: this.promptIdForTypology,
|
|
50
34
|
variables: {
|
|
51
35
|
heading_type: this.type == "video" ? "timecode" : "h1 heading",
|
|
52
36
|
},
|