only_ever_generator 8.4.6 → 8.4.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 +6 -3
- package/dist/bootstrap/app.d.ts.map +1 -1
- package/dist/bootstrap/app.js +11 -17
- package/dist/bootstrap/app.js.map +1 -1
- package/dist/card_gen/generate_cards.d.ts +2 -3
- package/dist/card_gen/generate_cards.d.ts.map +1 -1
- package/dist/card_gen/generate_cards.js +22 -15
- package/dist/card_gen/generate_cards.js.map +1 -1
- package/dist/constants/prompt_data.d.ts +4 -4
- package/dist/constants/prompt_data.js +302 -302
- package/dist/constants/prompts/card_gen_prompt.js +160 -160
- package/dist/constants/prompts/typology_prompt.js +131 -131
- package/dist/constants/source_data.d.ts +171 -171
- package/dist/constants/source_data.js +973 -973
- package/dist/embedding_generation/local_consolidation.js +104 -104
- package/dist/helper/build_concept_facts_schema.d.ts +42 -42
- package/dist/helper/build_concept_facts_schema.js +44 -44
- package/dist/helper/qdrant_db_methods.d.ts.map +1 -1
- package/dist/helper/schema_helper/build_card_schema.d.ts +1 -9
- package/dist/helper/schema_helper/build_card_schema.d.ts.map +1 -1
- package/dist/helper/schema_helper/build_card_schema.js +47 -50
- package/dist/helper/schema_helper/build_card_schema.js.map +1 -1
- package/dist/helper/schema_helper/build_concept_facts_schema.d.ts +1 -1
- package/dist/helper/schema_helper/build_concept_facts_schema.d.ts.map +1 -1
- package/dist/helper/schema_helper/build_concept_facts_schema.js +20 -5
- package/dist/helper/schema_helper/build_concept_facts_schema.js.map +1 -1
- package/dist/helper/schema_helper/build_summary_schema.d.ts +1 -1
- package/dist/helper/schema_helper/build_summary_schema.d.ts.map +1 -1
- package/dist/helper/schema_helper/build_summary_schema.js +18 -7
- package/dist/helper/schema_helper/build_summary_schema.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/parse/response_format_card.d.ts +176 -176
- package/dist/parse/response_format_card.js +371 -371
- package/dist/parse/response_format_typology.d.ts +1 -1
- package/dist/parse/response_format_typology.js +46 -46
- package/dist/services/get_prompts.d.ts +8 -7
- package/dist/services/get_prompts.d.ts.map +1 -1
- package/dist/services/get_prompts.js +69 -21
- package/dist/services/get_prompts.js.map +1 -1
- package/dist/typology_gen/generate_concept_facts.d.ts +2 -3
- package/dist/typology_gen/generate_concept_facts.d.ts.map +1 -1
- package/dist/typology_gen/generate_concept_facts.js +25 -15
- package/dist/typology_gen/generate_concept_facts.js.map +1 -1
- package/dist/typology_gen/generate_typology.d.ts +2 -1
- package/dist/typology_gen/generate_typology.d.ts.map +1 -1
- package/dist/typology_gen/generate_typology.js +24 -13
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/dist/typology_gen/summarize.d.ts +2 -3
- package/dist/typology_gen/summarize.d.ts.map +1 -1
- package/dist/typology_gen/summarize.js +24 -13
- package/dist/typology_gen/summarize.js.map +1 -1
- package/package.json +39 -38
- package/src/bootstrap/app.ts +418 -416
- package/src/card_gen/generate_cards.ts +347 -345
- package/src/config.ts +11 -11
- package/src/constants/api_constants.ts +7 -7
- package/src/constants/prompts/card_gen_prompt.ts +164 -164
- package/src/constants/prompts/typology_prompt.ts +139 -139
- package/src/embedding_generation/consolidation/global_consolidation.ts +96 -96
- package/src/embedding_generation/consolidation/local_consolidation.ts +141 -141
- package/src/embedding_generation/consolidation/write_consolidated_data.ts +98 -98
- package/src/embedding_generation/generate_embeddings.ts +42 -42
- package/src/embedding_generation/parse_embedding_response.ts +31 -31
- package/src/enums/card_type_enum.ts +6 -6
- package/src/gap_fill/calculate_gap_fill.ts +50 -50
- package/src/helper/get_id_from_title.ts +33 -33
- package/src/helper/mongo_helper.ts +29 -29
- package/src/helper/openai_helper.ts +20 -20
- package/src/helper/qdrant_db_methods.ts +77 -77
- package/src/helper/schema_helper/build_card_schema.ts +74 -98
- package/src/helper/schema_helper/build_classify_summarize_schema.ts +43 -43
- package/src/helper/schema_helper/build_concept_facts_schema.ts +45 -31
- package/src/helper/schema_helper/build_summary_schema.ts +43 -32
- package/src/index.ts +71 -73
- package/src/logger.ts +65 -65
- package/src/parse/parse_card/parse_cloze_card.ts +146 -146
- package/src/parse/parse_card/parse_flash_cards.ts +42 -42
- package/src/parse/parse_card/parse_match_card.ts +104 -104
- package/src/parse/parse_card/parse_mcq_card.ts +114 -114
- package/src/parse/parse_card_response.ts +197 -197
- package/src/parse/parse_source_content.ts +212 -212
- package/src/services/get_prompts.ts +164 -112
- package/src/services/open_ai_service.ts +89 -89
- package/src/services/qdrant_service.ts +10 -10
- package/src/types/base_param_type.ts +13 -13
- package/src/types/mongo_concept_fact_type.ts +12 -12
- package/src/types/parsed_card_type.ts +39 -39
- package/src/types/raw_card_response_types/generated_card_response_type.ts +59 -59
- package/src/types/source_taxonomy_type.ts +24 -24
- package/src/typology-parsed-response.ts +1932 -1932
- package/src/typology_gen/generate_concept_facts.ts +180 -169
- package/src/typology_gen/generate_typology.ts +203 -189
- package/src/typology_gen/summarize.ts +176 -164
- package/src/utils/distributed_quote_restoration.ts +80 -80
- package/src/utils/generate_args.ts +29 -29
- package/src/utils/parse_openai_response.ts +19 -19
- package/src/utils/sanitize_strings.ts +65 -65
- package/tsconfig.json +16 -16
- package/dist/constants/default_generation_variables.d.ts +0 -3
- package/dist/constants/default_generation_variables.d.ts.map +0 -1
- package/dist/constants/default_generation_variables.js +0 -580
- package/dist/constants/default_generation_variables.js.map +0 -1
- package/dist/services/prompts_test.d.ts +0 -10
- package/dist/services/prompts_test.d.ts.map +0 -1
- package/dist/services/prompts_test.js +0 -227
- package/dist/services/prompts_test.js.map +0 -1
- package/dist/types/generation_variables_schema.d.ts +0 -14
- package/dist/types/generation_variables_schema.d.ts.map +0 -1
- package/dist/types/generation_variables_schema.js +0 -3
- package/dist/types/generation_variables_schema.js.map +0 -1
- package/dist/utils/test.d.ts +0 -2
- package/dist/utils/test.d.ts.map +0 -1
- package/dist/utils/test.js +0 -5
- package/dist/utils/test.js.map +0 -1
- package/src/constants/default_generation_variables.ts +0 -624
- package/src/types/generation_variables_schema.ts +0 -16
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
const typologyPromptString = `
|
|
2
|
-
You are a dedicated assistant that categorizes and summarizes educational content. You will process educational content (in JSON format) that represents text from diverse sources such as wikipedia, markdown notes, PDFs, book chapters, and websites.
|
|
3
|
-
You will be provided with the following:
|
|
4
|
-
1. Title of the source
|
|
5
|
-
2. A list of main headings in the source
|
|
6
|
-
3. The source content
|
|
7
|
-
|
|
8
|
-
Perform the following tasks:
|
|
9
|
-
|
|
10
|
-
1. Classify the content into one to three predefined fields of knowledge.
|
|
11
|
-
2. Extract key concepts within the content. Be exhaustive and thorough.
|
|
12
|
-
3. Extract concrete and relevant facts that are referenced in the content. Be exhaustive and thorough.
|
|
13
|
-
4. Decide whether the content has any educational value and should be used to generate test material and quizzes based on the identified concepts and facts.
|
|
14
|
-
5. If the generate_cards is true then summarize the content using a series of summary cards.
|
|
15
|
-
|
|
16
|
-
Output your answer as valid JSON, in the form:
|
|
17
|
-
json
|
|
18
|
-
{
|
|
19
|
-
"field": ["primary_field", "secondary_field", "tertiary_field"],
|
|
20
|
-
"concepts":
|
|
21
|
-
[
|
|
22
|
-
{
|
|
23
|
-
"concept_text": "concept_content",
|
|
24
|
-
"reference": "main_heading"
|
|
25
|
-
},
|
|
26
|
-
{...}
|
|
27
|
-
],
|
|
28
|
-
"facts":
|
|
29
|
-
[
|
|
30
|
-
{
|
|
31
|
-
"fact_text": "fact_content",
|
|
32
|
-
"reference": "main_heading"
|
|
33
|
-
},
|
|
34
|
-
{...}
|
|
35
|
-
],
|
|
36
|
-
"generate_cards": [
|
|
37
|
-
state: true or false,
|
|
38
|
-
reason: "reason for marking the source as false. Leave empty for true."
|
|
39
|
-
],
|
|
40
|
-
"summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
Further instruction on how to perform these tasks are below.
|
|
44
|
-
Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
|
|
45
|
-
|
|
46
|
-
1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
|
|
47
|
-
2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
|
|
48
|
-
3. Humanities & Cultural Studies: Highlight History, Literature, Languages, Arts, Philosophy, and Anthropological Studies.
|
|
49
|
-
4. Social Sciences & Global Studies: Include Sociology, Psychology, Economics, Political Science, Anthropology, and International Relations.
|
|
50
|
-
5. Business & Management: Encompass Entrepreneurship, Marketing, Finance, Leadership, and Ethics.
|
|
51
|
-
6. Health & Medicine: Cover Medical Sciences, Public Health, Nutrition, Wellness, and Mental Health.
|
|
52
|
-
7. Environmental Studies & Earth Sciences: Discuss Ecology, Climate Science, Geology, and Environmental Policy.
|
|
53
|
-
8. Education, Learning & Personal Development: Talk about Educational Theories, Teaching Methods, and Personal Skills.
|
|
54
|
-
9. Creative & Performing Arts: Include Visual Arts, Music, Theater, Dance, and Design Principles.
|
|
55
|
-
10. Law, Governance & Ethics: Focus on Legal Studies, Public Administration, Policy Analysis, and Ethical Decision-Making.
|
|
56
|
-
11. Recreation, Lifestyle & Practical Skills: Highlight Hobbies, Sports, Travel, Lifestyle Choices, and Practical Skills.
|
|
57
|
-
12. Technology & Media Literacy: Discuss Digital Literacy, Media Studies, and the Impact of Digital Media.
|
|
58
|
-
13. Philosophy & Critical Thinking: Emphasize Moral Philosophy, Ethical Frameworks, and Critical Thinking.
|
|
59
|
-
14. Space & Astronomical Sciences: Focus on Space Exploration, Astronomy, and Astrophysics.
|
|
60
|
-
15. Agriculture & Food Sciences: Discuss Sustainable Farming, Food Technology, and Nutrition.
|
|
61
|
-
16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
|
|
62
|
-
17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
|
|
63
|
-
18. Other: Use for content that doesn’t fit into the above categories.
|
|
64
|
-
Extract key concepts within the content after classifying the field. This is a crucial part of the exercise. Be exhaustive and thorough.
|
|
65
|
-
|
|
66
|
-
1. **Definition of a Concept**: Concepts are fundamental ideas that form the basis of knowledge in any discipline. They help organize and explain information, making it accessible and relatable.
|
|
67
|
-
2. **Inclusion Criteria**: Include a concept only if it is discussed in detail and is an important part of the subject matter of the source.
|
|
68
|
-
3. **How to describe a concept**: The concept should be described so that a reader can comprehend the gist of it.
|
|
69
|
-
4. **Character Limit**: Maintain a limit of 90 characters to ensure each concept is concise yet informative.
|
|
70
|
-
5. **Reference**: Every concept must include a reference. A reference can either be the entire source or a specific heading in the source. Whenever possible, pick a main heading to direct the user to the most relevant part of the source material. The heading must exactly match one of the headings provided to you. Sometimes concepts may need to reference the entire text or multiple headings, leave the reference empty for such cases.
|
|
71
|
-
|
|
72
|
-
List the concepts in the following JSON format:
|
|
73
|
-
|
|
74
|
-
json
|
|
75
|
-
"concepts":
|
|
76
|
-
[
|
|
77
|
-
{
|
|
78
|
-
"concept_text": "concept_content",
|
|
79
|
-
"reference": "main_heading"
|
|
80
|
-
},
|
|
81
|
-
{...}
|
|
82
|
-
]
|
|
83
|
-
After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
|
|
84
|
-
|
|
85
|
-
1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
|
|
86
|
-
2. **Selection Criteria**: Inlcude facts based on their significance to the content's main themes or concepts, their educational value and their foundational role in the subject.
|
|
87
|
-
3. **Character Limit**: Maintain a limit of 90 characters for the to ensure each message is concise yet informative.
|
|
88
|
-
4. **Reference**: Every fact must include a reference. A reference can either be the entire source or a specific heading in the source. Whenever possible, pick a main heading to direct the user to the most relevant part of the source material. The heading must exactly match one of the headings provided to you. Sometimes facts may need to reference the entire text or multiple headings, leave the reference empty for such cases.
|
|
89
|
-
|
|
90
|
-
List the facts in the following JSON format:
|
|
91
|
-
|
|
92
|
-
json
|
|
93
|
-
"facts":
|
|
94
|
-
[
|
|
95
|
-
{
|
|
96
|
-
"fact_text": "fact_content",
|
|
97
|
-
"reference": "main_heading"
|
|
98
|
-
},
|
|
99
|
-
{...}
|
|
100
|
-
]
|
|
101
|
-
After you have examined the content —its field, its concepts, and its facts— determine whether it justifies the creation of quiz materials.
|
|
102
|
-
|
|
103
|
-
Consider whether these elements offer the average learner meaningful insights, practical uses, or serve important educational aims. If, in your judgment, the material falls short of providing such value, explain why in fewer than 90 characters.
|
|
104
|
-
|
|
105
|
-
Reflect your in the JSON format as follows:
|
|
106
|
-
|
|
107
|
-
json
|
|
108
|
-
"generate_cards":
|
|
109
|
-
{ state: true or false,
|
|
110
|
-
reason: "reason for marking the source as false. Leave empty for true."
|
|
111
|
-
}
|
|
112
|
-
After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards.
|
|
113
|
-
|
|
114
|
-
These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
|
|
118
|
-
2. **Summarization Objective**: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
|
|
119
|
-
3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
|
|
120
|
-
4. **Card limit**: Limit the total number of cards to less than or equal to 8.
|
|
121
|
-
4. **Engagement and Flow**: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
|
|
122
|
-
|
|
123
|
-
Format your output in JSON as follows:
|
|
124
|
-
|
|
125
|
-
json
|
|
126
|
-
{
|
|
127
|
-
"summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "... up to 8 summary cards"]
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
`;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
export function returnTypologyPrompt() {
|
|
139
|
-
return typologyPromptString;
|
|
1
|
+
const typologyPromptString = `
|
|
2
|
+
You are a dedicated assistant that categorizes and summarizes educational content. You will process educational content (in JSON format) that represents text from diverse sources such as wikipedia, markdown notes, PDFs, book chapters, and websites.
|
|
3
|
+
You will be provided with the following:
|
|
4
|
+
1. Title of the source
|
|
5
|
+
2. A list of main headings in the source
|
|
6
|
+
3. The source content
|
|
7
|
+
|
|
8
|
+
Perform the following tasks:
|
|
9
|
+
|
|
10
|
+
1. Classify the content into one to three predefined fields of knowledge.
|
|
11
|
+
2. Extract key concepts within the content. Be exhaustive and thorough.
|
|
12
|
+
3. Extract concrete and relevant facts that are referenced in the content. Be exhaustive and thorough.
|
|
13
|
+
4. Decide whether the content has any educational value and should be used to generate test material and quizzes based on the identified concepts and facts.
|
|
14
|
+
5. If the generate_cards is true then summarize the content using a series of summary cards.
|
|
15
|
+
|
|
16
|
+
Output your answer as valid JSON, in the form:
|
|
17
|
+
json
|
|
18
|
+
{
|
|
19
|
+
"field": ["primary_field", "secondary_field", "tertiary_field"],
|
|
20
|
+
"concepts":
|
|
21
|
+
[
|
|
22
|
+
{
|
|
23
|
+
"concept_text": "concept_content",
|
|
24
|
+
"reference": "main_heading"
|
|
25
|
+
},
|
|
26
|
+
{...}
|
|
27
|
+
],
|
|
28
|
+
"facts":
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"fact_text": "fact_content",
|
|
32
|
+
"reference": "main_heading"
|
|
33
|
+
},
|
|
34
|
+
{...}
|
|
35
|
+
],
|
|
36
|
+
"generate_cards": [
|
|
37
|
+
state: true or false,
|
|
38
|
+
reason: "reason for marking the source as false. Leave empty for true."
|
|
39
|
+
],
|
|
40
|
+
"summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "..."]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Further instruction on how to perform these tasks are below.
|
|
44
|
+
Every source must be placed under a field. This is the broadest category of knowledge. A source should belong to at least one and at most 3 fields. Only include fields that a source is strongly associated with. The field names in your response must exactly match the names of 18 fields listed below.
|
|
45
|
+
|
|
46
|
+
1. Sciences: Focus on Biology, Chemistry, Physics, Astronomy, Mathematics, and Computer Science.
|
|
47
|
+
2. Technology & Engineering: Emphasize Information Technology, Engineering disciplines, AI, and Robotics.
|
|
48
|
+
3. Humanities & Cultural Studies: Highlight History, Literature, Languages, Arts, Philosophy, and Anthropological Studies.
|
|
49
|
+
4. Social Sciences & Global Studies: Include Sociology, Psychology, Economics, Political Science, Anthropology, and International Relations.
|
|
50
|
+
5. Business & Management: Encompass Entrepreneurship, Marketing, Finance, Leadership, and Ethics.
|
|
51
|
+
6. Health & Medicine: Cover Medical Sciences, Public Health, Nutrition, Wellness, and Mental Health.
|
|
52
|
+
7. Environmental Studies & Earth Sciences: Discuss Ecology, Climate Science, Geology, and Environmental Policy.
|
|
53
|
+
8. Education, Learning & Personal Development: Talk about Educational Theories, Teaching Methods, and Personal Skills.
|
|
54
|
+
9. Creative & Performing Arts: Include Visual Arts, Music, Theater, Dance, and Design Principles.
|
|
55
|
+
10. Law, Governance & Ethics: Focus on Legal Studies, Public Administration, Policy Analysis, and Ethical Decision-Making.
|
|
56
|
+
11. Recreation, Lifestyle & Practical Skills: Highlight Hobbies, Sports, Travel, Lifestyle Choices, and Practical Skills.
|
|
57
|
+
12. Technology & Media Literacy: Discuss Digital Literacy, Media Studies, and the Impact of Digital Media.
|
|
58
|
+
13. Philosophy & Critical Thinking: Emphasize Moral Philosophy, Ethical Frameworks, and Critical Thinking.
|
|
59
|
+
14. Space & Astronomical Sciences: Focus on Space Exploration, Astronomy, and Astrophysics.
|
|
60
|
+
15. Agriculture & Food Sciences: Discuss Sustainable Farming, Food Technology, and Nutrition.
|
|
61
|
+
16. Trades & Craftsmanship: Cover Hands-on Skills in Trades and Crafts.
|
|
62
|
+
17. Reference & Indexing: Include Summaries, Timelines, Directories, Glossaries, Bibliographies, and other Reference Material.
|
|
63
|
+
18. Other: Use for content that doesn’t fit into the above categories.
|
|
64
|
+
Extract key concepts within the content after classifying the field. This is a crucial part of the exercise. Be exhaustive and thorough.
|
|
65
|
+
|
|
66
|
+
1. **Definition of a Concept**: Concepts are fundamental ideas that form the basis of knowledge in any discipline. They help organize and explain information, making it accessible and relatable.
|
|
67
|
+
2. **Inclusion Criteria**: Include a concept only if it is discussed in detail and is an important part of the subject matter of the source.
|
|
68
|
+
3. **How to describe a concept**: The concept should be described so that a reader can comprehend the gist of it.
|
|
69
|
+
4. **Character Limit**: Maintain a limit of 90 characters to ensure each concept is concise yet informative.
|
|
70
|
+
5. **Reference**: Every concept must include a reference. A reference can either be the entire source or a specific heading in the source. Whenever possible, pick a main heading to direct the user to the most relevant part of the source material. The heading must exactly match one of the headings provided to you. Sometimes concepts may need to reference the entire text or multiple headings, leave the reference empty for such cases.
|
|
71
|
+
|
|
72
|
+
List the concepts in the following JSON format:
|
|
73
|
+
|
|
74
|
+
json
|
|
75
|
+
"concepts":
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
"concept_text": "concept_content",
|
|
79
|
+
"reference": "main_heading"
|
|
80
|
+
},
|
|
81
|
+
{...}
|
|
82
|
+
]
|
|
83
|
+
After classifying the content and identifying key concepts, proceed to extract and list verifiable facts.
|
|
84
|
+
|
|
85
|
+
1. **Definition of a Fact**: Ensure each fact is a standalone piece of information that is concrete and can be independently verified.
|
|
86
|
+
2. **Selection Criteria**: Inlcude facts based on their significance to the content's main themes or concepts, their educational value and their foundational role in the subject.
|
|
87
|
+
3. **Character Limit**: Maintain a limit of 90 characters for the to ensure each message is concise yet informative.
|
|
88
|
+
4. **Reference**: Every fact must include a reference. A reference can either be the entire source or a specific heading in the source. Whenever possible, pick a main heading to direct the user to the most relevant part of the source material. The heading must exactly match one of the headings provided to you. Sometimes facts may need to reference the entire text or multiple headings, leave the reference empty for such cases.
|
|
89
|
+
|
|
90
|
+
List the facts in the following JSON format:
|
|
91
|
+
|
|
92
|
+
json
|
|
93
|
+
"facts":
|
|
94
|
+
[
|
|
95
|
+
{
|
|
96
|
+
"fact_text": "fact_content",
|
|
97
|
+
"reference": "main_heading"
|
|
98
|
+
},
|
|
99
|
+
{...}
|
|
100
|
+
]
|
|
101
|
+
After you have examined the content —its field, its concepts, and its facts— determine whether it justifies the creation of quiz materials.
|
|
102
|
+
|
|
103
|
+
Consider whether these elements offer the average learner meaningful insights, practical uses, or serve important educational aims. If, in your judgment, the material falls short of providing such value, explain why in fewer than 90 characters.
|
|
104
|
+
|
|
105
|
+
Reflect your in the JSON format as follows:
|
|
106
|
+
|
|
107
|
+
json
|
|
108
|
+
"generate_cards":
|
|
109
|
+
{ state: true or false,
|
|
110
|
+
reason: "reason for marking the source as false. Leave empty for true."
|
|
111
|
+
}
|
|
112
|
+
After analyzing the content, identifying key concepts, and facts, summarize the material using a series of engaging and informative cards.
|
|
113
|
+
|
|
114
|
+
These cards should capture the essence of the content while highlighting the critical concepts and facts that you previously identified.
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
1. **Inclusion Criteria**: The generate_cards should be true. Return an empty array if the generate_cards is false.
|
|
118
|
+
2. **Summarization Objective**: Each card is a step in a journey through the content. The series should collectively summarize the source while emphasizing important learning points.
|
|
119
|
+
3. **Character Limit**: Maintain a limit of 320 characters per card to ensure each message is concise yet informative.
|
|
120
|
+
4. **Card limit**: Limit the total number of cards to less than or equal to 8.
|
|
121
|
+
4. **Engagement and Flow**: Write in an engaging style that maintains the user’s interest. Arrange the cards in a logical order that reflects the flow of the original content.
|
|
122
|
+
|
|
123
|
+
Format your output in JSON as follows:
|
|
124
|
+
|
|
125
|
+
json
|
|
126
|
+
{
|
|
127
|
+
"summary_cards": ["summary_card1_content", "summary_card2_content", "summary_card3_content", "... up to 8 summary cards"]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
`;
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
export function returnTypologyPrompt() {
|
|
139
|
+
return typologyPromptString;
|
|
140
140
|
}
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { getSimilarConcepts } from "../../helper/qdrant_db_methods";
|
|
2
|
-
|
|
3
|
-
export class GlobalConsolidation {
|
|
4
|
-
async consolidate(
|
|
5
|
-
locally_consolidated_concepts_facts: {
|
|
6
|
-
text: string;
|
|
7
|
-
type: string;
|
|
8
|
-
reference: string;
|
|
9
|
-
id: string;
|
|
10
|
-
embedding: number[];
|
|
11
|
-
}[],
|
|
12
|
-
sourceId: string,
|
|
13
|
-
threshold: number
|
|
14
|
-
) {
|
|
15
|
-
// / for all concepts_facts, find the ,most similar concepts_facts in qdrant, threshold of 0.8
|
|
16
|
-
const similarConcepts = await getSimilarConcepts(
|
|
17
|
-
"concepts-vectors",
|
|
18
|
-
locally_consolidated_concepts_facts,
|
|
19
|
-
threshold ?? 0.8
|
|
20
|
-
);
|
|
21
|
-
const taxonomyConcepts: {
|
|
22
|
-
text: string;
|
|
23
|
-
type: string;
|
|
24
|
-
reference: string;
|
|
25
|
-
id: string;
|
|
26
|
-
}[] = [];
|
|
27
|
-
|
|
28
|
-
const globalUpdatesOps: {
|
|
29
|
-
id: string;
|
|
30
|
-
sourceIdToAdd: string;
|
|
31
|
-
vector: number[];
|
|
32
|
-
currentPayload: {
|
|
33
|
-
_sources: string[];
|
|
34
|
-
text: string;
|
|
35
|
-
};
|
|
36
|
-
}[] = [];
|
|
37
|
-
|
|
38
|
-
const globalInsertsOps: {
|
|
39
|
-
id: string;
|
|
40
|
-
vector: number[];
|
|
41
|
-
payload: {
|
|
42
|
-
_sources: string[];
|
|
43
|
-
text: string;
|
|
44
|
-
};
|
|
45
|
-
}[] = [];
|
|
46
|
-
for (const index in similarConcepts) {
|
|
47
|
-
const points = similarConcepts[index].points;
|
|
48
|
-
const originalConcept = locally_consolidated_concepts_facts[index];
|
|
49
|
-
if (points.length == 0) {
|
|
50
|
-
taxonomyConcepts.push({
|
|
51
|
-
id: originalConcept.id,
|
|
52
|
-
text: originalConcept.text,
|
|
53
|
-
type: originalConcept.type,
|
|
54
|
-
reference: originalConcept.reference,
|
|
55
|
-
});
|
|
56
|
-
globalInsertsOps.push({
|
|
57
|
-
id: originalConcept.id,
|
|
58
|
-
vector: originalConcept.embedding,
|
|
59
|
-
payload: {
|
|
60
|
-
_sources: [sourceId],
|
|
61
|
-
text: originalConcept.text,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
} else {
|
|
65
|
-
const consolidatedId = points[0].id;
|
|
66
|
-
const currentPayload = points[0].payload;
|
|
67
|
-
// const currentSources = currentPayload?['_sources'] ?? [];
|
|
68
|
-
taxonomyConcepts.push({
|
|
69
|
-
id: consolidatedId.toString(),
|
|
70
|
-
text: originalConcept.text,
|
|
71
|
-
type: originalConcept.type,
|
|
72
|
-
reference: originalConcept.reference,
|
|
73
|
-
});
|
|
74
|
-
globalUpdatesOps.push({
|
|
75
|
-
id: consolidatedId.toString(),
|
|
76
|
-
sourceIdToAdd: sourceId,
|
|
77
|
-
vector: originalConcept.embedding,
|
|
78
|
-
currentPayload: {
|
|
79
|
-
// _sources: currentPayload['_sources'] ?? [],
|
|
80
|
-
_sources: (currentPayload?._sources ?? []) as string[],
|
|
81
|
-
text: (currentPayload?.text ?? "").toString(),
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
source_taxonomy: taxonomyConcepts,
|
|
88
|
-
global_updates: globalUpdatesOps,
|
|
89
|
-
global_inserts: globalInsertsOps,
|
|
90
|
-
};
|
|
91
|
-
/// if threshold is below 0.8, then add the concept_fact to qdrant
|
|
92
|
-
/// if threshold is above 0.8, then replace the id of the local concept_fact with the id of the global concept_fact
|
|
93
|
-
/// add _source.id to qdrant
|
|
94
|
-
/// return the concepts_facts
|
|
95
|
-
}
|
|
96
|
-
}
|
|
1
|
+
import { getSimilarConcepts } from "../../helper/qdrant_db_methods";
|
|
2
|
+
|
|
3
|
+
export class GlobalConsolidation {
|
|
4
|
+
async consolidate(
|
|
5
|
+
locally_consolidated_concepts_facts: {
|
|
6
|
+
text: string;
|
|
7
|
+
type: string;
|
|
8
|
+
reference: string;
|
|
9
|
+
id: string;
|
|
10
|
+
embedding: number[];
|
|
11
|
+
}[],
|
|
12
|
+
sourceId: string,
|
|
13
|
+
threshold: number
|
|
14
|
+
) {
|
|
15
|
+
// / for all concepts_facts, find the ,most similar concepts_facts in qdrant, threshold of 0.8
|
|
16
|
+
const similarConcepts = await getSimilarConcepts(
|
|
17
|
+
"concepts-vectors",
|
|
18
|
+
locally_consolidated_concepts_facts,
|
|
19
|
+
threshold ?? 0.8
|
|
20
|
+
);
|
|
21
|
+
const taxonomyConcepts: {
|
|
22
|
+
text: string;
|
|
23
|
+
type: string;
|
|
24
|
+
reference: string;
|
|
25
|
+
id: string;
|
|
26
|
+
}[] = [];
|
|
27
|
+
|
|
28
|
+
const globalUpdatesOps: {
|
|
29
|
+
id: string;
|
|
30
|
+
sourceIdToAdd: string;
|
|
31
|
+
vector: number[];
|
|
32
|
+
currentPayload: {
|
|
33
|
+
_sources: string[];
|
|
34
|
+
text: string;
|
|
35
|
+
};
|
|
36
|
+
}[] = [];
|
|
37
|
+
|
|
38
|
+
const globalInsertsOps: {
|
|
39
|
+
id: string;
|
|
40
|
+
vector: number[];
|
|
41
|
+
payload: {
|
|
42
|
+
_sources: string[];
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
45
|
+
}[] = [];
|
|
46
|
+
for (const index in similarConcepts) {
|
|
47
|
+
const points = similarConcepts[index].points;
|
|
48
|
+
const originalConcept = locally_consolidated_concepts_facts[index];
|
|
49
|
+
if (points.length == 0) {
|
|
50
|
+
taxonomyConcepts.push({
|
|
51
|
+
id: originalConcept.id,
|
|
52
|
+
text: originalConcept.text,
|
|
53
|
+
type: originalConcept.type,
|
|
54
|
+
reference: originalConcept.reference,
|
|
55
|
+
});
|
|
56
|
+
globalInsertsOps.push({
|
|
57
|
+
id: originalConcept.id,
|
|
58
|
+
vector: originalConcept.embedding,
|
|
59
|
+
payload: {
|
|
60
|
+
_sources: [sourceId],
|
|
61
|
+
text: originalConcept.text,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
const consolidatedId = points[0].id;
|
|
66
|
+
const currentPayload = points[0].payload;
|
|
67
|
+
// const currentSources = currentPayload?['_sources'] ?? [];
|
|
68
|
+
taxonomyConcepts.push({
|
|
69
|
+
id: consolidatedId.toString(),
|
|
70
|
+
text: originalConcept.text,
|
|
71
|
+
type: originalConcept.type,
|
|
72
|
+
reference: originalConcept.reference,
|
|
73
|
+
});
|
|
74
|
+
globalUpdatesOps.push({
|
|
75
|
+
id: consolidatedId.toString(),
|
|
76
|
+
sourceIdToAdd: sourceId,
|
|
77
|
+
vector: originalConcept.embedding,
|
|
78
|
+
currentPayload: {
|
|
79
|
+
// _sources: currentPayload['_sources'] ?? [],
|
|
80
|
+
_sources: (currentPayload?._sources ?? []) as string[],
|
|
81
|
+
text: (currentPayload?.text ?? "").toString(),
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
source_taxonomy: taxonomyConcepts,
|
|
88
|
+
global_updates: globalUpdatesOps,
|
|
89
|
+
global_inserts: globalInsertsOps,
|
|
90
|
+
};
|
|
91
|
+
/// if threshold is below 0.8, then add the concept_fact to qdrant
|
|
92
|
+
/// if threshold is above 0.8, then replace the id of the local concept_fact with the id of the global concept_fact
|
|
93
|
+
/// add _source.id to qdrant
|
|
94
|
+
/// return the concepts_facts
|
|
95
|
+
}
|
|
96
|
+
}
|