only_ever_generator 0.4.3 → 0.4.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.
@@ -1259,54 +1259,86 @@ export function returnFields(){
1259
1259
 
1260
1260
  const sourceContent = {
1261
1261
  type:'source',
1262
- title: 'Time zone',
1262
+ title: 'Sunni Islam',
1263
1263
  headings: headings,
1264
1264
  content: sourceString,
1265
1265
  fields: returnFields(),
1266
- "taxonomy": {
1267
- "fields": [
1268
- {
1269
- "primary_field": "Reference & Indexing",
1270
- "reconcile": false
1271
- },
1272
- {
1273
- "secondary_field": "History",
1274
- "reconcile": true
1275
- },
1276
- {
1277
- "tertiary_field": "Technology & Media Literacy",
1278
- "reconcile": false
1266
+ taxonomy: {
1267
+ "fields": [
1268
+ {
1269
+ "primary_field": "Humanities & Cultural Studies",
1270
+ "reconcile": false
1271
+ },
1272
+ {
1273
+ "secondary_field": "Social Sciences & Global Studies",
1274
+ "reconcile": false
1275
+ },
1276
+ {
1277
+ "tertiary_field": "Other",
1278
+ "reconcile": false
1279
+ }
1280
+ ],
1281
+ "concepts": [
1282
+ {
1283
+ "concept_text": "Definition of Sunni Islam",
1284
+ "reference": "Sunni Islam#Terminology"
1285
+ },
1286
+ {
1287
+ "concept_text": "History of Sunni beliefs",
1288
+ "reference": "Sunni Islam#History"
1289
+ },
1290
+ {
1291
+ "concept_text": "Sunni jurisprudence and its sources",
1292
+ "reference": "Sunni Islam#Jurisprudence"
1293
+ },
1294
+ {
1295
+ "concept_text": "Principal articles of Sunni faith",
1296
+ "reference": "Sunni Islam#Pillars of iman"
1297
+ },
1298
+ {
1299
+ "concept_text": "Sunni organizations and institutions",
1300
+ "reference": "Sunni Islam#Sunni State institutions"
1301
+ },
1302
+ {
1303
+ "concept_text": "Identity as the 'saved sect'",
1304
+ "reference": "Sunni Islam#Self-image of the Sunnis"
1305
+ },
1306
+ {
1307
+ "concept_text": "Rivalry between Sunni theological schools",
1308
+ "reference": "Sunni Islam#Rivalry between Ashʿarīya and Salafīya and the 2016 Sunni conferences"
1309
+ }
1310
+ ],
1311
+ "facts": [
1312
+ {
1313
+ "fact_text": "85-90% of Muslims are Sunni.",
1314
+ "reference": "Sunni Islam#Terminology"
1315
+ },
1316
+ {
1317
+ "fact_text": "The first four caliphs are Abu Bakr, Umar, Uthman, Ali.",
1318
+ "reference": "Sunni Islam#History"
1319
+ },
1320
+ {
1321
+ "fact_text": "Sunni Islam centers around four legal schools.",
1322
+ "reference": "Sunni Islam#Jurisprudence"
1323
+ },
1324
+ {
1325
+ "fact_text": "The six pillars of imān are key beliefs in Sunni Islam.",
1326
+ "reference": "Sunni Islam#Pillars of iman"
1327
+ },
1328
+ {
1329
+ "fact_text": "Azhar University is a leading Sunni institution.",
1330
+ "reference": "Sunni Islam#Sunni State institutions"
1331
+ },
1332
+ {
1333
+ "fact_text": "Sunnis view themselves as the saved sect.",
1334
+ "reference": "Sunni Islam#Self-image of the Sunnis"
1335
+ }
1336
+ ],
1337
+ "generate_cards": {
1338
+ "state": true,
1339
+ "reason": ""
1279
1340
  }
1280
- ],
1281
- "concepts": [
1282
- "Latin alphabet",
1283
- "Phonetic alphabet",
1284
- "International Phonetic Alphabet",
1285
- "Voiced labiodental fricative",
1286
- "Orthography",
1287
- "Frequency in English language",
1288
- "Scrabble letter frequency",
1289
- "Pronunciation in different languages",
1290
- "Latin alphabet evolution",
1291
- "Ligatures and abbreviations in Latin",
1292
- "Periodic table element symbolism"
1293
- ],
1294
- "facts": [
1295
- "V is the twenty-second letter in the Latin alphabet.",
1296
- "It is used in the modern English alphabet and the alphabets of other western European languages.",
1297
- "V comes from the Phoenician letter *waw* by way of U.",
1298
- "During the Late Middle Ages, the pointed form \"v\" was used at the beginning of a word, while a rounded form \"u\" was used in the middle or end, regardless of sound.",
1299
- "V is the sixth least frequently used letter in the English language, with a frequency of about 1% in words.",
1300
- "V is not used to form an English two-letter word in the British and Australian versions of Scrabble.",
1301
- "The letter V represents the voiced labiodental fricative in the International Phonetic Alphabet.",
1302
- "V is also used as a symbol for the chemical element vanadium on the periodic table.",
1303
- "Ligatures and abbreviations such as ℣ and Ꝟ were used for medieval scribal abbreviations."
1304
- ],
1305
- "generate_cards": {
1306
- "state": true,
1307
- "false_reason": ""
1308
1341
  }
1309
- },
1310
1342
 
1311
1343
  }
1312
1344
 
@@ -1319,4 +1351,8 @@ export function returnHeadings(){
1319
1351
  }
1320
1352
 
1321
1353
 
1354
+ export function returnCardResponse(){
1355
+ return JSON.parse(`{"status_code":200,"usage_data":{"prompt_tokens":23234,"completion_tokens":2796,"total_tokens":26030},"generated_content":{"test_cards":[{"type":"mcq","card_content":{"prompt":"Which term is used to refer to the largest branch of Islam, followed by 85-90% of Muslims worldwide?","choices":[{"choice":"Sunni Islam","is_correct":true},{"choice":"Shia Islam","is_correct":false},{"choice":"Kharijites","is_correct":false},{"choice":"Ibadi","is_correct":false}]},"concepts":[{"concept_text":"Definition of Sunni Islam","reference":"Sunni Islam#Terminology"}],"facts":[{"fact_text":"85-90% of Muslims are Sunni.","reference":"Sunni Islam#Terminology"}],"bloom_level":1},{"type":"mcq","card_content":{"prompt":"Who were the first four caliphs recognized by Sunnis?","choices":[{"choice":"Abu Bakr, Umar, Uthman, Ali","is_correct":true},{"choice":"Ali, Hasan, Husayn, Yazid","is_correct":false},{"choice":"Umar, Uthman, Muawiya, Yazid","is_correct":false},{"choice":"Hasan, Husayn, Abu Bakr, Umar","is_correct":false}]},"concepts":[{"concept_text":"History of Sunni beliefs","reference":"Sunni Islam#History"}],"facts":[{"fact_text":"The first four caliphs are Abu Bakr, Umar, Uthman, Ali.","reference":"Sunni Islam#History"}],"bloom_level":1},{"type":"cloze","card_content":{"prompt":"The six {{c0: pillars}} of imān are key beliefs in Sunni Islam.","options":[{"option":"pillars","cloze":"c0"},{"option":"caliphs","cloze":"null"},{"option":"sections","cloze":"null"},{"option":"rules","cloze":"null"}]},"concepts":[{"concept_text":"Principal articles of Sunni faith","reference":"Sunni Islam#Pillars of iman"}],"facts":[{"fact_text":"The six pillars of imān are key beliefs in Sunni Islam.","reference":"Sunni Islam#Pillars of iman"}],"bloom_level":1},{"type":"mcq","card_content":{"prompt":"Which institution is considered a leading Sunni university?","choices":[{"choice":"Azhar University","is_correct":true},{"choice":"Harvard University","is_correct":false},{"choice":"Oxford University","is_correct":false},{"choice":"Yale University","is_correct":false}]},"concepts":[{"concept_text":"Sunni organizations and institutions","reference":"Sunni Islam#Sunni State institutions"}],"facts":[{"fact_text":"Azhar University is a leading Sunni institution.","reference":"Sunni Islam#Sunni State institutions"}],"bloom_level":1},{"type":"mcq","card_content":{"prompt":"What is a fundamental self-image of Sunni Muslims concerning their religious identity?","choices":[{"choice":"They are the saved sect","is_correct":true},{"choice":"They are the oppressed sect","is_correct":false},{"choice":"They are the innovators","is_correct":false},{"choice":"They are the deviants","is_correct":false}]},"concepts":[{"concept_text":"Identity as the 'saved sect'","reference":"Sunni Islam#Self-image of the Sunnis"}],"facts":[{"fact_text":"Sunnis view themselves as the saved sect.","reference":"Sunni Islam#Self-image of the Sunnis"}],"bloom_level":1},{"type":"mcq","card_content":{"prompt":"What major rivalry exists within Sunni Islam?","choices":[{"choice":"Between Ashʿarīya and Salafīya","is_correct":true},{"choice":"Between Sufis and Wahhabis","is_correct":false},{"choice":"Between Hanafis and Malikis","is_correct":false},{"choice":"Between Shafi'is and Hanbalis","is_correct":false}]},"concepts":[{"concept_text":"Rivalry between Sunni theological schools","reference":"Sunni Islam#Rivalry between Ashʿarīya and Salafīya and the 2016 Sunni conferences"}],"facts":[],"bloom_level":1},{"type":"cloze","card_content":{"prompt":"Sunni Islam centers around four {{c0: legal schools}}.","options":[{"option":"legal schools","cloze":"c0"},{"option":"pillars of faith","cloze":"null"},{"option":"caliphs","cloze":"null"},{"option":"sects","cloze":"null"}]},"concepts":[{"concept_text":"Sunni jurisprudence and its sources","reference":"Sunni Islam#Jurisprudence"}],"facts":[{"fact_text":"Sunni Islam centers around four legal schools.","reference":"Sunni Islam#Jurisprudence"}],"bloom_level":1},{"type":"match","card_content":{"ash'ari":"Founded by Abu al-Hasan al-Ash'ari","maturidi":"Founded by Abu Mansur al-Maturidi","athari":"Strict textualism in interpreting Qur'an and sunnah"},"concepts":[{"concept_text":"Rivalry between Sunni theological schools","reference":"Sunni Islam#Rivalry between Ashʿarīya and Salafīya and the 2016 Sunni conferences"}],"facts":[],"bloom_level":2},{"type":"mcq","card_content":{"prompt":"Which of the following is NOT one of the six principal articles of faith in Sunni Islam?","choices":[{"choice":"Belief in the Prophets of God","is_correct":false},{"choice":"Belief in Angels","is_correct":false},{"choice":"Belief in Trinity","is_correct":true},{"choice":"Belief in Resurrection after Death","is_correct":false}]},"concepts":[{"concept_text":"Principal articles of Sunni faith","reference":"Sunni Islam#Pillars of iman"}],"facts":[],"bloom_level":2},{"type":"cloze","card_content":{"prompt":"A well-known Hadith says that the Muslim Umma will split into 73 sects, only one of which will be {{c0: saved}}.","options":[{"option":"saved","cloze":"c0"},{"option":"punished","cloze":"null"},{"option":"enriched","cloze":"null"},{"option":"condemned","cloze":"null"}]},"concepts":[{"concept_text":"Identity as the 'saved sect'","reference":"Sunni Islam#Self-image of the Sunnis"}],"facts":[],"bloom_level":2},{"type":"mcq","card_content":{"prompt":"What does 'jama' in the phrase 'ahl as-sunna wal-jama' signify?","choices":[{"choice":"Community","is_correct":true},{"choice":"Unity","is_correct":false},{"choice":"Faith","is_correct":false},{"choice":"Law","is_correct":false}]},"concepts":[{"concept_text":"Definition of Sunni Islam","reference":"Sunni Islam#Terminology"}],"facts":[],"bloom_level":1},{"type":"mcq","card_content":{"prompt":"Which of the following sources forms the basis for Sunni jurisprudence?","choices":[{"choice":"The Quran and Hadith","is_correct":true},{"choice":"Solely Quran","is_correct":false},{"choice":"Only the Hadith","is_correct":false},{"choice":"The Quran and Sira","is_correct":false}]},"concepts":[{"concept_text":"Sunni jurisprudence and its sources","reference":"Sunni Islam#Jurisprudence"}],"facts":[],"bloom_level":2},{"type":"cloze","card_content":{"prompt":"Sunni Muslims accept the {{c0: hadith}} collections of Bukhari and Muslim as the most authentic.","options":[{"option":"hadith","cloze":"c0"},{"option":"Qur'an","cloze":"null"},{"option":"tafsir","cloze":"null"},{"option":"fatwa","cloze":"null"}]},"concepts":[{"concept_text":"Sunni view of hadith","reference":"Sunni Islam#Sunni view of hadith"}],"facts":[],"bloom_level":1},{"type":"cloze","card_content":{"prompt":"Sunni jurisprudence is derived from the Quran, hadith, {{c0: juristic consensus}}, and analogical reasoning.","options":[{"option":"juristic consensus","cloze":"c0"},{"option":"personal opinion","cloze":"null"},{"option":"cultural practice","cloze":"null"},{"option":"political authority","cloze":"null"}]},"concepts":[{"concept_text":"Sunni jurisprudence and its sources","reference":"Sunni Islam#Jurisprudence"}],"facts":[],"bloom_level":3},{"type":"cloze","card_content":{"prompt":"One of the most important teaching institutions of Sunni Islam worldwide is the {{c0: Azhar}} in Egypt.","options":[{"option":"Azhar","cloze":"c0"},{"option":"Al-Haram","cloze":"null"},{"option":"Al-Aqsa","cloze":"null"},{"option":"Blue Mosque","cloze":"null"}]},"concepts":[{"concept_text":"Sunni organizations and institutions","reference":"Sunni Islam#Sunni State institutions"}],"facts":[{"fact_text":"Azhar University is a leading Sunni institution.","reference":"Sunni Islam#Sunni State institutions"}],"bloom_level":2}]},"generated_at":"2024-09-11T08:26:12.000Z"}`);
1356
+ }
1357
+
1322
1358
 
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  // import express from "express";
2
2
  // import {
3
+ // returnCardResponse,
4
+ // returnHeadings,
3
5
  // returnSourceData,
4
6
  // } from "./constants/source_data";
5
7
  // import config from "./config";
@@ -8,6 +10,8 @@
8
10
 
9
11
  import { OnlyEverGenerator } from "./bootstrap/app";
10
12
  // import { returnPromptData } from "./constants/prompt_data";
13
+ // import { GenerateCards } from "./card_gen/generate_cards";
14
+ // import { OpenAiService } from "./services/open_ai_service";
11
15
 
12
16
  /// While Publishing the package , and using this code as a separate npm module
13
17
  /// uncomment the below line and comment all the others, expect the import of OnlyEverGenerator
@@ -33,10 +37,24 @@ import { OnlyEverGenerator } from "./bootstrap/app";
33
37
  // // let content = returnSourceData().toString()
34
38
  // // let headings = returnHeadings();
35
39
  // // // let aiRequest = await openAIRequest(prompt,content);
36
- // let aiRequest = await oeGen.generate(false,true);
40
+ // let aiRequest = await oeGen.generate(true,true);
37
41
  // res.send(aiRequest);
38
42
  // });
39
43
 
44
+ // app.get("/parseCardData", async(req,res)=>{
45
+ // let cardResp = returnCardResponse();
46
+ // let headings = returnHeadings();
47
+ // cardResp.metadata = {
48
+ // "req_time": cardResp.generated_at ?? new Date(),
49
+ // "req_type": cardResp.type,
50
+ // "req_tokens": cardResp.usage_data?.prompt_tokens,
51
+ // "res_tokens": cardResp.usage_data?.completion_tokens,
52
+ // "model": '40-mini'
53
+ // };
54
+ // let parsedData = new GenerateCards(new OpenAiService("","")).parse(cardResp,false,headings);
55
+ // res.send(parsedData)
56
+ // });
57
+
40
58
  // // app.get("/typology", async (req, res) => {
41
59
  // // {
42
60
  // // let typologyPrompt = returnTypologyPrompt();
@@ -1,7 +1,6 @@
1
1
  import axios from "axios";
2
2
  import { parseOpenAiFailureResponse, parseOpenAiSuccessResponse } from "../utils/parse_openai_response";
3
3
  import { openAiEndPoint } from "../constants/api_constants";
4
- import { ErrorLogger } from "../logger";
5
4
 
6
5
 
7
6
  export class OpenAiService{