sanatan_ai / modules /config /divya_prabandham.py
vikramvasudevan's picture
Upload folder using huggingface_hub
1d00c8a verified
from modules.config.categories import ScriptureCategoryConstants
from modules.google_drive.google_drive_utils import convert_drive_url_to_direct
import nalayiram_helper
divya_prabandham_config = {
"name": "divya_prabandham",
"title": "4000 Divya Prabandham",
"banner_url": convert_drive_url_to_direct(
"https://drive.google.com/file/d/1bGdlERDvBiO7wbOOo3cO8vYclyFYbGdk/view?usp=drive_link"
),
"category": ScriptureCategoryConstants.LITERATURE,
"output_dir": "./output/divya_prabandham",
"collection_name": "divya_prabandham",
"collection_embedding_fn": "openai",
"unit": "pasuram",
"unit_field": "verse",
"field_mapping": {
"text": "pasuram_ta",
"title": lambda doc: f"{doc.get('prabandham_name','')} {doc.get('chapter','')}-{doc.get('decade','')}:{doc.get('position_in_chapter','')}",
"location": "divya_desams",
"word_by_word_native": "wbw_ta",
"unit_index": "verse",
"transliteration": "pasuram_en",
"translation": lambda doc: " ".join(
f"{header}: {doc.get(key, '').strip()}"
for key, header in [
("simple_en", "Simple"),
("purport_en", "Purport"),
("explanatory_notes_en", "Notes"),
]
if doc.get(key)
),
# "transliteration_v2": {
# "english": "pasuram_en",
# "hindi": "pasuram_hi",
# "telugu": "pasuram_te",
# "kannada": "pasuram_kn",
# "malayalam": "pasuram_ma",
# "bengali": "pasuram_bn",
# "gujarati": "pasuram_gj",
# },
"reference_link": "html_url",
"author": "azhwar_name",
# "chapter_name": "prabandham_name",
"relative_path": lambda doc: "-".join(
filter(
None,
[
doc.get("prabandham_name", ""),
*(
str(doc.get(k))
for k in ["decade", "chapter", "position_in_chapter"]
if doc.get(k, -1) != -1
),
],
)
),
},
"metadata_fields": [
{
"name": "prabandham_code",
"label": "Prabandham Code",
"datatype": "str",
"description": "contains the short prabandham_code. e.g. `TPL` for `Thiruppallandu`",
},
{
"name": "prabandham_name",
"label": "Prabandham Name",
"datatype": "str",
"description": "contains the prabandham name. e.g. `Thiruppallandu`",
"show_as_filter": True,
"component": "dropdown",
"lov": lambda: [
p.prabandham_name
for p in nalayiram_helper.get_standardized_prabandham_names()
],
},
{
"name": "azhwar_name",
"label": "Azhwar Name",
"datatype": "str",
"description": "contains the azhwar name. e.g. `Thirumangai Azhwar`",
"show_as_filter": True,
"component": "dropdown",
"lov": lambda: [
azhwar_name
for azhwar_name in nalayiram_helper.get_standardized_azhwar_names()
],
},
{
"name": "divya_desams",
"label": "Divya Desams",
"datatype": "str",
"description": "comma separated list of divya desams. e.g. Thiruneermalai,Thiruvallikkeni.",
"show_as_filter": True,
"component": "dropdown",
"lov": lambda: [
divya_desam_name
for divya_desam_name in nalayiram_helper.get_standardized_divya_desam_names()
],
},
{
"name": "verse",
"label": "Absolute Pasuram Number",
"datatype": "int",
"is_unique": True,
"description": (
"Absolute verse number or pasuram number. Each verse has a unique number."
# "Use it only when a specific prabandham name is NOT mentioned in the user query."
"For e.g. 'Give me pasuram 1176'"
),
"show_as_filter": True,
},
{
"name": "decade",
"label": "Decade Number (Pathu)",
"datatype": "int",
"description": (
"The decade (or `pathu` in Tamil) that this pasuram belongs to. decade is -1 when there is no associated decade."
),
"show_as_filter": True,
},
{
"name": "chapter",
"label": "Chapter Number",
"datatype": "int",
"description": (
"chapter number of this pasuram. is -1 when there is no associated chapter number"
),
"show_as_filter": True,
},
{
"name": "position_in_chapter",
"label": "Relative Pasuram Number",
"datatype": "int",
"description": (
"Relative verse number or pasuram number within a chapter."
"Use it only when a specific prabandham name is mentioned in the user query."
"For e.g. 'Give me the 5th pasuram from Thirupavai'"
),
"show_as_filter": True,
},
{
"name": "title",
"label": "Pasuram Title",
"datatype": "str",
"description": (
"Exact title of a pasuram in one of the following formats:\n"
"1. '{prabandham_code} {decade}.{chapter}.{pasuram}' — use when the prabandham has decades.\n"
"2. '{prabandham_code} {chapter}.{pasuram}' — use when the prabandham does not have decades.\n\n"
"⚠️ Use this field ONLY when the user provides a specific prabandham and a relative verse number.\n"
"Examples of valid usage:\n"
"- User query: '3rd pasuram in the 8th Thiruvaimozhi of the 1st decade.'\n"
" → Convert to: '{prabandham_code} 1.8.3' and pass as `title` filter.\n"
"- User query: '2nd pasuram of chapter 5 in [Prabandham with no decades].'\n"
" → Convert to: '{prabandham_code} 5.2' and pass as `title` filter.\n"
"Do NOT use `title` for general queries or keyword searches — leave it empty in those cases."
),
"show_as_filter": True,
},
{
"name": "pasuram_en",
"label": "Pasuram Lyrics in English",
"datatype": "str",
"description": "Pasuram lyrics in English",
"show_as_filter": True,
},
{
"name": "pasuram_ta",
"label": "Pasuram Lyrics in Tamil",
"datatype": "str",
"description": "Pasuram lyrics in Tamil",
"show_as_filter": True,
},
],
"pdf_path": "./data/divya_prabandham.pdf",
"source": "https://uveda.org",
"language": "tamil",
"example_labels": [
"About the five elements",
"About Garuda",
"Pasuram about Krishna's Flute",
"Andal's pasuram",
"Specific Pasuram (absolute)",
"Pasuram by Azhwar",
"Specific pasuram(relative)",
"Decade and Chapter Search",
],
"examples": [
"five elements and their significance as defined in divya_prabandham",
"What is the significance of Garuda? Show some verses from divya prabandham that describe him.",
"Show me a pasuram that talks about how the animals and birds enjoy Krishna's flute playing.",
"Give me a pasuram by Andal",
"Show me Pasuram 1187 ",
"Show me a pasuram by Thondaradippodi azhwar",
"Give me the 2nd pasuram in the 3rd Thiruvaimozhi from the 2nd decade",
"Give me just a few words from the starting lines and reference links of all 11 pasurams from thiruvaimozhi 5th decade 4th chapter.",
],
"llm_hints": [
"If the user wishes to query at a decade or chapter level for a given prabandham, use the direct metadata query on the appropriate fields once instead of querying the tool multiple times for each pasuram from the chapter."
],
"credits": {
"art": [
{
"name": "Sri TNCN",
"url": "https://www.linkedin.com/in/narashiman-chakravarthy-54326111/",
"role": "Illustrator",
"notes": "Original artwork used with permission",
"photo_url": "https://drive.google.com/uc?export=download&id=1D4Vo-Mvkp1RdZR6whUkcjvNBIW1yHSUE",
}
],
"data": [
{
"name": "UVeda",
"url": "https://uveda.org",
"role": "Data contributor",
"photo_url": "https://www.uveda.org/_next/image?url=%2Fuveda-logo.png&w=750&q=75",
}
],
"audio": [
{
"name": "Sri Vasudevan Srinivasachariar Swamy(Srirangam)",
"url": "https://www.youtube.com/@akivasudev",
"role": "Recitation audio contributor",
"context": [
{
"start": 3893,
"end": 4000,
"description": "Iramanusa Nootrandhadhi",
}
],
"photo_url": "https://drive.google.com/uc?export=download&id=1HB1Nr39j2-55rIeOK_wYNbZZndcGZIaf",
},
{
"name": "Sri TNCN Swamy(Triplicane)",
"url": "https://www.linkedin.com/in/narashiman-chakravarthy-54326111/",
"role": "Recitation audio contributor",
"context": [
{"start": 2791, "end": 3791, "description": "Thiruvaimozhi"}
],
"photo_url": "https://drive.google.com/uc?export=download&id=1D4Vo-Mvkp1RdZR6whUkcjvNBIW1yHSUE",
},
{
"name": "Sri Kongilachan Balaji Kesavan Swamy(Srirangam)",
"url": "https://www.facebook.com/people/Balaji-Kesavan/100008292615438/",
"role": "Recitation audio contributor",
"context": [
{"start": 2578, "end": 2584, "description": "Thiruvasiriyam"}
],
"photo_url": "https://drive.google.com/uc?export=download&id=1ItOHxE8RHsS2L8z805ycx8CaQsqHgM4v",
},
{
"name": "Srirangam Vikram Vasudevan",
"url": "https://www.youtube.com/@onedayonepasuram6126",
"role": "Virutham audio contributor",
"photo_url": "https://yt3.googleusercontent.com/lA5fiJuRDVGxOLkszb6O5DaiR1N7WcRVDHtJSQjO8IxCK-Y3VfMtYZP2Wm1SP0gUx8vj87jA=s160-c-k-c0x00ffffff-no-rj",
},
],
"video": [
{
"name": "Dr Venkatesh Swamy",
"url": "https://www.youtube.com/@DrVenkateshUpanyasams",
"role": "Upanyasam video contributor",
"context": [{"start": 474, "end": 503, "description": "Thiruppaavai"}],
"photo_url": "https://yt3.googleusercontent.com/d0si0mS7oSShUSEfe3mnPx2Wu8HN8ei7A_twQVf8y0aq-tqz_KmrfS5PjicsqnaAzVdFMace=s160-c-k-c0x00ffffff-no-rj",
},
{
"name": "Sri Agaram Seshadri Vijayaraghavan Swamy",
"url": "https://www.youtube.com/@jagadacharya2405",
"role": "Upanyasam video contributor",
"context": [{"start": 474, "end": 503, "description": "Thiruppaavai"}],
"photo_url": "https://drive.google.com/uc?export=download&id=1sM9-BiYRbjABJeihk5q6E2Lc5gc0_72V",
},
{
"name": "Srirangam Vikram Vasudevan",
"url": "https://www.youtube.com/@onedayonepasuram6126",
"role": "Virutham video contributor",
"context": [{"start": 1, "end": 4000}],
"photo_url": "https://yt3.googleusercontent.com/lA5fiJuRDVGxOLkszb6O5DaiR1N7WcRVDHtJSQjO8IxCK-Y3VfMtYZP2Wm1SP0gUx8vj87jA=s160-c-k-c0x00ffffff-no-rj",
},
],
},
}