Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 12,278 Bytes
d3787d1 7be9035 3c0fb3e 7be9035 bed1e4f 3c0fb3e b11b469 3c0fb3e cc0b1f9 3c0fb3e ec48ce1 3c0fb3e bed1e4f 2206423 bed1e4f 0104a30 2206423 b11b469 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 2206423 bed1e4f 6ad8f62 bed1e4f 2206423 bed1e4f 3c0fb3e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
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",
},
],
},
}
|