only_ever_generator 8.4.6 → 8.4.7

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.
Files changed (119) hide show
  1. package/dist/bootstrap/app.d.ts +6 -3
  2. package/dist/bootstrap/app.d.ts.map +1 -1
  3. package/dist/bootstrap/app.js +11 -17
  4. package/dist/bootstrap/app.js.map +1 -1
  5. package/dist/card_gen/generate_cards.d.ts +2 -3
  6. package/dist/card_gen/generate_cards.d.ts.map +1 -1
  7. package/dist/card_gen/generate_cards.js +22 -15
  8. package/dist/card_gen/generate_cards.js.map +1 -1
  9. package/dist/constants/prompt_data.d.ts +4 -4
  10. package/dist/constants/prompt_data.js +302 -302
  11. package/dist/constants/prompts/card_gen_prompt.js +160 -160
  12. package/dist/constants/prompts/typology_prompt.js +131 -131
  13. package/dist/constants/source_data.d.ts +171 -171
  14. package/dist/constants/source_data.js +973 -973
  15. package/dist/embedding_generation/local_consolidation.js +104 -104
  16. package/dist/helper/build_concept_facts_schema.d.ts +42 -42
  17. package/dist/helper/build_concept_facts_schema.js +44 -44
  18. package/dist/helper/qdrant_db_methods.d.ts.map +1 -1
  19. package/dist/helper/schema_helper/build_card_schema.d.ts +1 -9
  20. package/dist/helper/schema_helper/build_card_schema.d.ts.map +1 -1
  21. package/dist/helper/schema_helper/build_card_schema.js +47 -50
  22. package/dist/helper/schema_helper/build_card_schema.js.map +1 -1
  23. package/dist/helper/schema_helper/build_concept_facts_schema.d.ts +1 -1
  24. package/dist/helper/schema_helper/build_concept_facts_schema.d.ts.map +1 -1
  25. package/dist/helper/schema_helper/build_concept_facts_schema.js +20 -5
  26. package/dist/helper/schema_helper/build_concept_facts_schema.js.map +1 -1
  27. package/dist/helper/schema_helper/build_summary_schema.d.ts +1 -1
  28. package/dist/helper/schema_helper/build_summary_schema.d.ts.map +1 -1
  29. package/dist/helper/schema_helper/build_summary_schema.js +18 -7
  30. package/dist/helper/schema_helper/build_summary_schema.js.map +1 -1
  31. package/dist/index.d.ts +0 -2
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +10 -9
  34. package/dist/index.js.map +1 -1
  35. package/dist/parse/response_format_card.d.ts +176 -176
  36. package/dist/parse/response_format_card.js +371 -371
  37. package/dist/parse/response_format_typology.d.ts +1 -1
  38. package/dist/parse/response_format_typology.js +46 -46
  39. package/dist/services/get_prompts.d.ts +8 -7
  40. package/dist/services/get_prompts.d.ts.map +1 -1
  41. package/dist/services/get_prompts.js +69 -21
  42. package/dist/services/get_prompts.js.map +1 -1
  43. package/dist/typology_gen/generate_concept_facts.d.ts +2 -3
  44. package/dist/typology_gen/generate_concept_facts.d.ts.map +1 -1
  45. package/dist/typology_gen/generate_concept_facts.js +25 -15
  46. package/dist/typology_gen/generate_concept_facts.js.map +1 -1
  47. package/dist/typology_gen/generate_typology.d.ts +2 -1
  48. package/dist/typology_gen/generate_typology.d.ts.map +1 -1
  49. package/dist/typology_gen/generate_typology.js +24 -13
  50. package/dist/typology_gen/generate_typology.js.map +1 -1
  51. package/dist/typology_gen/summarize.d.ts +2 -3
  52. package/dist/typology_gen/summarize.d.ts.map +1 -1
  53. package/dist/typology_gen/summarize.js +24 -13
  54. package/dist/typology_gen/summarize.js.map +1 -1
  55. package/package.json +39 -38
  56. package/src/bootstrap/app.ts +418 -416
  57. package/src/card_gen/generate_cards.ts +347 -345
  58. package/src/config.ts +11 -11
  59. package/src/constants/api_constants.ts +7 -7
  60. package/src/constants/prompts/card_gen_prompt.ts +164 -164
  61. package/src/constants/prompts/typology_prompt.ts +139 -139
  62. package/src/embedding_generation/consolidation/global_consolidation.ts +96 -96
  63. package/src/embedding_generation/consolidation/local_consolidation.ts +141 -141
  64. package/src/embedding_generation/consolidation/write_consolidated_data.ts +98 -98
  65. package/src/embedding_generation/generate_embeddings.ts +42 -42
  66. package/src/embedding_generation/parse_embedding_response.ts +31 -31
  67. package/src/enums/card_type_enum.ts +6 -6
  68. package/src/gap_fill/calculate_gap_fill.ts +50 -50
  69. package/src/helper/get_id_from_title.ts +33 -33
  70. package/src/helper/mongo_helper.ts +29 -29
  71. package/src/helper/openai_helper.ts +20 -20
  72. package/src/helper/qdrant_db_methods.ts +77 -77
  73. package/src/helper/schema_helper/build_card_schema.ts +74 -98
  74. package/src/helper/schema_helper/build_classify_summarize_schema.ts +43 -43
  75. package/src/helper/schema_helper/build_concept_facts_schema.ts +45 -31
  76. package/src/helper/schema_helper/build_summary_schema.ts +43 -32
  77. package/src/index.ts +71 -73
  78. package/src/logger.ts +65 -65
  79. package/src/parse/parse_card/parse_cloze_card.ts +146 -146
  80. package/src/parse/parse_card/parse_flash_cards.ts +42 -42
  81. package/src/parse/parse_card/parse_match_card.ts +104 -104
  82. package/src/parse/parse_card/parse_mcq_card.ts +114 -114
  83. package/src/parse/parse_card_response.ts +197 -197
  84. package/src/parse/parse_source_content.ts +212 -212
  85. package/src/services/get_prompts.ts +164 -112
  86. package/src/services/open_ai_service.ts +89 -89
  87. package/src/services/qdrant_service.ts +10 -10
  88. package/src/types/base_param_type.ts +13 -13
  89. package/src/types/mongo_concept_fact_type.ts +12 -12
  90. package/src/types/parsed_card_type.ts +39 -39
  91. package/src/types/raw_card_response_types/generated_card_response_type.ts +59 -59
  92. package/src/types/source_taxonomy_type.ts +24 -24
  93. package/src/typology-parsed-response.ts +1932 -1932
  94. package/src/typology_gen/generate_concept_facts.ts +180 -169
  95. package/src/typology_gen/generate_typology.ts +203 -189
  96. package/src/typology_gen/summarize.ts +176 -164
  97. package/src/utils/distributed_quote_restoration.ts +80 -80
  98. package/src/utils/generate_args.ts +29 -29
  99. package/src/utils/parse_openai_response.ts +19 -19
  100. package/src/utils/sanitize_strings.ts +65 -65
  101. package/tsconfig.json +16 -16
  102. package/dist/constants/default_generation_variables.d.ts +0 -3
  103. package/dist/constants/default_generation_variables.d.ts.map +0 -1
  104. package/dist/constants/default_generation_variables.js +0 -580
  105. package/dist/constants/default_generation_variables.js.map +0 -1
  106. package/dist/services/prompts_test.d.ts +0 -10
  107. package/dist/services/prompts_test.d.ts.map +0 -1
  108. package/dist/services/prompts_test.js +0 -227
  109. package/dist/services/prompts_test.js.map +0 -1
  110. package/dist/types/generation_variables_schema.d.ts +0 -14
  111. package/dist/types/generation_variables_schema.d.ts.map +0 -1
  112. package/dist/types/generation_variables_schema.js +0 -3
  113. package/dist/types/generation_variables_schema.js.map +0 -1
  114. package/dist/utils/test.d.ts +0 -2
  115. package/dist/utils/test.d.ts.map +0 -1
  116. package/dist/utils/test.js +0 -5
  117. package/dist/utils/test.js.map +0 -1
  118. package/src/constants/default_generation_variables.ts +0 -624
  119. package/src/types/generation_variables_schema.ts +0 -16
@@ -1,104 +1,104 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocalConsolidation = void 0;
4
- const crypto_1 = require("crypto");
5
- class LocalConsolidation {
6
- constructor() {
7
- this.cosineSimilarity = (a, b) => {
8
- const dotProduct = a.reduce((acc, val, index) => acc + val * b[index], 0);
9
- const magnitudeA = Math.sqrt(a.reduce((acc, val) => acc + val * val, 0));
10
- const magnitudeB = Math.sqrt(b.reduce((acc, val) => acc + val * val, 0));
11
- return dotProduct / (magnitudeA * magnitudeB);
12
- };
13
- }
14
- consolidate(concepts_facts, sourceId) {
15
- try {
16
- const sourceIds = [];
17
- const sourceTaxonomyOps = [];
18
- const globalConceptOps = [];
19
- const consolidatedConcepts = [];
20
- const concepts = concepts_facts.map((e) => {
21
- return {
22
- id: (0, crypto_1.randomUUID)().toString(),
23
- text: e.text,
24
- reference: e.reference,
25
- embedding: e.embedding,
26
- type: e.type,
27
- };
28
- });
29
- const afterConsolidation = this.consolidateSimilarEmbeddings(concepts);
30
- sourceIds.push(JSON.stringify(sourceId));
31
- console.log(afterConsolidation);
32
- for (var concept of afterConsolidation.finalConsolidatedConcepts) {
33
- sourceTaxonomyOps.push({
34
- text: concept.text,
35
- id: concept.id,
36
- embedding: concept.embedding,
37
- type: concept.type,
38
- reference: concept.reference,
39
- });
40
- globalConceptOps.push({
41
- id: concept.id.toString(),
42
- vector: concept.embedding,
43
- payload: {
44
- _sources: [sourceId],
45
- text: concept.text,
46
- },
47
- });
48
- }
49
- consolidatedConcepts.push(...afterConsolidation.consolidatedConcepts);
50
- return {
51
- globalConceptOps: globalConceptOps,
52
- sourceIds: sourceIds,
53
- consolidatedConcepts: consolidatedConcepts,
54
- sourceTaxonomyOps: sourceTaxonomyOps,
55
- };
56
- }
57
- catch (e) {
58
- console.error("Error occurred while converting the parsed array to db operations:", e);
59
- throw e;
60
- }
61
- // const concepts = concepts_facts.map((e) => {
62
- // return {
63
- // id: randomUUID().toString(),
64
- // text: e.text,
65
- // type: e.type,
66
- // embedding: e.embedding,
67
- // };
68
- // });
69
- // const consolidated = this._consolidateSimilarEmbeddings(concepts);
70
- // return consolidated;
71
- }
72
- consolidateSimilarEmbeddings(data, threshold = 0.65) {
73
- const finalConsolidatedConcepts = [];
74
- const visited = new Array(data.length).fill(false);
75
- const consolidatedConcepts = [];
76
- for (let i = 0; i < data.length; i++) {
77
- if (visited[i])
78
- continue;
79
- const group = [data[i]];
80
- visited[i] = true;
81
- for (let j = i + 1; j < data.length; j++) {
82
- if (visited[j])
83
- continue;
84
- const sim = this.cosineSimilarity(data[i].embedding, data[j].embedding);
85
- if (sim > threshold) {
86
- group.push(data[j]);
87
- visited[j] = true;
88
- consolidatedConcepts.push({
89
- concept1: data[i].text,
90
- concept2: data[j].text,
91
- similarity: sim,
92
- });
93
- }
94
- }
95
- // Consolidate the group (e.g., just take the first, or merge)
96
- finalConsolidatedConcepts.push(group[0]); // Or you can customize how to merge
97
- }
98
- return {
99
- finalConsolidatedConcepts: finalConsolidatedConcepts,
100
- consolidatedConcepts: consolidatedConcepts,
101
- };
102
- }
103
- }
104
- exports.LocalConsolidation = LocalConsolidation;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocalConsolidation = void 0;
4
+ const crypto_1 = require("crypto");
5
+ class LocalConsolidation {
6
+ constructor() {
7
+ this.cosineSimilarity = (a, b) => {
8
+ const dotProduct = a.reduce((acc, val, index) => acc + val * b[index], 0);
9
+ const magnitudeA = Math.sqrt(a.reduce((acc, val) => acc + val * val, 0));
10
+ const magnitudeB = Math.sqrt(b.reduce((acc, val) => acc + val * val, 0));
11
+ return dotProduct / (magnitudeA * magnitudeB);
12
+ };
13
+ }
14
+ consolidate(concepts_facts, sourceId) {
15
+ try {
16
+ const sourceIds = [];
17
+ const sourceTaxonomyOps = [];
18
+ const globalConceptOps = [];
19
+ const consolidatedConcepts = [];
20
+ const concepts = concepts_facts.map((e) => {
21
+ return {
22
+ id: (0, crypto_1.randomUUID)().toString(),
23
+ text: e.text,
24
+ reference: e.reference,
25
+ embedding: e.embedding,
26
+ type: e.type,
27
+ };
28
+ });
29
+ const afterConsolidation = this.consolidateSimilarEmbeddings(concepts);
30
+ sourceIds.push(JSON.stringify(sourceId));
31
+ console.log(afterConsolidation);
32
+ for (var concept of afterConsolidation.finalConsolidatedConcepts) {
33
+ sourceTaxonomyOps.push({
34
+ text: concept.text,
35
+ id: concept.id,
36
+ embedding: concept.embedding,
37
+ type: concept.type,
38
+ reference: concept.reference,
39
+ });
40
+ globalConceptOps.push({
41
+ id: concept.id.toString(),
42
+ vector: concept.embedding,
43
+ payload: {
44
+ _sources: [sourceId],
45
+ text: concept.text,
46
+ },
47
+ });
48
+ }
49
+ consolidatedConcepts.push(...afterConsolidation.consolidatedConcepts);
50
+ return {
51
+ globalConceptOps: globalConceptOps,
52
+ sourceIds: sourceIds,
53
+ consolidatedConcepts: consolidatedConcepts,
54
+ sourceTaxonomyOps: sourceTaxonomyOps,
55
+ };
56
+ }
57
+ catch (e) {
58
+ console.error("Error occurred while converting the parsed array to db operations:", e);
59
+ throw e;
60
+ }
61
+ // const concepts = concepts_facts.map((e) => {
62
+ // return {
63
+ // id: randomUUID().toString(),
64
+ // text: e.text,
65
+ // type: e.type,
66
+ // embedding: e.embedding,
67
+ // };
68
+ // });
69
+ // const consolidated = this._consolidateSimilarEmbeddings(concepts);
70
+ // return consolidated;
71
+ }
72
+ consolidateSimilarEmbeddings(data, threshold = 0.65) {
73
+ const finalConsolidatedConcepts = [];
74
+ const visited = new Array(data.length).fill(false);
75
+ const consolidatedConcepts = [];
76
+ for (let i = 0; i < data.length; i++) {
77
+ if (visited[i])
78
+ continue;
79
+ const group = [data[i]];
80
+ visited[i] = true;
81
+ for (let j = i + 1; j < data.length; j++) {
82
+ if (visited[j])
83
+ continue;
84
+ const sim = this.cosineSimilarity(data[i].embedding, data[j].embedding);
85
+ if (sim > threshold) {
86
+ group.push(data[j]);
87
+ visited[j] = true;
88
+ consolidatedConcepts.push({
89
+ concept1: data[i].text,
90
+ concept2: data[j].text,
91
+ similarity: sim,
92
+ });
93
+ }
94
+ }
95
+ // Consolidate the group (e.g., just take the first, or merge)
96
+ finalConsolidatedConcepts.push(group[0]); // Or you can customize how to merge
97
+ }
98
+ return {
99
+ finalConsolidatedConcepts: finalConsolidatedConcepts,
100
+ consolidatedConcepts: consolidatedConcepts,
101
+ };
102
+ }
103
+ }
104
+ exports.LocalConsolidation = LocalConsolidation;
@@ -1,43 +1,43 @@
1
- type ConceptFactType = "concept" | "fact";
2
- interface ConceptFactSchemaItem {
3
- text: {
4
- type: "string";
5
- minLength: number;
6
- maxLength: number;
7
- description: string;
8
- };
9
- type: {
10
- type: "string";
11
- enum: ConceptFactType[];
12
- description: string;
13
- };
14
- reference: {
15
- type: "string";
16
- enum: string[];
17
- description: string;
18
- };
19
- }
20
- interface Schema {
21
- name: string;
22
- strict: boolean;
23
- schema: {
24
- type: "object";
25
- properties: {
26
- concepts_facts: {
27
- type: "array";
28
- minItems: number;
29
- items: {
30
- type: "object";
31
- properties: ConceptFactSchemaItem;
32
- required: ["text", "type", "reference"];
33
- additionalProperties: false;
34
- };
35
- };
36
- };
37
- required: ["concepts_facts"];
38
- additionalProperties: false;
39
- };
40
- }
41
- export declare function buildConceptFactSchema(headings: string[], name?: string, strict?: boolean): Schema;
42
- export {};
1
+ type ConceptFactType = "concept" | "fact";
2
+ interface ConceptFactSchemaItem {
3
+ text: {
4
+ type: "string";
5
+ minLength: number;
6
+ maxLength: number;
7
+ description: string;
8
+ };
9
+ type: {
10
+ type: "string";
11
+ enum: ConceptFactType[];
12
+ description: string;
13
+ };
14
+ reference: {
15
+ type: "string";
16
+ enum: string[];
17
+ description: string;
18
+ };
19
+ }
20
+ interface Schema {
21
+ name: string;
22
+ strict: boolean;
23
+ schema: {
24
+ type: "object";
25
+ properties: {
26
+ concepts_facts: {
27
+ type: "array";
28
+ minItems: number;
29
+ items: {
30
+ type: "object";
31
+ properties: ConceptFactSchemaItem;
32
+ required: ["text", "type", "reference"];
33
+ additionalProperties: false;
34
+ };
35
+ };
36
+ };
37
+ required: ["concepts_facts"];
38
+ additionalProperties: false;
39
+ };
40
+ }
41
+ export declare function buildConceptFactSchema(headings: string[], name?: string, strict?: boolean): Schema;
42
+ export {};
43
43
  //# sourceMappingURL=build_concept_facts_schema.d.ts.map
@@ -1,45 +1,45 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildConceptFactSchema = buildConceptFactSchema;
4
- function buildConceptFactSchema(headings, name = "concept_fact_gen_schema", strict = false) {
5
- const allowedRefs = [...headings, ""];
6
- return {
7
- name,
8
- strict,
9
- schema: {
10
- type: "object",
11
- properties: {
12
- concepts_facts: {
13
- type: "array",
14
- minItems: 1,
15
- items: {
16
- type: "object",
17
- properties: {
18
- text: {
19
- type: "string",
20
- minLength: 80,
21
- maxLength: 280,
22
- description: "Noun phrase or declarative fact (80–280 chars).",
23
- },
24
- type: {
25
- type: "string",
26
- enum: ["concept", "fact"],
27
- description: "“concept” vs “fact”.",
28
- },
29
- reference: {
30
- type: "string",
31
- enum: allowedRefs,
32
- description: "Exact heading or empty string.",
33
- },
34
- },
35
- required: ["text", "type", "reference"],
36
- additionalProperties: false,
37
- },
38
- },
39
- },
40
- required: ["concepts_facts"],
41
- additionalProperties: false,
42
- },
43
- };
44
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildConceptFactSchema = buildConceptFactSchema;
4
+ function buildConceptFactSchema(headings, name = "concept_fact_gen_schema", strict = false) {
5
+ const allowedRefs = [...headings, ""];
6
+ return {
7
+ name,
8
+ strict,
9
+ schema: {
10
+ type: "object",
11
+ properties: {
12
+ concepts_facts: {
13
+ type: "array",
14
+ minItems: 1,
15
+ items: {
16
+ type: "object",
17
+ properties: {
18
+ text: {
19
+ type: "string",
20
+ minLength: 80,
21
+ maxLength: 280,
22
+ description: "Noun phrase or declarative fact (80–280 chars).",
23
+ },
24
+ type: {
25
+ type: "string",
26
+ enum: ["concept", "fact"],
27
+ description: "“concept” vs “fact”.",
28
+ },
29
+ reference: {
30
+ type: "string",
31
+ enum: allowedRefs,
32
+ description: "Exact heading or empty string.",
33
+ },
34
+ },
35
+ required: ["text", "type", "reference"],
36
+ additionalProperties: false,
37
+ },
38
+ },
39
+ },
40
+ required: ["concepts_facts"],
41
+ additionalProperties: false,
42
+ },
43
+ };
44
+ }
45
45
  //# sourceMappingURL=build_concept_facts_schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"qdrant_db_methods.d.ts","sourceRoot":"","sources":["../../src/helper/qdrant_db_methods.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,gBAAgB,GAAU,gBAAgB,MAAM,kBAOrD,CAAC;AAEF,QAAA,MAAM,aAAa;;;;EAGlB,CAAC;AAEF,QAAA,MAAM,wBAAwB,GAC5B,gBAAgB,MAAM,EACtB,YAAY;IACV,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,EAAE,EACH,WAAW,MAAM;;;;;eAoD2jxF,CAAC;;;cAA0H,CAAC;;;;;;iBAAkR,CAAC;mBAAuF,C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 +1,2 @@
1
- /**
2
- * Builds card output schema by populating the integrated schemas with concepts, facts, and card-specific schemas
3
- * @param concepts - Array of concept strings
4
- * @param facts - Array of fact strings
5
- * @param card_generation_types - Array of card types to generate (e.g., ["flash", "mcq", "cloze"])
6
- * @param cardTypeSchemas - Object mapping card types to their integrated schemas from getPrompts (e.g., { flash: {...}, mcq: {...} })
7
- * @returns Populated schema object ready for use
8
- */
9
- export declare const buildCardSchema: (concepts: string[], facts: string[], card_generation_types: string[], cardTypeSchemas: Record<string, any>) => Promise<any>;
1
+ export declare const buildCardSchema: (concepts: string[], facts: string[], card_generation_types: string[]) => Promise<any>;
10
2
  //# sourceMappingURL=build_card_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build_card_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,EAAE,EAClB,OAAO,MAAM,EAAE,EACf,uBAAuB,MAAM,EAAE,EAC/B,iBAAiB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,iBAmFrC,CAAC"}
1
+ {"version":3,"file":"build_card_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,EAAE,EAClB,OAAO,MAAM,EAAE,EACf,uBAAuB,MAAM,EAAE,iBA+DhC,CAAC"}
@@ -11,63 +11,60 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.buildCardSchema = void 0;
13
13
  const sanitize_strings_1 = require("../../utils/sanitize_strings");
14
- /**
15
- * Builds card output schema by populating the integrated schemas with concepts, facts, and card-specific schemas
16
- * @param concepts - Array of concept strings
17
- * @param facts - Array of fact strings
18
- * @param card_generation_types - Array of card types to generate (e.g., ["flash", "mcq", "cloze"])
19
- * @param cardTypeSchemas - Object mapping card types to their integrated schemas from getPrompts (e.g., { flash: {...}, mcq: {...} })
20
- * @returns Populated schema object ready for use
21
- */
22
- const buildCardSchema = (concepts, facts, card_generation_types, cardTypeSchemas) => __awaiter(void 0, void 0, void 0, function* () {
23
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
24
- if (!cardTypeSchemas || Object.keys(cardTypeSchemas).length === 0) {
25
- throw new Error("Card type schemas are required");
14
+ const mongo_helper_1 = require("../mongo_helper");
15
+ // flash:68ef4e1b5a123c94a835c6ab
16
+ // cloze:68ef4eb45a123c94a835c6ac
17
+ // mcq:68ef4f095a123c94a835c6ad
18
+ // match:68ef4fae5a123c94a835c6ae
19
+ const buildCardSchema = (concepts, facts, card_generation_types) => __awaiter(void 0, void 0, void 0, function* () {
20
+ const database = yield (0, mongo_helper_1.setUpMongoClient)();
21
+ const objectId = new mongo_helper_1.ObjectId("689c5cbd0d9d3bbda64b9584");
22
+ const schemaObj = yield database.collection("_prompts").findOne({
23
+ _id: objectId,
24
+ });
25
+ if (!schemaObj) {
26
+ throw new Error("Schema not found");
27
+ }
28
+ const schema = schemaObj.schema;
29
+ if (!schema) {
30
+ throw new Error("Schema not found");
26
31
  }
27
32
  const conceptsSanitized = (0, sanitize_strings_1.sanitizeStringsForSchema)(concepts);
28
33
  const factsSanitized = (0, sanitize_strings_1.sanitizeStringsForSchema)(facts);
29
- // Use the first available card type schema as the base (all have the same base structure)
30
- const firstCardType = card_generation_types.find((type) => cardTypeSchemas[type]);
31
- if (!firstCardType) {
32
- throw new Error("No valid card type schema found");
33
- }
34
- // Deep clone to avoid mutating the original
35
- const populatedSchema = JSON.parse(JSON.stringify(cardTypeSchemas[firstCardType].schema));
36
- // Populate concepts enum
37
- if ((_g = (_f = (_e = (_d = (_c = (_b = (_a = populatedSchema.schema) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.test_cards) === null || _c === void 0 ? void 0 : _c.items) === null || _d === void 0 ? void 0 : _d.properties) === null || _e === void 0 ? void 0 : _e.concepts) === null || _f === void 0 ? void 0 : _f.items) === null || _g === void 0 ? void 0 : _g.enum) {
38
- populatedSchema.schema.properties.test_cards.items.properties.concepts.items.enum =
39
- conceptsSanitized;
40
- }
41
- // Populate facts enum
42
- if ((_p = (_o = (_m = (_l = (_k = (_j = (_h = populatedSchema.schema) === null || _h === void 0 ? void 0 : _h.properties) === null || _j === void 0 ? void 0 : _j.test_cards) === null || _k === void 0 ? void 0 : _k.items) === null || _l === void 0 ? void 0 : _l.properties) === null || _m === void 0 ? void 0 : _m.facts) === null || _o === void 0 ? void 0 : _o.items) === null || _p === void 0 ? void 0 : _p.enum) {
43
- populatedSchema.schema.properties.test_cards.items.properties.facts.items.enum =
44
- factsSanitized;
45
- }
46
- // Replace the type enum with the requested card generation types
47
- if ((_v = (_u = (_t = (_s = (_r = (_q = populatedSchema.schema) === null || _q === void 0 ? void 0 : _q.properties) === null || _r === void 0 ? void 0 : _r.test_cards) === null || _s === void 0 ? void 0 : _s.items) === null || _t === void 0 ? void 0 : _t.properties) === null || _u === void 0 ? void 0 : _u.type) === null || _v === void 0 ? void 0 : _v.enum) {
48
- populatedSchema.schema.properties.test_cards.items.properties.type.enum =
49
- card_generation_types;
50
- }
51
- // Extract card-specific schemas from the anyOf of each card type schema
52
- const filteredCardTypeSchemas = [];
34
+ // Fetch individual card type schemas based on card_generation_types
35
+ const cardTypeObjectIds = {
36
+ flash: new mongo_helper_1.ObjectId("68ef4e1b5a123c94a835c6ab"),
37
+ cloze: new mongo_helper_1.ObjectId("68ef4eb45a123c94a835c6ac"),
38
+ mcq: new mongo_helper_1.ObjectId("68ef4f095a123c94a835c6ad"),
39
+ match: new mongo_helper_1.ObjectId("68ef4fae5a123c94a835c6ae"),
40
+ };
41
+ const cardTypeSchemas = {};
42
+ // Only fetch schemas for the requested card types
53
43
  for (const cardType of card_generation_types) {
54
- if (cardTypeSchemas[cardType]) {
55
- const cardSchema = cardTypeSchemas[cardType];
56
- // Extract the card-specific schema from the anyOf array
57
- const cardContentSchema = (_2 = (_1 = (_0 = (_z = (_y = (_x = (_w = cardSchema.schema) === null || _w === void 0 ? void 0 : _w.properties) === null || _x === void 0 ? void 0 : _x.test_cards) === null || _y === void 0 ? void 0 : _y.items) === null || _z === void 0 ? void 0 : _z.properties) === null || _0 === void 0 ? void 0 : _0.card_content) === null || _1 === void 0 ? void 0 : _1.anyOf) === null || _2 === void 0 ? void 0 : _2[0];
58
- if (cardContentSchema) {
59
- filteredCardTypeSchemas.push(cardContentSchema);
44
+ if (cardTypeObjectIds[cardType]) {
45
+ const cardSchemaObj = yield database.collection("_prompts").findOne({
46
+ _id: cardTypeObjectIds[cardType],
47
+ });
48
+ if (cardSchemaObj && cardSchemaObj.schema) {
49
+ cardTypeSchemas[cardType] = JSON.parse(cardSchemaObj.schema);
60
50
  }
61
51
  }
62
52
  }
63
- // Replace anyOf array with all card-specific schemas
64
- if (filteredCardTypeSchemas.length > 0) {
65
- if ((_7 = (_6 = (_5 = (_4 = (_3 = populatedSchema.schema) === null || _3 === void 0 ? void 0 : _3.properties) === null || _4 === void 0 ? void 0 : _4.test_cards) === null || _5 === void 0 ? void 0 : _5.items) === null || _6 === void 0 ? void 0 : _6.properties) === null || _7 === void 0 ? void 0 : _7.card_content) {
66
- populatedSchema.schema.properties.test_cards.items.properties.card_content =
67
- {
68
- anyOf: filteredCardTypeSchemas,
69
- };
70
- }
53
+ // Deep clone to avoid mutating the original
54
+ const populatedSchema = JSON.parse(schema);
55
+ populatedSchema.schema.properties.test_cards.items.properties.concepts.items.enum =
56
+ conceptsSanitized;
57
+ populatedSchema.schema.properties.test_cards.items.properties.facts.items.enum =
58
+ factsSanitized;
59
+ // Replace the type enum with the requested card generation types
60
+ populatedSchema.schema.properties.test_cards.items.properties.type.enum =
61
+ card_generation_types;
62
+ // Replace anyOf array with individual schemas based on card type
63
+ if (Object.keys(cardTypeSchemas).length > 0) {
64
+ populatedSchema.schema.properties.test_cards.items.properties.card_content =
65
+ {
66
+ anyOf: Object.values(cardTypeSchemas),
67
+ };
71
68
  }
72
69
  console.log("Populated Schema", JSON.stringify(populatedSchema.schema.properties.test_cards.items, null, 2));
73
70
  return populatedSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"build_card_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAwE;AAExE;;;;;;;GAOG;AACI,MAAM,eAAe,GAAG,CAC7B,QAAkB,EAClB,KAAe,EACf,qBAA+B,EAC/B,eAAoC,EACpC,EAAE;;IACF,IAAI,CAAC,eAAe,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAA,2CAAwB,EAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAG,IAAA,2CAAwB,EAAC,KAAK,CAAC,CAAC;IAEvD,0FAA0F;IAC1F,MAAM,aAAa,GAAG,qBAAqB,CAAC,IAAI,CAC9C,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAChC,CAAC;IACF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,4CAA4C;IAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAChC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CACtD,CAAC;IAEF,yBAAyB;IACzB,IACE,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,eAAe,CAAC,MAAM,0CAAE,UAAU,0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AY,0CAAE,KAAK,0CAAG,CAAC,CAAC,CAAC;YAC/B,IAAI,iBAAiB,EAAE,CAAC;gBACtB,uBAAuB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;IAED,qDAAqD;IACrD,IAAI,uBAAuB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvC,IACE,MAAA,MAAA,MAAA,MAAA,MAAA,eAAe,CAAC,MAAM,0CAAE,UAAU,0CAAE,UAAU,0CAAE,KAAK,0CAAE,UAAU,0CAC7D,YAAY,EAChB,CAAC;YACD,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY;gBACxE;oBACE,KAAK,EAAE,uBAAuB;iBAC/B,CAAC;QACN,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CACT,kBAAkB,EAClB,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAC5E,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC,CAAA,CAAC;AAvFW,QAAA,eAAe,mBAuF1B"}
1
+ {"version":3,"file":"build_card_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAwE;AACxE,kDAA6D;AAE7D,iCAAiC;AACjC,iCAAiC;AACjC,+BAA+B;AAC/B,iCAAiC;AAC1B,MAAM,eAAe,GAAG,CAC7B,QAAkB,EAClB,KAAe,EACf,qBAA+B,EAC/B,EAAE;IACF,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAgB,GAAE,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,uBAAQ,CAAC,0BAA0B,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC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CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI;QAC/E,iBAAiB,CAAC;IACpB,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI;QAC5E,cAAc,CAAC;IAEjB,iEAAiE;IACjE,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI;QACrE,qBAAqB,CAAC;IAExB,iEAAiE;IACjE,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY;YACxE;gBACE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;aACtC,CAAC;IACN,CAAC;IAED,OAAO,CAAC,GAAG,CACT,kBAAkB,EAClB,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAC5E,CAAC;IACF,OAAO,eAAe,CAAC;AACzB,CAAC,CAAA,CAAC;AAlEW,QAAA,eAAe,mBAkE1B"}
@@ -1,2 +1,2 @@
1
- export declare function buildConceptFactSchema(headings: string[], conceptFactSchema: any): Promise<any>;
1
+ export declare function buildConceptFactSchema(headings: string[], name?: string, strict?: boolean): Promise<any>;
2
2
  //# sourceMappingURL=build_concept_facts_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build_concept_facts_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":"AAKA,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAAE,EAClB,iBAAiB,EAAE,GAAG,gBAuBvB"}
1
+ {"version":3,"file":"build_concept_facts_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":"AAKA,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAAE,EAClB,IAAI,GAAE,MAAkC,EACxC,MAAM,GAAE,OAAc,gBAoCvB"}
@@ -10,15 +10,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.buildConceptFactSchema = buildConceptFactSchema;
13
+ const mongodb_1 = require("mongodb");
14
+ const mongo_helper_1 = require("../mongo_helper");
13
15
  const sanitize_strings_1 = require("../../utils/sanitize_strings");
14
16
  // Function to populate enums in a parsed schema
15
- function buildConceptFactSchema(headings, conceptFactSchema) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
+ function buildConceptFactSchema(headings_1) {
18
+ return __awaiter(this, arguments, void 0, function* (headings, name = "concept_fact_gen_schema", strict = true) {
17
19
  var _a, _b, _c, _d, _e, _f;
18
- const populatedSchema = conceptFactSchema;
20
+ const database = yield (0, mongo_helper_1.setUpMongoClient)();
21
+ const objectId = new mongodb_1.ObjectId("6895ac4baa1cad73b0018061");
22
+ const schemaObj = yield database.collection("_prompts").findOne({
23
+ _id: objectId,
24
+ });
25
+ if (!schemaObj) {
26
+ throw new Error("Schema not found");
27
+ }
28
+ const schema = schemaObj.schema;
29
+ if (!schema) {
30
+ throw new Error("Schema not found");
31
+ }
32
+ // Deep clone to avoid mutating the original
33
+ const populatedSchema = JSON.parse(schema);
19
34
  // Update name and strict mode
20
- populatedSchema.name = conceptFactSchema.name;
21
- populatedSchema.strict = conceptFactSchema.strict;
35
+ populatedSchema.name = name;
36
+ populatedSchema.strict = strict;
22
37
  const allowedRefs = [...headings, ""];
23
38
  // Sanitize headings to remove quotes for OpenAI structured outputs
24
39
  const sanitizedStrings = (0, sanitize_strings_1.sanitizeStringsForSchema)(allowedRefs);
@@ -1 +1 @@
1
- {"version":3,"file":"build_concept_facts_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAKA,wDAyBC;AA5BD,mEAAwE;AAExE,gDAAgD;AAChD,SAAsB,sBAAsB,CAC1C,QAAkB,EAClB,iBAAsB;;;QAEtB,MAAM,eAAe,GAAG,iBAAiB,CAAC;QAE1C,8BAA8B;QAC9B,eAAe,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC;QAC9C,eAAe,CAAC,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC;QAElD,MAAM,WAAW,GAAG,CAAC,GAAG,QAAQ,EAAE,EAAE,CAAC,CAAC;QAEtC,mEAAmE;QACnE,MAAM,gBAAgB,GAAG,IAAA,2CAAwB,EAAC,WAAW,CAAC,CAAC;QAE/D,gDAAgD;QAChD,IACE,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,eAAe,CAAC,MAAM,0CAAE,UAAU,0CAAE,cAAc,0CAAE,KAAK,0CAAE,UAAU,0CACjE,SAAS,0CAAE,IAAI,EACnB,CAAC;YACD,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI;gBAC9E,gBAAgB,CAAC;QACrB,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CAAA"}
1
+ {"version":3,"file":"build_concept_facts_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAKA,wDAuCC;AA5CD,qCAAmC;AACnC,kDAAmD;AACnD,mEAAwE;AAExE,gDAAgD;AAChD,SAAsB,sBAAsB;yDAC1C,QAAkB,EAClB,OAAe,yBAAyB,EACxC,SAAkB,IAAI;;QAEtB,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
1
+ export declare function buildSummarySchema(headings: string[], name?: string, strict?: boolean): Promise<any>;
2
2
  //# sourceMappingURL=build_summary_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build_summary_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_summary_schema.ts"],"names":[],"mappings":"AAIA,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAAE,EAClB,aAAa,EAAE,GAAG,gBAyBnB"}
1
+ {"version":3,"file":"build_summary_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_summary_schema.ts"],"names":[],"mappings":"AAIA,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAAE,EAClB,IAAI,GAAE,MAAwB,EAC9B,MAAM,GAAE,OAAc,gBAmCvB"}