only_ever_generator 3.0.4 → 3.0.5
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/helper/schema_helper/build_classify_summarize_schema.d.ts +77 -0
- package/dist/helper/schema_helper/build_classify_summarize_schema.d.ts.map +1 -0
- package/dist/helper/schema_helper/build_classify_summarize_schema.js +96 -0
- package/dist/helper/schema_helper/build_classify_summarize_schema.js.map +1 -0
- package/dist/typology_gen/generate_typology.d.ts.map +1 -1
- package/dist/typology_gen/generate_typology.js +9 -0
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/package.json +1 -2
- package/src/helper/schema_helper/build_classify_summarize_schema.ts +99 -0
- package/src/typology_gen/generate_typology.ts +11 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export declare const classifySummarizeSchema: {
|
|
2
|
+
name: string;
|
|
3
|
+
strict: boolean;
|
|
4
|
+
schema: {
|
|
5
|
+
type: string;
|
|
6
|
+
properties: {
|
|
7
|
+
learn_value: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
state: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
reason: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
maxLength: number;
|
|
18
|
+
};
|
|
19
|
+
bloom_levels: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
items: {
|
|
23
|
+
type: string;
|
|
24
|
+
enum: number[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
bloom_levels_reason: {
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
maxLength: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
required: string[];
|
|
34
|
+
additionalProperties: boolean;
|
|
35
|
+
};
|
|
36
|
+
field: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
items: {
|
|
40
|
+
type: string;
|
|
41
|
+
enum: string[];
|
|
42
|
+
};
|
|
43
|
+
minItems: number;
|
|
44
|
+
maxItems: number;
|
|
45
|
+
};
|
|
46
|
+
summary_cards: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
maxItems: number;
|
|
50
|
+
items: {
|
|
51
|
+
type: string;
|
|
52
|
+
properties: {
|
|
53
|
+
title: {
|
|
54
|
+
type: string;
|
|
55
|
+
description: string;
|
|
56
|
+
maxLength: number;
|
|
57
|
+
};
|
|
58
|
+
text: {
|
|
59
|
+
type: string;
|
|
60
|
+
description: string;
|
|
61
|
+
maxLength: number;
|
|
62
|
+
};
|
|
63
|
+
reference: {
|
|
64
|
+
type: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
required: string[];
|
|
69
|
+
additionalProperties: boolean;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
required: string[];
|
|
74
|
+
additionalProperties: boolean;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=build_classify_summarize_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_classify_summarize_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_classify_summarize_schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGnC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifySummarizeSchema = void 0;
|
|
4
|
+
exports.classifySummarizeSchema = {
|
|
5
|
+
name: "source_classification_and_summary",
|
|
6
|
+
strict: true,
|
|
7
|
+
schema: {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
learn_value: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
state: {
|
|
14
|
+
type: "boolean",
|
|
15
|
+
description: "Whether the content has educational value and should be used to generate test materials.",
|
|
16
|
+
},
|
|
17
|
+
reason: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Concise justification (≤320 chars) for why the source was marked true or false.",
|
|
20
|
+
maxLength: 320,
|
|
21
|
+
},
|
|
22
|
+
bloom_levels: {
|
|
23
|
+
type: "array",
|
|
24
|
+
description: "List of applicable Bloom levels (1–5). Leave empty if state is false.",
|
|
25
|
+
items: { type: "integer", enum: [1, 2, 3, 4, 5] },
|
|
26
|
+
},
|
|
27
|
+
bloom_levels_reason: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Explanation (≤320 chars) for the selected Bloom levels.",
|
|
30
|
+
maxLength: 320,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ["state", "reason", "bloom_levels", "bloom_levels_reason"],
|
|
34
|
+
additionalProperties: false,
|
|
35
|
+
},
|
|
36
|
+
field: {
|
|
37
|
+
type: "array",
|
|
38
|
+
description: "One to three fields of knowledge this content relates to.",
|
|
39
|
+
items: {
|
|
40
|
+
type: "string",
|
|
41
|
+
enum: [
|
|
42
|
+
"Sciences",
|
|
43
|
+
"Technology & Engineering",
|
|
44
|
+
"Humanities & Cultural Studies",
|
|
45
|
+
"Social Sciences & Global Studies",
|
|
46
|
+
"Business & Management",
|
|
47
|
+
"Health & Medicine",
|
|
48
|
+
"Environmental Studies & Earth Sciences",
|
|
49
|
+
"Education, Learning & Personal Development",
|
|
50
|
+
"Creative & Performing Arts",
|
|
51
|
+
"Law, Governance & Ethics",
|
|
52
|
+
"Recreation, Lifestyle & Practical Skills",
|
|
53
|
+
"Technology & Media Literacy",
|
|
54
|
+
"Philosophy & Critical Thinking",
|
|
55
|
+
"Space & Astronomical Sciences",
|
|
56
|
+
"Agriculture & Food Sciences",
|
|
57
|
+
"Trades & Craftsmanship",
|
|
58
|
+
"Reference & Indexing",
|
|
59
|
+
"Other",
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
minItems: 1,
|
|
63
|
+
maxItems: 3,
|
|
64
|
+
},
|
|
65
|
+
summary_cards: {
|
|
66
|
+
type: "array",
|
|
67
|
+
description: "Concise summary cards (0–15) that walk through key learning points from the source.",
|
|
68
|
+
maxItems: 15,
|
|
69
|
+
items: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
title: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "Card title (≤60 chars).",
|
|
75
|
+
maxLength: 60,
|
|
76
|
+
},
|
|
77
|
+
text: {
|
|
78
|
+
type: "string",
|
|
79
|
+
description: "Summary text (≤320 chars).",
|
|
80
|
+
maxLength: 320,
|
|
81
|
+
},
|
|
82
|
+
reference: {
|
|
83
|
+
type: "string",
|
|
84
|
+
description: "A {{heading_type}} or empty string; enum populated dynamically at runtime.",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
required: ["title", "text", "reference"],
|
|
88
|
+
additionalProperties: false,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
required: ["learn_value", "field", "summary_cards"],
|
|
93
|
+
additionalProperties: false,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=build_classify_summarize_schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_classify_summarize_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_classify_summarize_schema.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG;IACrC,IAAI,EAAE,mCAAmC;IACzC,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,SAAS;wB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,EAAE,QAAQ;4BACd,WAAW,EAAE,yBAAyB;4BACtC,SAAS,EAAE,EAAE;yBACd;wBACD,IAAI,EAAE;4BACJ,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,4BAA4B;4BACzC,SAAS,EAAE,GAAG;yBACf;wBACD,SAAS,EAAE;4BACT,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,4EAA4E;yBAC/E;qBACF;oBACD,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC;oBACxC,oBAAoB,EAAE,KAAK;iBAC5B;aACF;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC;QACnD,oBAAoB,EAAE,KAAK;KAC5B;CACF,CAAC"}
|
|
@@ -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":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI5D,qBAAa,gBAAgB;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAM;IAClB,OAAO,EAAE,MAAM,CAAM;IACrB,mBAAmB,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAE5B,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,EAC9B,mBAAmB,EAAE,MAAM;IAUvB,QAAQ;IA0Dd,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;;;;;;;IAexC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;;;;IAQ3B,sBAAsB,CAAC,YAAY,EAAE,GAAG;;;;CAQ/C"}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.GenerateTypology = void 0;
|
|
13
13
|
const openai_helper_1 = require("../helper/openai_helper");
|
|
14
14
|
const logger_1 = require("../logger");
|
|
15
|
+
const build_classify_summarize_schema_1 = require("../helper/schema_helper/build_classify_summarize_schema");
|
|
15
16
|
class GenerateTypology {
|
|
16
17
|
constructor(openAiService, type, content, expected_fields, promptIdForTypology) {
|
|
17
18
|
this.type = "";
|
|
@@ -37,6 +38,14 @@ class GenerateTypology {
|
|
|
37
38
|
},
|
|
38
39
|
input: this.content,
|
|
39
40
|
store: false,
|
|
41
|
+
text: {
|
|
42
|
+
format: {
|
|
43
|
+
type: "json_schema",
|
|
44
|
+
name: build_classify_summarize_schema_1.classifySummarizeSchema.name,
|
|
45
|
+
strict: true,
|
|
46
|
+
schema: build_classify_summarize_schema_1.classifySummarizeSchema.schema,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
40
49
|
});
|
|
41
50
|
openAiResponse["request_type"] = {
|
|
42
51
|
type: "breadth",
|
|
@@ -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":["../../src/typology_gen/generate_typology.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAkE;AAClE,sCAAwC;AAGxC,6GAAkG;AAElG,MAAa,gBAAgB;IAM3B,YACE,aAA4B,EAC5B,IAAY,EACZ,OAAe,EACf,eAA8B,EAC9B,mBAA2B;QATtB,SAAI,GAAW,EAAE,CAAC;QAClB,YAAO,GAAW,EAAE,CAAC;QAU1B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACv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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;AA9GD,4CA8GC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "only_ever_generator",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@qdrant/js-client-rest": "^1.14.0",
|
|
25
25
|
"axios": "^1.9.0",
|
|
26
|
-
"n": "^10.1.0",
|
|
27
26
|
"openai": "^5.10.2",
|
|
28
27
|
"stable": "^0.1.8"
|
|
29
28
|
},
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export const classifySummarizeSchema = {
|
|
2
|
+
name: "source_classification_and_summary",
|
|
3
|
+
strict: true,
|
|
4
|
+
schema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
learn_value: {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
state: {
|
|
11
|
+
type: "boolean",
|
|
12
|
+
description:
|
|
13
|
+
"Whether the content has educational value and should be used to generate test materials.",
|
|
14
|
+
},
|
|
15
|
+
reason: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description:
|
|
18
|
+
"Concise justification (≤320 chars) for why the source was marked true or false.",
|
|
19
|
+
maxLength: 320,
|
|
20
|
+
},
|
|
21
|
+
bloom_levels: {
|
|
22
|
+
type: "array",
|
|
23
|
+
description:
|
|
24
|
+
"List of applicable Bloom levels (1–5). Leave empty if state is false.",
|
|
25
|
+
items: { type: "integer", enum: [1, 2, 3, 4, 5] },
|
|
26
|
+
},
|
|
27
|
+
bloom_levels_reason: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description:
|
|
30
|
+
"Explanation (≤320 chars) for the selected Bloom levels.",
|
|
31
|
+
maxLength: 320,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: ["state", "reason", "bloom_levels", "bloom_levels_reason"],
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
},
|
|
37
|
+
field: {
|
|
38
|
+
type: "array",
|
|
39
|
+
description:
|
|
40
|
+
"One to three fields of knowledge this content relates to.",
|
|
41
|
+
items: {
|
|
42
|
+
type: "string",
|
|
43
|
+
enum: [
|
|
44
|
+
"Sciences",
|
|
45
|
+
"Technology & Engineering",
|
|
46
|
+
"Humanities & Cultural Studies",
|
|
47
|
+
"Social Sciences & Global Studies",
|
|
48
|
+
"Business & Management",
|
|
49
|
+
"Health & Medicine",
|
|
50
|
+
"Environmental Studies & Earth Sciences",
|
|
51
|
+
"Education, Learning & Personal Development",
|
|
52
|
+
"Creative & Performing Arts",
|
|
53
|
+
"Law, Governance & Ethics",
|
|
54
|
+
"Recreation, Lifestyle & Practical Skills",
|
|
55
|
+
"Technology & Media Literacy",
|
|
56
|
+
"Philosophy & Critical Thinking",
|
|
57
|
+
"Space & Astronomical Sciences",
|
|
58
|
+
"Agriculture & Food Sciences",
|
|
59
|
+
"Trades & Craftsmanship",
|
|
60
|
+
"Reference & Indexing",
|
|
61
|
+
"Other",
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
minItems: 1,
|
|
65
|
+
maxItems: 3,
|
|
66
|
+
},
|
|
67
|
+
summary_cards: {
|
|
68
|
+
type: "array",
|
|
69
|
+
description:
|
|
70
|
+
"Concise summary cards (0–15) that walk through key learning points from the source.",
|
|
71
|
+
maxItems: 15,
|
|
72
|
+
items: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
title: {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: "Card title (≤60 chars).",
|
|
78
|
+
maxLength: 60,
|
|
79
|
+
},
|
|
80
|
+
text: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "Summary text (≤320 chars).",
|
|
83
|
+
maxLength: 320,
|
|
84
|
+
},
|
|
85
|
+
reference: {
|
|
86
|
+
type: "string",
|
|
87
|
+
description:
|
|
88
|
+
"A {{heading_type}} or empty string; enum populated dynamically at runtime.",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ["title", "text", "reference"],
|
|
92
|
+
additionalProperties: false,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
required: ["learn_value", "field", "summary_cards"],
|
|
97
|
+
additionalProperties: false,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import test from "node:test";
|
|
1
2
|
import { getOpenAI, OpenAIHelper } from "../helper/openai_helper";
|
|
2
3
|
import { ErrorLogger } from "../logger";
|
|
3
4
|
import { OpenAiService } from "../services/open_ai_service";
|
|
5
|
+
import { text } from "stream/consumers";
|
|
6
|
+
import { classifySummarizeSchema } from "../helper/schema_helper/build_classify_summarize_schema";
|
|
4
7
|
|
|
5
8
|
export class GenerateTypology {
|
|
6
9
|
public openAiService: OpenAiService;
|
|
@@ -37,6 +40,14 @@ export class GenerateTypology {
|
|
|
37
40
|
},
|
|
38
41
|
input: this.content,
|
|
39
42
|
store: false,
|
|
43
|
+
text: {
|
|
44
|
+
format: {
|
|
45
|
+
type: "json_schema",
|
|
46
|
+
name: classifySummarizeSchema.name,
|
|
47
|
+
strict: true,
|
|
48
|
+
schema: classifySummarizeSchema.schema,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
40
51
|
});
|
|
41
52
|
|
|
42
53
|
openAiResponse["request_type"] = {
|