only_ever_generator 1.0.7 → 1.0.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 +29 -6
- package/dist/bootstrap/app.d.ts.map +1 -1
- package/dist/bootstrap/app.js +82 -19
- 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/consolidation/local_consolidation.d.ts.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/helper/openai_helper.d.ts +12 -0
- package/dist/helper/openai_helper.d.ts.map +1 -0
- package/dist/helper/openai_helper.js +26 -0
- package/dist/helper/openai_helper.js.map +1 -0
- package/dist/helper/qdrant_db_methods.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +923 -87
- 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_concept_facts.d.ts +18 -0
- package/dist/typology_gen/generate_concept_facts.d.ts.map +1 -0
- package/dist/typology_gen/generate_concept_facts.js +48 -0
- package/dist/typology_gen/generate_concept_facts.js.map +1 -0
- package/dist/typology_gen/generate_typology.d.ts +9 -3
- package/dist/typology_gen/generate_typology.d.ts.map +1 -1
- package/dist/typology_gen/generate_typology.js +43 -31
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/package.json +9 -9
- package/src/bootstrap/app.ts +129 -29
- 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/helper/openai_helper.ts +31 -0
- package/src/index.ts +947 -101
- 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_concept_facts.ts +54 -0
- package/src/typology_gen/generate_typology.ts +59 -36
- 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_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,OAAO;QAEP,qBAAgB,GAAG;YACjB,UAAU;YACV,YAAY;YACZ,iBAAiB;YACjB,gBAAgB;YAChB,sBAAsB;YACtB,cAAc;YACd,OAAO;YACP,eAAe;SAChB,CAAC;QACF,yBAAoB,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAE7C,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC;IAC/B,CAAC;IAED,SAAS;QAQP,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QACnC,IAAI,cAAc,CAAC;QACnB,IAAI,UAAU,IAAI,OAAO,EAAE,CAAC;YAC1B,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACN,IAAI,+BAA+B,GAAG,IAAI,CAAC,qBAAqB,CAC9D,IAAI,CAAC,OAAO,CAAC,OAAO,CACrB,CAAC;YACF,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,+BAA+B,CAAC,CAAC;QACxE,CAAC;QACD,OAAO;YACL,SAAS,EA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AI,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":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenAIHelper } from "../helper/openai_helper";
|
|
2
|
+
import { OpenAiService } from "../services/open_ai_service";
|
|
3
|
+
export declare class GenerateConceptFacts {
|
|
4
|
+
openAiService: OpenAiService;
|
|
5
|
+
openAIHelper: OpenAIHelper;
|
|
6
|
+
content: string;
|
|
7
|
+
type: string;
|
|
8
|
+
promptForConceptFacts: {
|
|
9
|
+
promptId: string;
|
|
10
|
+
version: string;
|
|
11
|
+
};
|
|
12
|
+
constructor(openAiService: OpenAiService, content: string, type: string, promptForConceptFacts: {
|
|
13
|
+
promptId: string;
|
|
14
|
+
version: string;
|
|
15
|
+
});
|
|
16
|
+
generate(): Promise<any>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=generate_concept_facts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate_concept_facts.d.ts","sourceRoot":"","sources":["../../src/typology_gen/generate_concept_facts.ts"],"names":[],"mappings":"AAAA,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,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAM;IAClB,qBAAqB,EAAE;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAGC;gBAEA,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,qBAAqB,EAAE;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB;IAcG,QAAQ;CAiBf"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GenerateConceptFacts = void 0;
|
|
13
|
+
const openai_helper_1 = require("../helper/openai_helper");
|
|
14
|
+
class GenerateConceptFacts {
|
|
15
|
+
constructor(openAiService, content, type, promptForConceptFacts) {
|
|
16
|
+
this.type = "";
|
|
17
|
+
this.promptForConceptFacts = {
|
|
18
|
+
promptId: "",
|
|
19
|
+
version: "",
|
|
20
|
+
};
|
|
21
|
+
this.openAiService = openAiService;
|
|
22
|
+
this.openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key, this.openAiService.model, this.promptForConceptFacts.promptId, this.promptForConceptFacts.version);
|
|
23
|
+
this.content = content;
|
|
24
|
+
this.promptForConceptFacts = promptForConceptFacts;
|
|
25
|
+
this.type = type;
|
|
26
|
+
}
|
|
27
|
+
generate() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
console.log(this.promptForConceptFacts);
|
|
30
|
+
const openAiResponse = yield this.openAIHelper.openAI.responses.create({
|
|
31
|
+
model: this.openAIHelper.model,
|
|
32
|
+
prompt: {
|
|
33
|
+
id: this.promptForConceptFacts.promptId,
|
|
34
|
+
version: this.promptForConceptFacts.version,
|
|
35
|
+
variables: {
|
|
36
|
+
heading_type: this.type == "video" ? "timecode" : "h1 heading",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
input: this.content,
|
|
40
|
+
store: false,
|
|
41
|
+
});
|
|
42
|
+
console.log(openAiResponse.output_text);
|
|
43
|
+
return JSON.parse(openAiResponse.output_text);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.GenerateConceptFacts = GenerateConceptFacts;
|
|
48
|
+
//# sourceMappingURL=generate_concept_facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate_concept_fac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AAC,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YACxC,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC;KAAA;CACF;AAlDD,oDAkDC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { OpenAiService } from "../services/open_ai_service";
|
|
2
2
|
export declare class GenerateTypology {
|
|
3
3
|
openAiService: OpenAiService;
|
|
4
|
-
|
|
4
|
+
type: string;
|
|
5
5
|
content: string;
|
|
6
|
+
promptForTypology: {
|
|
7
|
+
promptId: string;
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
6
10
|
expectedFields: Array<string>;
|
|
7
|
-
constructor(openAiService: OpenAiService,
|
|
11
|
+
constructor(openAiService: OpenAiService, type: string, content: string, expected_fields: Array<string>, promptForTypology: {
|
|
12
|
+
promptId: string;
|
|
13
|
+
version: string;
|
|
14
|
+
});
|
|
8
15
|
generate(): Promise<any>;
|
|
9
16
|
parseTypologyOnSuccess(responseData: any): {
|
|
10
17
|
status_code: number;
|
|
@@ -13,7 +20,6 @@ export declare class GenerateTypology {
|
|
|
13
20
|
[x: string]: string | boolean;
|
|
14
21
|
reconcile: boolean;
|
|
15
22
|
}[];
|
|
16
|
-
concepts_facts: any[];
|
|
17
23
|
generate_cards: any;
|
|
18
24
|
summary_cards: any;
|
|
19
25
|
};
|
|
@@ -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":"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,iBAAiB,EAAE;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAGC;IACF,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,iBAAiB,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB;IAUG,QAAQ;IA4Dd,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;;;;;;;IAexC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;;;;IAQ3B,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;CAQ/C"}
|
|
@@ -10,42 +10,69 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GenerateTypology = void 0;
|
|
13
|
+
const openai_helper_1 = require("../helper/openai_helper");
|
|
13
14
|
const logger_1 = require("../logger");
|
|
14
15
|
class GenerateTypology {
|
|
15
|
-
constructor(openAiService,
|
|
16
|
-
this.
|
|
16
|
+
constructor(openAiService, type, content, expected_fields, promptForTypology) {
|
|
17
|
+
this.type = "";
|
|
17
18
|
this.content = "";
|
|
19
|
+
this.promptForTypology = {
|
|
20
|
+
promptId: "",
|
|
21
|
+
version: "",
|
|
22
|
+
};
|
|
18
23
|
this.openAiService = openAiService;
|
|
19
|
-
this.
|
|
24
|
+
this.type = type;
|
|
20
25
|
this.content = content;
|
|
21
26
|
this.expectedFields = expected_fields.map((elem) => elem.toLowerCase());
|
|
27
|
+
this.promptForTypology = promptForTypology;
|
|
22
28
|
}
|
|
23
29
|
generate() {
|
|
24
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
31
|
var _a, _b, _c, _d, _e;
|
|
26
32
|
try {
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
// Use OpenAI Responses API
|
|
34
|
+
const openAIHelper = new openai_helper_1.OpenAIHelper(this.openAiService.api_key, this.openAiService.model, this.promptForTypology.promptId, this.promptForTypology.version);
|
|
35
|
+
const openAiResponse = yield openAIHelper.openAI.responses.create({
|
|
36
|
+
model: openAIHelper.model,
|
|
37
|
+
prompt: {
|
|
38
|
+
id: openAIHelper.promptId,
|
|
39
|
+
version: openAIHelper.version,
|
|
40
|
+
variables: {
|
|
41
|
+
heading_type: this.type == "video" ? "timecode" : "h1 heading",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
input: this.content,
|
|
45
|
+
store: false,
|
|
46
|
+
});
|
|
47
|
+
console.log(openAiResponse);
|
|
48
|
+
// const response = await this.openAiService?.sendRequest(
|
|
49
|
+
// this.prompt,
|
|
50
|
+
// this.content
|
|
51
|
+
// );
|
|
52
|
+
openAiResponse["request_type"] = {
|
|
29
53
|
type: "breadth",
|
|
30
54
|
n: 1,
|
|
31
55
|
};
|
|
32
|
-
|
|
33
|
-
req_time: (
|
|
56
|
+
openAiResponse.metadata = {
|
|
57
|
+
req_time: (_a = openAiResponse.created) !== null && _a !== void 0 ? _a : new Date(),
|
|
34
58
|
req_type: {
|
|
35
59
|
type: "breadth",
|
|
36
60
|
n: 1,
|
|
37
61
|
},
|
|
38
|
-
req_tokens: (_c =
|
|
39
|
-
res_tokens: (_d =
|
|
40
|
-
|
|
62
|
+
req_tokens: (_c = (_b = openAiResponse.usage) === null || _b === void 0 ? void 0 : _b.input_tokens) !== null && _c !== void 0 ? _c : 0,
|
|
63
|
+
res_tokens: (_e = (_d = openAiResponse.usage) === null || _d === void 0 ? void 0 : _d.output_tokens) !== null && _e !== void 0 ? _e : 0,
|
|
64
|
+
prompt: openAiResponse.prompt,
|
|
65
|
+
// prompt_tokens_details: openAiResponse.usage?.,
|
|
41
66
|
model: this.openAiService.model,
|
|
67
|
+
usage: openAiResponse.usage,
|
|
42
68
|
};
|
|
43
|
-
if (
|
|
44
|
-
|
|
69
|
+
if (openAiResponse.status == "completed") {
|
|
70
|
+
console.log("Completed");
|
|
71
|
+
return this.parseTypologyOnSuccess(openAiResponse);
|
|
45
72
|
}
|
|
46
73
|
else {
|
|
47
|
-
|
|
48
|
-
return
|
|
74
|
+
openAiResponse.metadata.err_message = openAiResponse.message;
|
|
75
|
+
return openAiResponse;
|
|
49
76
|
}
|
|
50
77
|
}
|
|
51
78
|
catch (e) {
|
|
@@ -58,27 +85,12 @@ class GenerateTypology {
|
|
|
58
85
|
}
|
|
59
86
|
parseTypologyOnSuccess(responseData) {
|
|
60
87
|
responseData.metadata.status = "completed";
|
|
61
|
-
const generatedContent = responseData.
|
|
62
|
-
const concepts = generatedContent.concepts.map((e) => {
|
|
63
|
-
return {
|
|
64
|
-
text: e.concept_text,
|
|
65
|
-
type: "concept",
|
|
66
|
-
reference: e.reference,
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
const facts = generatedContent.facts.map((e) => {
|
|
70
|
-
return {
|
|
71
|
-
text: e.fact_text,
|
|
72
|
-
type: "fact",
|
|
73
|
-
reference: e.reference,
|
|
74
|
-
};
|
|
75
|
-
});
|
|
88
|
+
const generatedContent = JSON.parse(responseData.output_text);
|
|
76
89
|
return {
|
|
77
90
|
status_code: 200,
|
|
78
91
|
metadata: [responseData.metadata],
|
|
79
92
|
field: this.parseFields(generatedContent.field),
|
|
80
|
-
|
|
81
|
-
generate_cards: generatedContent.generate_cards,
|
|
93
|
+
generate_cards: generatedContent.learn_value,
|
|
82
94
|
summary_cards: generatedContent.summary_cards,
|
|
83
95
|
// type: responseData.type,
|
|
84
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"generate_typology.js","sourceRoot":"","sources":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
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -8,23 +8,23 @@
|
|
|
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
|
-
"@types/express": "^4.17.21",
|
|
18
17
|
"@types/node": "^22.15.3",
|
|
19
|
-
"dotenv": "^16.
|
|
20
|
-
"
|
|
21
|
-
"nodemon": "^3.1.3",
|
|
18
|
+
"dotenv": "^16.5.0",
|
|
19
|
+
"nodemon": "^3.1.10",
|
|
22
20
|
"ts-node": "^10.9.2",
|
|
23
|
-
"typescript": "^5.
|
|
21
|
+
"typescript": "^5.8.3"
|
|
24
22
|
},
|
|
25
23
|
"dependencies": {
|
|
26
24
|
"@qdrant/js-client-rest": "^1.14.0",
|
|
27
|
-
"axios": "^1.
|
|
25
|
+
"axios": "^1.9.0",
|
|
26
|
+
"n": "^10.1.0",
|
|
27
|
+
"openai": "^5.10.2",
|
|
28
28
|
"stable": "^0.1.8"
|
|
29
29
|
},
|
|
30
30
|
"eslintConfig": {
|