only_ever_generator 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap/app.d.ts +12 -5
- package/dist/bootstrap/app.d.ts.map +1 -1
- package/dist/bootstrap/app.js +41 -15
- 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 +21 -4
- package/dist/card_gen/generate_cards.js.map +1 -1
- package/dist/constants/prompt_data.d.ts +0 -1
- package/dist/constants/prompts/card_gen_prompt.js.map +1 -1
- package/dist/constants/source_data.d.ts +0 -2
- package/dist/constants/source_data.js +1 -1
- package/dist/constants/source_data.js.map +1 -1
- package/dist/embedding_generation/consolidation/global_consolidation.d.ts +1 -1
- package/dist/embedding_generation/consolidation/global_consolidation.d.ts.map +1 -1
- package/dist/embedding_generation/consolidation/global_consolidation.js +1 -1
- package/dist/embedding_generation/consolidation/global_consolidation.js.map +1 -1
- package/dist/embedding_generation/local_consolidation.js +104 -0
- package/dist/enums/card_type_enum.d.ts +7 -0
- package/dist/enums/card_type_enum.d.ts.map +1 -0
- package/dist/enums/card_type_enum.js +11 -0
- package/dist/enums/card_type_enum.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -91
- package/dist/index.js.map +1 -1
- package/dist/parse/parse_card/parse_cloze_card.d.ts +8 -1
- package/dist/parse/parse_card/parse_cloze_card.d.ts.map +1 -1
- package/dist/parse/parse_card/parse_cloze_card.js +2 -2
- package/dist/parse/parse_card/parse_cloze_card.js.map +1 -1
- package/dist/parse/parse_card/parse_flash_cards.d.ts +14 -7
- package/dist/parse/parse_card/parse_flash_cards.d.ts.map +1 -1
- package/dist/parse/parse_card/parse_flash_cards.js +3 -3
- package/dist/parse/parse_card/parse_flash_cards.js.map +1 -1
- package/dist/parse/parse_card/parse_match_card.d.ts +8 -1
- package/dist/parse/parse_card/parse_match_card.d.ts.map +1 -1
- package/dist/parse/parse_card/parse_match_card.js +2 -3
- package/dist/parse/parse_card/parse_match_card.js.map +1 -1
- package/dist/parse/parse_card/parse_mcq_card.d.ts +15 -8
- package/dist/parse/parse_card/parse_mcq_card.d.ts.map +1 -1
- package/dist/parse/parse_card/parse_mcq_card.js +2 -2
- package/dist/parse/parse_card/parse_mcq_card.js.map +1 -1
- package/dist/parse/parse_card_response.d.ts +12 -10
- package/dist/parse/parse_card_response.d.ts.map +1 -1
- package/dist/parse/parse_card_response.js +121 -54
- package/dist/parse/parse_card_response.js.map +1 -1
- package/dist/parse/parse_source_content.d.ts +7 -5
- package/dist/parse/parse_source_content.d.ts.map +1 -1
- package/dist/parse/parse_source_content.js +1 -0
- package/dist/parse/parse_source_content.js.map +1 -1
- package/dist/parse/response_format_card.d.ts +0 -1
- package/dist/parse/response_format_typology.d.ts +0 -1
- package/dist/types/base_param_type.d.ts +17 -0
- package/dist/types/base_param_type.d.ts.map +1 -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 +12 -0
- package/dist/types/mongo_concept_fact_type.d.ts.map +1 -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 +12 -0
- package/dist/types/parsed_card_type.d.ts.map +1 -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 +40 -0
- package/dist/types/raw_card_response_types/generated_card_response_type.d.ts.map +1 -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 +15 -0
- package/dist/types/source_taxonomy_type.d.ts.map +1 -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.map +1 -1
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/package.json +10 -9
- package/src/bootstrap/app.ts +63 -22
- package/src/card_gen/generate_cards.ts +27 -5
- package/src/constants/prompts/card_gen_prompt.ts +1 -1
- package/src/embedding_generation/consolidation/global_consolidation.ts +2 -2
- package/src/enums/card_type_enum.ts +6 -0
- package/src/index.ts +4 -110
- 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 -20
- package/src/parse/parse_source_content.ts +11 -1
- package/src/types/base_param_type.ts +17 -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 +1 -2
- package/.env.example +0 -1
- package/dist/constants/prompt_data.d.ts.map +0 -1
- package/dist/constants/source_data.d.ts.map +0 -1
- package/dist/parse/response_format_card.d.ts.map +0 -1
- package/dist/parse/response_format_typology.d.ts.map +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/parse/response_format_card.ts +0 -386
- package/src/parse/response_format_typology.ts +0 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_card_response.js","sourceRoot":"","sources":["../../src/parse/parse_card_response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse_card_response.js","sourceRoot":"","sources":["../../src/parse/parse_card_response.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAwC;AACxC,oEAA+D;AAC/D,sEAAgE;AAChE,oEAA+D;AAC/D,gEAA2D;AAe3D,MAAa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AAY,EAAE,CAAC;YACvC,MAAM,cAAc,GAAG,mBAAmB,CAAC,IAAI,CAC7C,CAAC,CAAM,EAAE,EAAE,CACT,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CACvE,CAAC;YACF,IAAI,cAAc,EAAE,CAAC;gBACnB,mBAAmB,CAAC,IAAI,CAAC;oBACvB,EAAE,EAAE,cAAc,CAAC,EAAE;oBACrB,IAAI,EAAE,cAAc,CAAC,IAAI;oBACzB,IAAI,EAAE,cAAc,CAAC,IAAI;iBAC1B,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CACF;AA3KD,8CA2KC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { SourceTaxonomy } from "../types/source_taxonomy_type";
|
|
1
2
|
export declare class ParseSourceContent {
|
|
2
3
|
content: any;
|
|
3
4
|
titles_to_remove: string[];
|
|
4
5
|
block_types_toremove: string[];
|
|
5
6
|
constructor(sourceContent: any);
|
|
6
7
|
parseData(): {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
source_id: string;
|
|
9
|
+
type: string;
|
|
10
|
+
title: string;
|
|
11
|
+
content: any[];
|
|
12
|
+
headings: string[];
|
|
13
|
+
taxonomy: SourceTaxonomy;
|
|
12
14
|
};
|
|
13
15
|
removeSectionsByTitle(data: Array<any>): any[];
|
|
14
16
|
sanitizeTextContent(content: String): String;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_source_content.d.ts","sourceRoot":"","sources":["../../src/parse/parse_source_content.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAkB;IACtB,OAAO,EAAE,GAAG,CAAC;IAWpB,gBAAgB,WASd;IACF,oBAAoB,WAA2B;gBACnC,aAAa,EAAE,GAAG;IAI9B,SAAS
|
|
1
|
+
{"version":3,"file":"parse_source_content.d.ts","sourceRoot":"","sources":["../../src/parse/parse_source_content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,qBAAa,kBAAkB;IACtB,OAAO,EAAE,GAAG,CAAC;IAWpB,gBAAgB,WASd;IACF,oBAAoB,WAA2B;gBACnC,aAAa,EAAE,GAAG;IAI9B,SAAS,IAAI;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,GAAG,EAAE,CAAC;QACf,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,QAAQ,EAAE,cAAc,CAAC;KAC1B;IAqBD,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAqBtC,mBAAmB,CAAC,OAAO,EAAE,MAAM;IAmBnC,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;IAoBjC,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAiBlC,WAAW,CAAC,OAAO,EAAE,MAAM;IAM3B,eAAe,CAAC,IAAI,EAAE,GAAG;IAiBzB,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,SAAO;;;;;CAsDvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_source_content.js","sourceRoot":"","sources":["../../src/parse/parse_source_content.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"parse_source_content.js","sourceRoot":"","sources":["../../src/parse/parse_source_content.ts"],"names":[],"mappings":";;;AAEA,MAAa,kBAAkB;IAuB7B,YAAY,aAAkB;QArB9B,qBAAqB;QACrB,aAAa;QACb,2BAA2B;QAC3B,iCAAiC;QACjC,+BAA+B;QAC/B,sBAAsB;QACtB,wCAAwC;QACxC,+BAA+B;QAC/B,OAA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5B,cAAc,IAAI,aAAa,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,2CAA2C;gBAC3C,MAAM,cAAc,GAAG;oBACrB,UAAU,EAAE,eAAe;oBAC3B,QAAQ,EAAE,aAAa;oBACvB,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC;iBACjC,CAAC;gBACF,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBAEnC,sCAAsC;gBACtC,eAAe,GAAG,SAAS,CAAC;gBAC5B,aAAa,GAAG,OAAO,CAAC;gBACxB,aAAa,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC1B,cAAc,GAAG,aAAa,CAAC;YACjC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,mCAAmC;QACnC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,cAAc,GAAG;gBACrB,UAAU,EAAE,eAAe;gBAC3B,QAAQ,EAAE,aAAa;gBACvB,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC;aACjC,CAAC;YACF,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAjND,gDAiNC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SourceTaxonomy } from "./source_taxonomy_type";
|
|
2
|
+
export type BaseParamType = {
|
|
3
|
+
prompt: {
|
|
4
|
+
typology: string;
|
|
5
|
+
card_generation: string;
|
|
6
|
+
};
|
|
7
|
+
content: {
|
|
8
|
+
source_id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
headings: string[];
|
|
11
|
+
content: any[];
|
|
12
|
+
fields: string[];
|
|
13
|
+
taxonomy?: SourceTaxonomy;
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=base_param_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base_param_type.d.ts","sourceRoot":"","sources":["../../src/types/base_param_type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC;QACf,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,QAAQ,CAAC,EAAE,cAAc,CAAC;QAC1B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base_param_type.js","sourceRoot":"","sources":["../../src/types/base_param_type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type MongoConceptFactSource = {
|
|
2
|
+
text: string;
|
|
3
|
+
type: "concept" | "fact";
|
|
4
|
+
reference: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
export type MongoConceptFactCards = {
|
|
8
|
+
text: string;
|
|
9
|
+
type: "concept" | "fact";
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=mongo_concept_fact_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo_concept_fact_type.d.ts","sourceRoot":"","sources":["../../src/types/mongo_concept_fact_type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo_concept_fact_type.js","sourceRoot":"","sources":["../../src/types/mongo_concept_fact_type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsed_card_type.d.ts","sourceRoot":"","sources":["../../src/types/parsed_card_type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,GAAG,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// {
|
|
4
|
+
// "type": {
|
|
5
|
+
// "category": "learning",
|
|
6
|
+
// "sub_type": "cloze"
|
|
7
|
+
// },
|
|
8
|
+
// "heading": "",
|
|
9
|
+
// "displayTitle": "Ink is a medium that consists of colorants and other {{components}}. ---- components, elements, substances",
|
|
10
|
+
// "content": {
|
|
11
|
+
// "question": "Ink is a medium that consists of colorants and other {{c0:components}}.",
|
|
12
|
+
// "options": [
|
|
13
|
+
// {
|
|
14
|
+
// "option": "components",
|
|
15
|
+
// "cloze": "c0"
|
|
16
|
+
// },
|
|
17
|
+
// {
|
|
18
|
+
// "option": "elements",
|
|
19
|
+
// "cloze": "null"
|
|
20
|
+
// },
|
|
21
|
+
// {
|
|
22
|
+
// "option": "substances",
|
|
23
|
+
// "cloze": "null"
|
|
24
|
+
// }
|
|
25
|
+
// ]
|
|
26
|
+
// },
|
|
27
|
+
// "explanation": "Ink contains various components that include colorants, solvents, and additives which determine its properties.",
|
|
28
|
+
// "bloom_level": 1
|
|
29
|
+
// },
|
|
30
|
+
//# sourceMappingURL=parsed_card_type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsed_card_type.js","sourceRoot":"","sources":["../../src/types/parsed_card_type.ts"],"names":[],"mappings":";;AAYA,IAAI;AACJ,gBAAgB;AAChB,gCAAgC;AAChC,4BAA4B;AAC5B,SAAS;AACT,qBAAqB;AACrB,oIAAoI;AACpI,mBAAmB;AACnB,+FAA+F;AAC/F,qBAAqB;AACrB,YAAY;AACZ,oCAAoC;AACpC,0BAA0B;AAC1B,aAAa;AACb,YAAY;AACZ,kCAAkC;AAClC,4BAA4B;AAC5B,aAAa;AACb,YAAY;AACZ,oCAAoC;AACpC,4BAA4B;AAC5B,YAAY;AACZ,UAAU;AACV,SAAS;AACT,wIAAwI;AACxI,uBAAuB;AACvB,OAAO"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type GeneratedCardResponseType = {
|
|
2
|
+
metadata: any;
|
|
3
|
+
generated_content: {
|
|
4
|
+
test_cards: RawTestCardResponseType[];
|
|
5
|
+
};
|
|
6
|
+
status_code: number;
|
|
7
|
+
usage_data: any;
|
|
8
|
+
generated_at: Date;
|
|
9
|
+
};
|
|
10
|
+
export type RawTestCardResponseType = {
|
|
11
|
+
type: string;
|
|
12
|
+
card_content: RawFlashCardResponseType | RawMatchCardResponseType | RawClozeCardResponseType | RawMcqCardResponseType;
|
|
13
|
+
concepts: string[];
|
|
14
|
+
facts: string[];
|
|
15
|
+
bloom_level: number;
|
|
16
|
+
};
|
|
17
|
+
export type RawFlashCardResponseType = {
|
|
18
|
+
front: string;
|
|
19
|
+
back: string;
|
|
20
|
+
explanation?: string;
|
|
21
|
+
};
|
|
22
|
+
export type RawMatchCardResponseType = {
|
|
23
|
+
left_item: string;
|
|
24
|
+
right_item: string;
|
|
25
|
+
}[];
|
|
26
|
+
export type RawClozeCardResponseType = {
|
|
27
|
+
correct_options: string[];
|
|
28
|
+
incorrect_options: string[];
|
|
29
|
+
prompt: string;
|
|
30
|
+
explanation?: string;
|
|
31
|
+
};
|
|
32
|
+
export type RawMcqCardResponseType = {
|
|
33
|
+
prompt: string;
|
|
34
|
+
explanation?: string;
|
|
35
|
+
choices: {
|
|
36
|
+
choice: string;
|
|
37
|
+
is_correct: boolean;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=generated_card_response_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated_card_response_type.d.ts","sourceRoot":"","sources":["../../../src/types/raw_card_response_types/generated_card_response_type.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,GAAG,CAAC;IACd,iBAAiB,EAAE;QACjB,UAAU,EAAE,uBAAuB,EAAE,CAAC;KACvC,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,GAAG,CAAC;IAChB,YAAY,EAAE,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IAMb,YAAY,EACR,wBAAwB,GACxB,wBAAwB,GACxB,wBAAwB,GACxB,sBAAsB,CAAC;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,EAAE,CAAC;AAEJ,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,OAAO,CAAC;KACrB,EAAE,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated_card_response_type.js","sourceRoot":"","sources":["../../../src/types/raw_card_response_types/generated_card_response_type.ts"],"names":[],"mappings":";;AAwDA,EAAE;AACF,YAAY;AACZ,WAAW;AACX,UAAU;AACV,QAAQ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type SourceTaxonomy = {
|
|
2
|
+
concepts_facts: {
|
|
3
|
+
text: string;
|
|
4
|
+
type: string;
|
|
5
|
+
embedding?: number[];
|
|
6
|
+
reference: string;
|
|
7
|
+
}[];
|
|
8
|
+
fields: string[];
|
|
9
|
+
metadata?: any[];
|
|
10
|
+
generate_cards: {
|
|
11
|
+
state: boolean;
|
|
12
|
+
reason: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=source_taxonomy_type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source_taxonomy_type.d.ts","sourceRoot":"","sources":["../../src/types/source_taxonomy_type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QAEb,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;IACJ,MAAM,EAAE,MAAM,EAAE,CAAC;IAGjB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,cAAc,EAAE;QACd,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source_taxonomy_type.js","sourceRoot":"","sources":["../../src/types/source_taxonomy_type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate_typology.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBAAa,gBAAgB;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAM;IACpB,OAAO,EAAE,MAAM,CAAM;IAC5B,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAE5B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC;IAS1B,QAAQ;IAmCd,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;;;;;;;;IA6BxC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;;;;IAQ3B,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;CAQ/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"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;YACvC,cAAc,EAAE,gBAAgB,CAAC,cAAc;YAC/C,aAAa,EAAE,gBAAgB,CAAC,aAAa;YAC7C,2BAA2B;SAC5B,CAAC;IACJ,CAAC;IAED,WAAW,CAAC,MAAqB;QAC/B,MAAM,SAAS,GAAG,CAAC,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QACzE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;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;AAlGD,4CAkGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "only_ever_generator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -8,23 +8,24 @@
|
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
10
|
"example": "npm run build && nodemon dist/index.js"
|
|
11
|
-
|
|
12
11
|
},
|
|
13
12
|
"keywords": [],
|
|
14
|
-
"author": "
|
|
13
|
+
"author": "",
|
|
15
14
|
"license": "ISC",
|
|
15
|
+
"description": "",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
"@types/node": "^22.15.3",
|
|
19
|
-
"dotenv": "^16.
|
|
20
|
-
|
|
21
|
-
"nodemon": "^3.1.
|
|
19
|
+
"dotenv": "^16.5.0",
|
|
20
|
+
|
|
21
|
+
"nodemon": "^3.1.10",
|
|
22
22
|
"ts-node": "^10.9.2",
|
|
23
|
-
"typescript": "^5.
|
|
23
|
+
"typescript": "^5.8.3"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@qdrant/js-client-rest": "^1.14.0",
|
|
27
|
-
"axios": "^1.
|
|
27
|
+
"axios": "^1.9.0",
|
|
28
|
+
"n": "^10.1.0",
|
|
28
29
|
"stable": "^0.1.8"
|
|
29
30
|
},
|
|
30
31
|
"eslintConfig": {
|
package/src/bootstrap/app.ts
CHANGED
|
@@ -7,23 +7,30 @@ import { GenerateEmbeddings } from "../embedding_generation/generate_embeddings"
|
|
|
7
7
|
import { LocalConsolidation } from "../embedding_generation/consolidation/local_consolidation";
|
|
8
8
|
import { GlobalConsolidation } from "../embedding_generation/consolidation/global_consolidation";
|
|
9
9
|
import { WriteConsolidatedData } from "../embedding_generation/consolidation/write_consolidated_data";
|
|
10
|
+
import { BaseParamType } from "../types/base_param_type";
|
|
11
|
+
import { SourceTaxonomy } from "../types/source_taxonomy_type";
|
|
12
|
+
import { MongoConceptFactSource } from "../types/mongo_concept_fact_type";
|
|
10
13
|
|
|
11
14
|
export class OnlyEverGenerator {
|
|
12
15
|
public api_key: string = "";
|
|
13
16
|
public openAiService: OpenAiService;
|
|
14
17
|
|
|
15
18
|
/// these fields will be populated inside the constructor
|
|
16
|
-
parsedContent
|
|
19
|
+
parsedContent?: {
|
|
20
|
+
title: string;
|
|
21
|
+
headings: string[];
|
|
22
|
+
content: any[];
|
|
23
|
+
taxonomy: SourceTaxonomy;
|
|
24
|
+
source_id: string;
|
|
25
|
+
} = undefined;
|
|
17
26
|
promptForTypology: string = "";
|
|
18
27
|
promptForCardGen: string = "";
|
|
19
|
-
expectedFields: Array<string
|
|
20
|
-
|
|
21
|
-
typologyResponse: any = undefined;
|
|
28
|
+
expectedFields: Array<string> = [];
|
|
29
|
+
typologyResponse?: any = undefined;
|
|
22
30
|
cardgenResponse: any = undefined;
|
|
23
31
|
summarizeResponse = {};
|
|
24
|
-
gapFillResponse: any = {};
|
|
25
32
|
|
|
26
|
-
constructor(apiKey: string, model: string, generationContent:
|
|
33
|
+
constructor(apiKey: string, model: string, generationContent: BaseParamType) {
|
|
27
34
|
this.api_key = apiKey;
|
|
28
35
|
this.openAiService = new OpenAiService(
|
|
29
36
|
apiKey,
|
|
@@ -37,6 +44,7 @@ export class OnlyEverGenerator {
|
|
|
37
44
|
headings: parsedData.headings,
|
|
38
45
|
content: parsedData.content,
|
|
39
46
|
taxonomy: parsedData.taxonomy,
|
|
47
|
+
source_id: parsedData.source_id,
|
|
40
48
|
}),
|
|
41
49
|
(this.typologyResponse = generationContent.content.taxonomy);
|
|
42
50
|
|
|
@@ -58,22 +66,60 @@ export class OnlyEverGenerator {
|
|
|
58
66
|
this.promptForTypology
|
|
59
67
|
);
|
|
60
68
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
if (this.typologyResponse?.status_code == 200) {
|
|
70
|
+
const embeddings = await this.generateEmbeddings(
|
|
71
|
+
this.typologyResponse
|
|
72
|
+
);
|
|
73
|
+
console.log("Embedding generated");
|
|
74
|
+
const localConsolidation = await this.localConsolidation(
|
|
75
|
+
embeddings.concepts_facts,
|
|
76
|
+
this.parsedContent!.title
|
|
77
|
+
);
|
|
78
|
+
console.log("Local consolidation done");
|
|
79
|
+
this.typologyResponse!.concepts_facts =
|
|
80
|
+
localConsolidation.sourceTaxonomyOps;
|
|
81
|
+
const globalConsolidation = await this.globalConsolidation(
|
|
82
|
+
localConsolidation.sourceTaxonomyOps,
|
|
83
|
+
this.parsedContent!.source_id,
|
|
84
|
+
0.8
|
|
85
|
+
);
|
|
86
|
+
console.log("Global consolidation done");
|
|
87
|
+
this.typologyResponse!.concepts_facts =
|
|
88
|
+
globalConsolidation.source_taxonomy;
|
|
89
|
+
this.typologyResponse!.metadata?.push(embeddings.metadata);
|
|
90
|
+
responseToReturn.push({
|
|
91
|
+
type: "typology",
|
|
92
|
+
data: this.typologyResponse,
|
|
93
|
+
qdrantOps: {
|
|
94
|
+
update: globalConsolidation.global_updates,
|
|
95
|
+
inserts: globalConsolidation.global_inserts,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
responseToReturn.push({
|
|
100
|
+
type: "typology",
|
|
101
|
+
data: this.typologyResponse,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
65
104
|
} else if (elem == "generate_card") {
|
|
66
105
|
if (this.shouldTheCardBeGeneratedAfterTypologyResponse()) {
|
|
67
|
-
this.parsedContent
|
|
68
|
-
concepts_facts: this.typologyResponse
|
|
69
|
-
|
|
106
|
+
this.parsedContent!.taxonomy = {
|
|
107
|
+
concepts_facts: this.typologyResponse?.concepts_facts ?? [],
|
|
108
|
+
fields: this.expectedFields,
|
|
109
|
+
generate_cards: this.typologyResponse?.generate_cards ?? {
|
|
110
|
+
state: false,
|
|
111
|
+
reason: "",
|
|
112
|
+
},
|
|
70
113
|
};
|
|
71
114
|
this.cardgenResponse = await this.generateCard(
|
|
72
115
|
this.promptForCardGen,
|
|
73
116
|
JSON.stringify(this.typologyResponse),
|
|
74
117
|
false
|
|
75
118
|
);
|
|
76
|
-
responseToReturn.push(
|
|
119
|
+
responseToReturn.push({
|
|
120
|
+
type: "card_gen",
|
|
121
|
+
data: this.cardgenResponse,
|
|
122
|
+
});
|
|
77
123
|
}
|
|
78
124
|
}
|
|
79
125
|
return responseToReturn;
|
|
@@ -99,7 +145,7 @@ export class OnlyEverGenerator {
|
|
|
99
145
|
prompt ?? "",
|
|
100
146
|
JSON.stringify(this.parsedContent) + additionalContent,
|
|
101
147
|
isGapFill,
|
|
102
|
-
this.parsedContent
|
|
148
|
+
this.parsedContent!.taxonomy,
|
|
103
149
|
n
|
|
104
150
|
);
|
|
105
151
|
return generateCardsResp;
|
|
@@ -117,7 +163,7 @@ export class OnlyEverGenerator {
|
|
|
117
163
|
|
|
118
164
|
async generateEmbeddings(typologyResponse: any) {
|
|
119
165
|
const concepts_facts = typologyResponse.concepts_facts;
|
|
120
|
-
const texts = concepts_facts.map((e:
|
|
166
|
+
const texts = concepts_facts.map((e: MongoConceptFactSource) => e.text);
|
|
121
167
|
const embeddings = await new GenerateEmbeddings(
|
|
122
168
|
this.openAiService
|
|
123
169
|
).generateEmbeddings(concepts_facts);
|
|
@@ -156,12 +202,7 @@ export class OnlyEverGenerator {
|
|
|
156
202
|
sourceId,
|
|
157
203
|
threshold ?? 0.8
|
|
158
204
|
);
|
|
159
|
-
|
|
160
|
-
// new WriteConsolidatedData().writeConsolidatedData(
|
|
161
|
-
// embeddings,
|
|
162
|
-
// [],
|
|
163
|
-
// sourceId
|
|
164
|
-
// );
|
|
205
|
+
|
|
165
206
|
return embeddings;
|
|
166
207
|
}
|
|
167
208
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ErrorLogger } from "../logger";
|
|
2
2
|
import { ParseCardResponse } from "../parse/parse_card_response";
|
|
3
3
|
import { OpenAiService } from "../services/open_ai_service";
|
|
4
|
+
import { GeneratedCardResponseType } from "../types/raw_card_response_types/generated_card_response_type";
|
|
5
|
+
import { SourceTaxonomy } from "../types/source_taxonomy_type";
|
|
4
6
|
|
|
5
7
|
export class GenerateCards {
|
|
6
8
|
openAiService: OpenAiService;
|
|
@@ -12,7 +14,7 @@ export class GenerateCards {
|
|
|
12
14
|
prompt: string,
|
|
13
15
|
parsedContent: string,
|
|
14
16
|
isGapFill: boolean,
|
|
15
|
-
taxonomy:
|
|
17
|
+
taxonomy: SourceTaxonomy,
|
|
16
18
|
n: number = 0
|
|
17
19
|
) {
|
|
18
20
|
try {
|
|
@@ -21,8 +23,6 @@ export class GenerateCards {
|
|
|
21
23
|
parsedContent
|
|
22
24
|
);
|
|
23
25
|
var updatedNumber = n + 1;
|
|
24
|
-
// console.log("response to card generation ", response);
|
|
25
|
-
// response["request_type"] = ;
|
|
26
26
|
response.metadata = {
|
|
27
27
|
req_time: response.generated_at ?? new Date(),
|
|
28
28
|
req_type: {
|
|
@@ -35,12 +35,34 @@ export class GenerateCards {
|
|
|
35
35
|
prompt_tokens_details: response.usage_data?.prompt_tokens_details,
|
|
36
36
|
model: this.openAiService.model,
|
|
37
37
|
};
|
|
38
|
+
|
|
38
39
|
if (response.status_code == 200) {
|
|
39
40
|
response.metadata.status = "completed";
|
|
41
|
+
/// map response to generated_content
|
|
42
|
+
const generated_data: GeneratedCardResponseType = {
|
|
43
|
+
metadata: response.metadata,
|
|
44
|
+
generated_content: {
|
|
45
|
+
test_cards: (response.generated_content.test_cards ?? []).map(
|
|
46
|
+
(card: any) => {
|
|
47
|
+
return {
|
|
48
|
+
type: card.type,
|
|
49
|
+
card_content: card.card_content,
|
|
50
|
+
concepts: card.concepts ?? [],
|
|
51
|
+
facts: card.facts ?? [],
|
|
52
|
+
bloom_level: card.bloom_level ?? 1,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
},
|
|
57
|
+
usage_data: response.usage_data,
|
|
58
|
+
generated_at: response.generated_at,
|
|
59
|
+
status_code: response.status_code,
|
|
60
|
+
};
|
|
40
61
|
let parseCard = new ParseCardResponse().parse(
|
|
41
|
-
|
|
62
|
+
generated_data,
|
|
42
63
|
isGapFill,
|
|
43
|
-
taxonomy
|
|
64
|
+
taxonomy,
|
|
65
|
+
1
|
|
44
66
|
);
|
|
45
67
|
return parseCard;
|
|
46
68
|
} else {
|
|
@@ -160,5 +160,5 @@ Once you are done generating the test cards, review the full list of concepts an
|
|
|
160
160
|
Only stop generating test questions once you believe there is sufficient testing material for learners to fully understand the concepts and remember the facts. The same concept or fact can have multiple test cards, so continue creating test cards until you are confident that there are enough for learners to fully grasp the source material.
|
|
161
161
|
`;
|
|
162
162
|
export function returnCardGenPrompt() {
|
|
163
|
-
|
|
163
|
+
return promptString;
|
|
164
164
|
}
|
|
@@ -27,8 +27,8 @@ export class GlobalConsolidation {
|
|
|
27
27
|
|
|
28
28
|
const globalUpdatesOps: {
|
|
29
29
|
id: string;
|
|
30
|
-
vector: number[];
|
|
31
30
|
sourceIdToAdd: string;
|
|
31
|
+
vector: number[];
|
|
32
32
|
currentPayload: {
|
|
33
33
|
_sources: string[];
|
|
34
34
|
text: string;
|
|
@@ -73,8 +73,8 @@ export class GlobalConsolidation {
|
|
|
73
73
|
});
|
|
74
74
|
globalUpdatesOps.push({
|
|
75
75
|
id: consolidatedId.toString(),
|
|
76
|
-
vector: originalConcept.embedding,
|
|
77
76
|
sourceIdToAdd: sourceId,
|
|
77
|
+
vector: originalConcept.embedding,
|
|
78
78
|
currentPayload: {
|
|
79
79
|
// _sources: currentPayload['_sources'] ?? [],
|
|
80
80
|
_sources: (currentPayload?._sources ?? []) as string[],
|