only_ever_generator 0.7.7 → 0.7.9
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 +96 -0
- package/dist/bootstrap/app.js +42 -48
- package/dist/bootstrap/app.js.map +1 -0
- package/dist/card_gen/generate_cards.d.ts +7 -0
- package/dist/card_gen/generate_cards.js +32 -24
- package/dist/card_gen/generate_cards.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/constants/api_constants.d.ts +2 -0
- package/dist/constants/api_constants.js +5 -0
- package/dist/constants/api_constants.js.map +1 -0
- package/dist/constants/prompt_data.d.ts +4 -0
- package/dist/constants/prompt_data.js +1 -0
- package/dist/constants/prompt_data.js.map +1 -0
- package/dist/constants/prompts/card_gen_prompt.d.ts +1 -0
- package/dist/constants/prompts/card_gen_prompt.js +1 -0
- package/dist/constants/prompts/card_gen_prompt.js.map +1 -0
- package/dist/constants/prompts/typology_prompt.d.ts +1 -0
- package/dist/constants/prompts/typology_prompt.js +1 -0
- package/dist/constants/prompts/typology_prompt.js.map +1 -0
- package/dist/constants/source_data.d.ts +171 -0
- package/dist/constants/source_data.js +2 -1
- package/dist/constants/source_data.js.map +1 -0
- package/dist/embedding_generation/consolidation/global_consolidation.d.ts +32 -0
- package/dist/embedding_generation/consolidation/global_consolidation.js +76 -0
- package/dist/embedding_generation/consolidation/global_consolidation.js.map +1 -0
- package/dist/embedding_generation/consolidation/local_consolidation.d.ts +38 -0
- package/dist/embedding_generation/consolidation/local_consolidation.js +105 -0
- package/dist/embedding_generation/consolidation/local_consolidation.js.map +1 -0
- package/dist/embedding_generation/consolidation/write_consolidated_data.d.ts +45 -0
- package/dist/embedding_generation/consolidation/write_consolidated_data.js +69 -0
- package/dist/embedding_generation/consolidation/write_consolidated_data.js.map +1 -0
- package/dist/embedding_generation/generate_embeddings.d.ts +27 -0
- package/dist/embedding_generation/generate_embeddings.js +54 -0
- package/dist/embedding_generation/generate_embeddings.js.map +1 -0
- package/dist/embedding_generation/parse_embedding_response.d.ts +25 -0
- package/dist/embedding_generation/parse_embedding_response.js +29 -0
- package/dist/embedding_generation/parse_embedding_response.js.map +1 -0
- package/dist/enums/card_type_enum.d.ts +6 -0
- package/dist/enums/card_type_enum.js +11 -0
- package/dist/enums/card_type_enum.js.map +1 -0
- package/dist/gap_fill/calculate_gap_fill.d.ts +4 -0
- package/dist/gap_fill/calculate_gap_fill.js +3 -5
- package/dist/gap_fill/calculate_gap_fill.js.map +1 -0
- package/dist/helper/qdrant_db_methods.d.ts +39 -0
- package/dist/helper/qdrant_db_methods.js +63 -0
- package/dist/helper/qdrant_db_methods.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +88 -49
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +5 -0
- package/dist/logger.js +1 -0
- package/dist/logger.js.map +1 -0
- package/dist/parse/parse_card/parse_cloze_card.d.ts +16 -0
- package/dist/parse/parse_card/parse_cloze_card.js +3 -2
- package/dist/parse/parse_card/parse_cloze_card.js.map +1 -0
- package/dist/parse/parse_card/parse_flash_cards.d.ts +25 -0
- package/dist/parse/parse_card/parse_flash_cards.js +4 -3
- package/dist/parse/parse_card/parse_flash_cards.js.map +1 -0
- package/dist/parse/parse_card/parse_match_card.d.ts +22 -0
- package/dist/parse/parse_card/parse_match_card.js +3 -3
- package/dist/parse/parse_card/parse_match_card.js.map +1 -0
- package/dist/parse/parse_card/parse_mcq_card.d.ts +30 -0
- package/dist/parse/parse_card/parse_mcq_card.js +3 -2
- package/dist/parse/parse_card/parse_mcq_card.js.map +1 -0
- package/dist/parse/parse_card_response.d.ts +19 -0
- package/dist/parse/parse_card_response.js +62 -51
- package/dist/parse/parse_card_response.js.map +1 -0
- package/dist/parse/parse_source_content.d.ts +25 -0
- package/dist/parse/parse_source_content.js +1 -0
- package/dist/parse/parse_source_content.js.map +1 -0
- package/dist/parse/response_format_card.d.ts +176 -0
- package/dist/parse/response_format_card.js +1 -0
- package/dist/parse/response_format_card.js.map +1 -0
- package/dist/parse/response_format_typology.d.ts +1 -0
- package/dist/parse/response_format_typology.js +1 -0
- package/dist/parse/response_format_typology.js.map +1 -0
- package/dist/services/open_ai_service.d.ts +15 -0
- package/dist/services/open_ai_service.js +29 -0
- package/dist/services/open_ai_service.js.map +1 -0
- package/dist/services/qdrant_service.d.ts +3 -0
- package/dist/services/qdrant_service.js +14 -0
- package/dist/services/qdrant_service.js.map +1 -0
- package/dist/types/base_param_type.d.ts +15 -0
- package/dist/types/base_param_type.js +3 -0
- package/dist/types/base_param_type.js.map +1 -0
- package/dist/types/mongo_concept_fact_type.d.ts +11 -0
- package/dist/types/mongo_concept_fact_type.js +3 -0
- package/dist/types/mongo_concept_fact_type.js.map +1 -0
- package/dist/types/parsed_card_type.d.ts +11 -0
- package/dist/types/parsed_card_type.js +30 -0
- package/dist/types/parsed_card_type.js.map +1 -0
- package/dist/types/raw_card_response_types/generated_card_response_type.d.ts +39 -0
- package/dist/types/raw_card_response_types/generated_card_response_type.js +8 -0
- package/dist/types/raw_card_response_types/generated_card_response_type.js.map +1 -0
- package/dist/types/source_taxonomy_type.d.ts +14 -0
- package/dist/types/source_taxonomy_type.js +3 -0
- package/dist/types/source_taxonomy_type.js.map +1 -0
- package/dist/typology_gen/generate_typology.d.ts +28 -0
- package/dist/typology_gen/generate_typology.js +12 -11
- package/dist/typology_gen/generate_typology.js.map +1 -0
- package/dist/utils/generate_args.d.ts +7 -0
- package/dist/utils/generate_args.js +1 -0
- package/dist/utils/generate_args.js.map +1 -0
- package/dist/utils/parse_openai_response.d.ts +10 -0
- package/dist/utils/parse_openai_response.js +1 -0
- package/dist/utils/parse_openai_response.js.map +1 -0
- package/package.json +17 -14
- package/src/bootstrap/app.ts +84 -71
- package/src/card_gen/generate_cards.ts +40 -29
- package/src/config.ts +2 -0
- package/src/constants/api_constants.ts +4 -0
- package/src/constants/prompts/card_gen_prompt.ts +1 -1
- package/src/embedding_generation/consolidation/global_consolidation.ts +94 -0
- package/src/embedding_generation/consolidation/local_consolidation.ts +141 -0
- package/src/embedding_generation/consolidation/write_consolidated_data.ts +98 -0
- package/src/embedding_generation/generate_embeddings.ts +41 -0
- package/src/embedding_generation/parse_embedding_response.ts +31 -0
- package/src/enums/card_type_enum.ts +6 -0
- package/src/gap_fill/calculate_gap_fill.ts +42 -45
- package/src/helper/qdrant_db_methods.ts +77 -0
- package/src/parse/parse_card/parse_cloze_card.ts +11 -3
- package/src/parse/parse_card/parse_flash_cards.ts +12 -4
- package/src/parse/parse_card/parse_match_card.ts +10 -4
- package/src/parse/parse_card/parse_mcq_card.ts +11 -3
- package/src/parse/parse_card_response.ts +94 -54
- package/src/parse/parse_source_content.ts +9 -1
- package/src/services/open_ai_service.ts +33 -1
- package/src/services/qdrant_service.ts +10 -0
- package/src/types/base_param_type.ts +16 -0
- package/src/types/mongo_concept_fact_type.ts +12 -0
- package/src/types/parsed_card_type.ts +39 -0
- package/src/types/raw_card_response_types/generated_card_response_type.ts +61 -0
- package/src/types/source_taxonomy_type.ts +17 -0
- package/src/typology_gen/generate_typology.ts +13 -12
- package/tsconfig.json +6 -3
- package/.env.example +0 -1
- package/prompts.json +0 -23
- package/readme.md +0 -35
- package/src/constants/prompt_data.ts +0 -301
- package/src/constants/source_data.ts +0 -1036
- package/src/index.ts +0 -72
- package/src/parse/response_format_card.ts +0 -386
- package/src/parse/response_format_typology.ts +0 -44
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { OpenAiService } from "../services/open_ai_service";
|
|
2
|
+
import { BaseParamType } from "../types/base_param_type";
|
|
3
|
+
import { SourceTaxonomy } from "../types/source_taxonomy_type";
|
|
4
|
+
export declare class OnlyEverGenerator {
|
|
5
|
+
api_key: string;
|
|
6
|
+
openAiService: OpenAiService;
|
|
7
|
+
parsedContent?: {
|
|
8
|
+
title: string;
|
|
9
|
+
headings: string[];
|
|
10
|
+
content: any[];
|
|
11
|
+
taxonomy: SourceTaxonomy;
|
|
12
|
+
};
|
|
13
|
+
promptForTypology: string;
|
|
14
|
+
promptForCardGen: string;
|
|
15
|
+
expectedFields: Array<string>;
|
|
16
|
+
typologyResponse?: SourceTaxonomy;
|
|
17
|
+
cardgenResponse: any;
|
|
18
|
+
summarizeResponse: {};
|
|
19
|
+
constructor(apiKey: string, model: string, generationContent: BaseParamType);
|
|
20
|
+
generate(generate_typology?: boolean, generate_card?: boolean): Promise<Array<any>>;
|
|
21
|
+
shouldTheCardBeGeneratedAfterTypologyResponse(): boolean;
|
|
22
|
+
generateCard(prompt: string, additionalContent: string, isGapFill: boolean, n?: number): Promise<any>;
|
|
23
|
+
generateTypology(prompt: string): Promise<any>;
|
|
24
|
+
generateEmbeddings(typologyResponse: any): Promise<{
|
|
25
|
+
concepts_facts: {
|
|
26
|
+
text: string;
|
|
27
|
+
type: string;
|
|
28
|
+
embedding: any;
|
|
29
|
+
reference: string;
|
|
30
|
+
}[];
|
|
31
|
+
metadata: {
|
|
32
|
+
req_time: string;
|
|
33
|
+
req_type: {
|
|
34
|
+
type: string;
|
|
35
|
+
};
|
|
36
|
+
req_tokens: any;
|
|
37
|
+
res_tokens: any;
|
|
38
|
+
model: any;
|
|
39
|
+
usage: any;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
localConsolidation(concepts_facts: {
|
|
43
|
+
text: string;
|
|
44
|
+
type: string;
|
|
45
|
+
reference: string;
|
|
46
|
+
embedding: number[];
|
|
47
|
+
}[], sourceId: string): Promise<{
|
|
48
|
+
globalConceptOps: {
|
|
49
|
+
id: string;
|
|
50
|
+
vector: number[];
|
|
51
|
+
payload: {
|
|
52
|
+
_sources: string[];
|
|
53
|
+
text: string;
|
|
54
|
+
};
|
|
55
|
+
}[];
|
|
56
|
+
sourceIds: string[];
|
|
57
|
+
consolidatedConcepts: any[];
|
|
58
|
+
sourceTaxonomyOps: {
|
|
59
|
+
text: string;
|
|
60
|
+
id: string;
|
|
61
|
+
embedding: number[];
|
|
62
|
+
type: string;
|
|
63
|
+
reference: string;
|
|
64
|
+
}[];
|
|
65
|
+
}>;
|
|
66
|
+
globalConsolidation(concepts_facts: {
|
|
67
|
+
id: string;
|
|
68
|
+
text: string;
|
|
69
|
+
type: string;
|
|
70
|
+
reference: string;
|
|
71
|
+
embedding: number[];
|
|
72
|
+
}[], sourceId: string, threshold: number): Promise<{
|
|
73
|
+
source_taxonomy: {
|
|
74
|
+
text: string;
|
|
75
|
+
type: string;
|
|
76
|
+
reference: string;
|
|
77
|
+
id: string;
|
|
78
|
+
}[];
|
|
79
|
+
global_updates: {
|
|
80
|
+
id: string;
|
|
81
|
+
sourceIdToAdd: string;
|
|
82
|
+
currentPayload: {
|
|
83
|
+
_sources: string[];
|
|
84
|
+
text: string;
|
|
85
|
+
};
|
|
86
|
+
}[];
|
|
87
|
+
global_inserts: {
|
|
88
|
+
id: string;
|
|
89
|
+
vector: number[];
|
|
90
|
+
payload: {
|
|
91
|
+
_sources: string[];
|
|
92
|
+
text: string;
|
|
93
|
+
};
|
|
94
|
+
}[];
|
|
95
|
+
}>;
|
|
96
|
+
}
|
package/dist/bootstrap/app.js
CHANGED
|
@@ -13,23 +13,22 @@ exports.OnlyEverGenerator = void 0;
|
|
|
13
13
|
const generate_cards_1 = require("../card_gen/generate_cards");
|
|
14
14
|
const parse_source_content_1 = require("../parse/parse_source_content");
|
|
15
15
|
const open_ai_service_1 = require("../services/open_ai_service");
|
|
16
|
-
// import { returnCardGenPrompt } from "../constants/prompts/card_gen_prompt";
|
|
17
|
-
// import { returnTypologyPrompt } from "../constants/prompts/typology_prompt";
|
|
18
16
|
const generate_typology_1 = require("../typology_gen/generate_typology");
|
|
19
17
|
const generate_args_1 = require("../utils/generate_args");
|
|
20
|
-
const
|
|
21
|
-
|
|
18
|
+
const generate_embeddings_1 = require("../embedding_generation/generate_embeddings");
|
|
19
|
+
const local_consolidation_1 = require("../embedding_generation/consolidation/local_consolidation");
|
|
20
|
+
const global_consolidation_1 = require("../embedding_generation/consolidation/global_consolidation");
|
|
22
21
|
class OnlyEverGenerator {
|
|
23
22
|
constructor(apiKey, model, generationContent) {
|
|
24
23
|
this.api_key = "";
|
|
25
24
|
/// these fields will be populated inside the constructor
|
|
26
|
-
this.parsedContent =
|
|
25
|
+
this.parsedContent = undefined;
|
|
27
26
|
this.promptForTypology = "";
|
|
28
27
|
this.promptForCardGen = "";
|
|
28
|
+
this.expectedFields = [];
|
|
29
29
|
this.typologyResponse = undefined;
|
|
30
30
|
this.cardgenResponse = undefined;
|
|
31
31
|
this.summarizeResponse = {};
|
|
32
|
-
this.gapFillResponse = {};
|
|
33
32
|
this.api_key = apiKey;
|
|
34
33
|
this.openAiService = new open_ai_service_1.OpenAiService(apiKey, model !== null && model !== void 0 ? model : "gpt-3.5-turbo-1106");
|
|
35
34
|
const parsedData = new parse_source_content_1.ParseSourceContent(generationContent.content).parseData();
|
|
@@ -39,7 +38,6 @@ class OnlyEverGenerator {
|
|
|
39
38
|
content: parsedData.content,
|
|
40
39
|
taxonomy: parsedData.taxonomy,
|
|
41
40
|
}),
|
|
42
|
-
// parsedData.type == 'cards' ? this.typologyResponse = parsedData.taxonomy : this.typologyResponse = null;
|
|
43
41
|
(this.typologyResponse = generationContent.content.taxonomy);
|
|
44
42
|
this.expectedFields = generationContent.content.fields; //returnFields();
|
|
45
43
|
this.promptForTypology = generationContent.prompt.typology;
|
|
@@ -47,33 +45,41 @@ class OnlyEverGenerator {
|
|
|
47
45
|
}
|
|
48
46
|
generate() {
|
|
49
47
|
return __awaiter(this, arguments, void 0, function* (generate_typology = false, generate_card = false) {
|
|
48
|
+
var _a, _b, _c, _d, _e;
|
|
50
49
|
let args = new generate_args_1.GenerateArgs(generate_card, generate_typology, false);
|
|
51
50
|
const responseToReturn = [];
|
|
52
51
|
const whatNeedsToBeGenerated = args.getWhatNeedsToBeGenerated();
|
|
53
52
|
for (let elem of whatNeedsToBeGenerated)
|
|
54
53
|
if (elem == "generate_tyopology") {
|
|
55
54
|
this.typologyResponse = yield this.generateTypology(this.promptForTypology);
|
|
55
|
+
const embeddings = yield this.generateEmbeddings(this.typologyResponse);
|
|
56
|
+
console.log("Embedding generated");
|
|
57
|
+
const localConsolidation = yield this.localConsolidation(embeddings.concepts_facts, this.parsedContent.title);
|
|
58
|
+
console.log("Local consolidation done");
|
|
59
|
+
this.typologyResponse.concepts_facts =
|
|
60
|
+
localConsolidation.sourceTaxonomyOps;
|
|
61
|
+
const globalConsolidation = yield this.globalConsolidation(localConsolidation.sourceTaxonomyOps, this.parsedContent.title, 0.8);
|
|
62
|
+
console.log("Global consolidation done");
|
|
63
|
+
this.typologyResponse.concepts_facts =
|
|
64
|
+
globalConsolidation.source_taxonomy;
|
|
65
|
+
(_a = this.typologyResponse.metadata) === null || _a === void 0 ? void 0 : _a.push(embeddings.metadata);
|
|
56
66
|
responseToReturn.push(this.typologyResponse);
|
|
57
67
|
}
|
|
58
68
|
else if (elem == "generate_card") {
|
|
59
|
-
/// for cards gen to occur, there must be presence of source taxonomy
|
|
60
69
|
if (this.shouldTheCardBeGeneratedAfterTypologyResponse()) {
|
|
61
70
|
this.parsedContent.taxonomy = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
generate_cards: this.typologyResponse.generate_cards
|
|
71
|
+
concepts_facts: (_c = (_b = this.typologyResponse) === null || _b === void 0 ? void 0 : _b.concepts_facts) !== null && _c !== void 0 ? _c : [],
|
|
72
|
+
fields: this.expectedFields,
|
|
73
|
+
generate_cards: (_e = (_d = this.typologyResponse) === null || _d === void 0 ? void 0 : _d.generate_cards) !== null && _e !== void 0 ? _e : {
|
|
74
|
+
state: false,
|
|
75
|
+
reason: "",
|
|
76
|
+
},
|
|
65
77
|
};
|
|
66
78
|
this.cardgenResponse = yield this.generateCard(this.promptForCardGen, JSON.stringify(this.typologyResponse), false);
|
|
67
79
|
responseToReturn.push(this.cardgenResponse);
|
|
68
|
-
/// check if gap fill is required ie coverage determination
|
|
69
|
-
if (this.cardgenResponse.status_code == 200) {
|
|
70
|
-
this.gapFillResponse = yield this._generationForGapFill(this.typologyResponse, this.cardgenResponse);
|
|
71
|
-
responseToReturn.push(this.gapFillResponse);
|
|
72
|
-
}
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
return responseToReturn;
|
|
76
|
-
// return [typologyPrompt, cardPrompt];
|
|
77
83
|
});
|
|
78
84
|
}
|
|
79
85
|
shouldTheCardBeGeneratedAfterTypologyResponse() {
|
|
@@ -85,26 +91,9 @@ class OnlyEverGenerator {
|
|
|
85
91
|
return false;
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
|
-
_generationForGapFill(typologyData, cardGenData) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
let gapFill = (0, calculate_gap_fill_1.gapFilling)(typologyData, cardGenData);
|
|
91
|
-
let response;
|
|
92
|
-
if (gapFill.remainingConcepts.length !== 0 ||
|
|
93
|
-
gapFill.remainingFacts.length !== 0) {
|
|
94
|
-
this.typologyResponse.facts = gapFill.remainingFacts;
|
|
95
|
-
this.typologyResponse.concepts = gapFill.remainingConcepts;
|
|
96
|
-
response = yield this.generateCard(this.promptForCardGen +
|
|
97
|
-
"Generate cards only suitable for the given remaining concepts and facts" +
|
|
98
|
-
JSON.stringify(gapFill), "", true, 1);
|
|
99
|
-
}
|
|
100
|
-
return response;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
94
|
generateCard(prompt_1, additionalContent_1, isGapFill_1) {
|
|
104
95
|
return __awaiter(this, arguments, void 0, function* (prompt, additionalContent, isGapFill, n = 0) {
|
|
105
96
|
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
|
-
// let response = await this.openAiService?.sendRequest(prompt,this.parsedContent);
|
|
107
|
-
// response['type'] = 'card_gen';
|
|
108
97
|
return generateCardsResp;
|
|
109
98
|
});
|
|
110
99
|
}
|
|
@@ -114,21 +103,26 @@ class OnlyEverGenerator {
|
|
|
114
103
|
return response;
|
|
115
104
|
});
|
|
116
105
|
}
|
|
117
|
-
|
|
118
|
-
return __awaiter(this,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
106
|
+
generateEmbeddings(typologyResponse) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const concepts_facts = typologyResponse.concepts_facts;
|
|
109
|
+
const texts = concepts_facts.map((e) => e.text);
|
|
110
|
+
const embeddings = yield new generate_embeddings_1.GenerateEmbeddings(this.openAiService).generateEmbeddings(concepts_facts);
|
|
111
|
+
return embeddings;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
localConsolidation(concepts_facts, sourceId) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
const embeddings = new local_consolidation_1.LocalConsolidation().consolidate(concepts_facts, sourceId);
|
|
117
|
+
return embeddings;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
globalConsolidation(concepts_facts, sourceId, threshold) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const embeddings = yield new global_consolidation_1.GlobalConsolidation().consolidate(concepts_facts, sourceId, threshold !== null && threshold !== void 0 ? threshold : 0.8);
|
|
123
|
+
return embeddings;
|
|
131
124
|
});
|
|
132
125
|
}
|
|
133
126
|
}
|
|
134
127
|
exports.OnlyEverGenerator = OnlyEverGenerator;
|
|
128
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/bootstrap/app.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA2D;AAC3D,wEAAmE;AACnE,iEAA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/source_taxonomy_type";
|
|
3
|
+
export declare class GenerateCards {
|
|
4
|
+
openAiService: OpenAiService;
|
|
5
|
+
constructor(openAiService: OpenAiService);
|
|
6
|
+
generateCards(prompt: string, parsedContent: string, isGapFill: boolean, taxonomy: SourceTaxonomy, n?: number): Promise<any>;
|
|
7
|
+
}
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GenerateCards = void 0;
|
|
13
|
+
const logger_1 = require("../logger");
|
|
13
14
|
const parse_card_response_1 = require("../parse/parse_card_response");
|
|
14
15
|
class GenerateCards {
|
|
15
16
|
constructor(openAiService) {
|
|
@@ -18,33 +19,40 @@ class GenerateCards {
|
|
|
18
19
|
generateCards(prompt_1, parsedContent_1, isGapFill_1, taxonomy_1) {
|
|
19
20
|
return __awaiter(this, arguments, void 0, function* (prompt, parsedContent, isGapFill, taxonomy, n = 0) {
|
|
20
21
|
var _a, _b, _c, _d, _e;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
try {
|
|
23
|
+
let response = yield ((_a = this.openAiService) === null || _a === void 0 ? void 0 : _a.sendRequest(prompt, parsedContent));
|
|
24
|
+
var updatedNumber = n + 1;
|
|
25
|
+
response.metadata = {
|
|
26
|
+
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
|
+
},
|
|
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,
|
|
36
|
+
};
|
|
37
|
+
if (response.status_code == 200) {
|
|
38
|
+
response.metadata.status = "completed";
|
|
39
|
+
let parseCard = new parse_card_response_1.ParseCardResponse().parse(response, isGapFill, taxonomy, 1);
|
|
40
|
+
return parseCard;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
response.metadata.status = "failed";
|
|
44
|
+
response.metadata.err_message = response.message;
|
|
45
|
+
return response;
|
|
46
|
+
}
|
|
41
47
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
catch (e) {
|
|
49
|
+
new logger_1.ErrorLogger({
|
|
50
|
+
type: "card_generation",
|
|
51
|
+
data: e.message,
|
|
52
|
+
}).log();
|
|
46
53
|
}
|
|
47
54
|
});
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
exports.GenerateCards = GenerateCards;
|
|
58
|
+
//# sourceMappingURL=generate_cards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate_cards.js","sourceRoot":"","sources":["../../src/card_gen/generate_cards.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAwC;AACxC,sEAAiE;AAIjE,MAAa,aAAa;IAExB,YAAY,aAA4B;QACtC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAEK,aAAa;6DACjB,MAAc,EACd,aAAqB,EACrB,SAAkB,EAClB,QAAwB,EACxB,IAAY,CAAC;;YAEb,IAAI,CAAC;gBACH,IAAI,QAAQ,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,WAAW,CAClD,MAAM,EACN,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@@ -3,5 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
require("dotenv/config");
|
|
4
4
|
const config = {
|
|
5
5
|
openAIKey: process.env.OPEN_AI_KEY,
|
|
6
|
+
qdrantApiKey: process.env.QDRANT_API_KEY,
|
|
7
|
+
qdrantUrl: process.env.QDRANT_URL,
|
|
6
8
|
};
|
|
7
9
|
exports.default = config;
|
|
10
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AAEvB,MAAM,MAAM,GAAG;IACb,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,WAAqB;IAC5C,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;IACxC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;CAClC,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.openAiEndPoint = openAiEndPoint;
|
|
4
|
+
exports.openAiEmbeddingEndPoint = openAiEmbeddingEndPoint;
|
|
4
5
|
function openAiEndPoint() {
|
|
5
6
|
return "https://api.openai.com/v1/chat/completions";
|
|
6
7
|
}
|
|
8
|
+
function openAiEmbeddingEndPoint() {
|
|
9
|
+
return "https://api.openai.com/v1/embeddings";
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=api_constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api_constants.js","sourceRoot":"","sources":["../../src/constants/api_constants.ts"],"names":[],"mappings":";;AAAA,wCAEC;AAED,0DAEC;AAND,SAAgB,cAAc;IAC5B,OAAO,4CAA4C,CAAC;AACtD,CAAC;AAED,SAAgB,uBAAuB;IACrC,OAAO,sCAAsC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt_data.js","sourceRoot":"","sources":["../../src/constants/prompt_data.ts"],"names":[],"mappings":";;AAuSA,4CAKC;AA5SD,+DAAgE;AAChE,+DAAiE;AAEjE,MAAM,UAAU,GAAQ;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;SAuBD;QACL,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;SAqBH;QACL,QAAQ,EAAE;;;;;;;;;;;;;;;;SAgBL;QACL,KAAK,EAAE;;;;;;;;;;SAUF;QACL,QAAQ,EAAE;;;;;;;;;;;SAWL;QACL,SAAS,EAAE;;;;;;;;;;;;SAYN;KACN;IACD,eAAe,EAAE;QACf,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAwCD;QACL,QAAQ,EAAE;;;;;;;;;;;;;;;;SAgBL;QACL,KAAK,EAAE;;;;;;;;;;SAUF;QACL,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAsGL;QACL,SAAS,EAAE,gUAAgU;QAC3U,aAAa,EAAE;;;;;;;;;;;;0VAYuU;KACvV;CACF,CAAC;AAEF,SAAgB,gBAAgB;IAC9B,OAAO;QACL,QAAQ,EAAE,IAAA,sCAAoB,GAAE;QAChC,eAAe,EAAE,IAAA,qCAAmB,GAAE;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function returnCardGenPrompt(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card_gen_prompt.js","sourceRoot":"","sources":["../../../src/constants/prompts/card_gen_prompt.ts"],"names":[],"mappings":";;AAiKA,kDAEC;AAnKD,MAAM,YAAY,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgK5B,CAAC;AACF,SAAgB,mBAAmB;IACjC,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function returnTypologyPrompt(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typology_prompt.js","sourceRoot":"","sources":["../../../src/constants/prompts/typology_prompt.ts"],"names":[],"mappings":";;AAyIA,oDAEC;AA3ID,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmI5B,CAAC;AAMF,SAAgB,oBAAoB;IAChC,OAAO,oBAAoB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
export declare function returnFields(): string[];
|
|
2
|
+
export declare function returnSourceData(): {
|
|
3
|
+
type: string;
|
|
4
|
+
title: string;
|
|
5
|
+
headings: string[];
|
|
6
|
+
content: ({
|
|
7
|
+
block_type: string;
|
|
8
|
+
img_src: string;
|
|
9
|
+
img_caption: string;
|
|
10
|
+
content?: undefined;
|
|
11
|
+
heading_level?: undefined;
|
|
12
|
+
children?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
block_type: string;
|
|
15
|
+
content: string;
|
|
16
|
+
img_src?: undefined;
|
|
17
|
+
img_caption?: undefined;
|
|
18
|
+
heading_level?: undefined;
|
|
19
|
+
children?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
block_type: string;
|
|
22
|
+
content: string;
|
|
23
|
+
heading_level: number;
|
|
24
|
+
children: ({
|
|
25
|
+
block_type: string;
|
|
26
|
+
img_src: string;
|
|
27
|
+
img_caption: string;
|
|
28
|
+
content?: undefined;
|
|
29
|
+
heading_level?: undefined;
|
|
30
|
+
children?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
block_type: string;
|
|
33
|
+
content: string;
|
|
34
|
+
img_src?: undefined;
|
|
35
|
+
img_caption?: undefined;
|
|
36
|
+
heading_level?: undefined;
|
|
37
|
+
children?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
block_type: string;
|
|
40
|
+
content: {
|
|
41
|
+
block_type: string;
|
|
42
|
+
list_type: string;
|
|
43
|
+
marker: string;
|
|
44
|
+
content: string;
|
|
45
|
+
}[];
|
|
46
|
+
img_src?: undefined;
|
|
47
|
+
img_caption?: undefined;
|
|
48
|
+
heading_level?: undefined;
|
|
49
|
+
children?: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
block_type: string;
|
|
52
|
+
content: string;
|
|
53
|
+
heading_level: number;
|
|
54
|
+
children: {
|
|
55
|
+
block_type: string;
|
|
56
|
+
content: string;
|
|
57
|
+
heading_level: number;
|
|
58
|
+
children: {
|
|
59
|
+
block_type: string;
|
|
60
|
+
content: string;
|
|
61
|
+
}[];
|
|
62
|
+
}[];
|
|
63
|
+
img_src?: undefined;
|
|
64
|
+
img_caption?: undefined;
|
|
65
|
+
})[];
|
|
66
|
+
img_src?: undefined;
|
|
67
|
+
img_caption?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
block_type: string;
|
|
70
|
+
content: string;
|
|
71
|
+
heading_level: number;
|
|
72
|
+
children: ({
|
|
73
|
+
block_type: string;
|
|
74
|
+
content: string;
|
|
75
|
+
heading_level?: undefined;
|
|
76
|
+
children?: undefined;
|
|
77
|
+
} | {
|
|
78
|
+
block_type: string;
|
|
79
|
+
content: {
|
|
80
|
+
block_type: string;
|
|
81
|
+
list_type: string;
|
|
82
|
+
marker: string;
|
|
83
|
+
content: string;
|
|
84
|
+
}[];
|
|
85
|
+
heading_level?: undefined;
|
|
86
|
+
children?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
block_type: string;
|
|
89
|
+
content: string;
|
|
90
|
+
heading_level: number;
|
|
91
|
+
children: ({
|
|
92
|
+
block_type: string;
|
|
93
|
+
img_src: string;
|
|
94
|
+
img_caption: string;
|
|
95
|
+
content?: undefined;
|
|
96
|
+
} | {
|
|
97
|
+
block_type: string;
|
|
98
|
+
content: string;
|
|
99
|
+
img_src?: undefined;
|
|
100
|
+
img_caption?: undefined;
|
|
101
|
+
})[];
|
|
102
|
+
})[];
|
|
103
|
+
img_src?: undefined;
|
|
104
|
+
img_caption?: undefined;
|
|
105
|
+
})[];
|
|
106
|
+
fields: string[];
|
|
107
|
+
};
|
|
108
|
+
export declare function returnHeadings(): string[];
|
|
109
|
+
export declare function returnCardResponse(): {
|
|
110
|
+
status_code: number;
|
|
111
|
+
metadata: {};
|
|
112
|
+
usage_data: {
|
|
113
|
+
prompt_tokens: number;
|
|
114
|
+
completion_tokens: number;
|
|
115
|
+
total_tokens: number;
|
|
116
|
+
};
|
|
117
|
+
generated_content: {
|
|
118
|
+
test_cards: ({
|
|
119
|
+
type: string;
|
|
120
|
+
card_content: {
|
|
121
|
+
prompt: string;
|
|
122
|
+
choices: {
|
|
123
|
+
choice: string;
|
|
124
|
+
is_correct: boolean;
|
|
125
|
+
}[];
|
|
126
|
+
options?: undefined;
|
|
127
|
+
};
|
|
128
|
+
concepts: {
|
|
129
|
+
concept_text: string;
|
|
130
|
+
reference: string;
|
|
131
|
+
}[];
|
|
132
|
+
facts: {
|
|
133
|
+
fact_text: string;
|
|
134
|
+
reference: string;
|
|
135
|
+
}[];
|
|
136
|
+
bloom_level: number;
|
|
137
|
+
} | {
|
|
138
|
+
type: string;
|
|
139
|
+
card_content: {
|
|
140
|
+
prompt: string;
|
|
141
|
+
options: {
|
|
142
|
+
option: string;
|
|
143
|
+
cloze: string;
|
|
144
|
+
}[];
|
|
145
|
+
choices?: undefined;
|
|
146
|
+
};
|
|
147
|
+
concepts: {
|
|
148
|
+
concept_text: string;
|
|
149
|
+
reference: string;
|
|
150
|
+
}[];
|
|
151
|
+
facts: {
|
|
152
|
+
fact_text: string;
|
|
153
|
+
reference: string;
|
|
154
|
+
}[];
|
|
155
|
+
bloom_level: number;
|
|
156
|
+
} | {
|
|
157
|
+
type: string;
|
|
158
|
+
card_content: {
|
|
159
|
+
left_item: string;
|
|
160
|
+
right_item: string[];
|
|
161
|
+
}[];
|
|
162
|
+
concepts: {
|
|
163
|
+
concept_text: string;
|
|
164
|
+
reference: string;
|
|
165
|
+
}[];
|
|
166
|
+
facts: never[];
|
|
167
|
+
bloom_level: number;
|
|
168
|
+
})[];
|
|
169
|
+
};
|
|
170
|
+
generated_at: string;
|
|
171
|
+
};
|
|
@@ -609,7 +609,7 @@ const sourceContent = {
|
|
|
609
609
|
headings: headings,
|
|
610
610
|
content: sourceString,
|
|
611
611
|
fields: returnFields(),
|
|
612
|
-
taxonomy:
|
|
612
|
+
// taxonomy: null,
|
|
613
613
|
};
|
|
614
614
|
function returnSourceData() {
|
|
615
615
|
return sourceContent;
|
|
@@ -971,3 +971,4 @@ let cardResponse = {
|
|
|
971
971
|
},
|
|
972
972
|
generated_at: "2024-09-11T08:26:12.000Z",
|
|
973
973
|
};
|
|
974
|
+
//# sourceMappingURL=source_data.js.map
|