Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -209,6 +209,8 @@ with gr.Blocks(
|
|
| 209 |
"๐งน Sanitize": "sanitize the native verses",
|
| 210 |
"๐ Explain": "provide explanatory notes if available for the above verses",
|
| 211 |
"๐ Detailed Meaning": "provide word by word meaning if available for the above verses",
|
|
|
|
|
|
|
| 212 |
"๐๏ธ Another divya desam (same ฤzhwฤr)": "show pasuram from another divya desam by the same azhwar",
|
| 213 |
"๐ค Another ฤzhwฤr (same divya desam)": "show pasuram from the same divya desam by another azhwar",
|
| 214 |
}
|
|
|
|
| 209 |
"๐งน Sanitize": "sanitize the native verses",
|
| 210 |
"๐ Explain": "provide explanatory notes if available for the above verses",
|
| 211 |
"๐ Detailed Meaning": "provide word by word meaning if available for the above verses",
|
| 212 |
+
"๐ Explore Divya Desam": "From the same divya desam as the above pasuram, show me other pasurams",
|
| 213 |
+
"๐ Explore Ashwar": "From the same azhwar as the above pasuram, show me other pasurams",
|
| 214 |
"๐๏ธ Another divya desam (same ฤzhwฤr)": "show pasuram from another divya desam by the same azhwar",
|
| 215 |
"๐ค Another ฤzhwฤr (same divya desam)": "show pasuram from the same divya desam by another azhwar",
|
| 216 |
}
|
config.py
CHANGED
|
@@ -222,7 +222,7 @@ class SanatanConfig:
|
|
| 222 |
{
|
| 223 |
"name": "divya_desams",
|
| 224 |
"datatype": "str",
|
| 225 |
-
"description": "comma separated list of divya desams. e.g. Thiruneermalai,Thiruvallikkeni",
|
| 226 |
},
|
| 227 |
# {"name": "html_url", "datatype": "str", "description" : "Reference link for the source"},
|
| 228 |
# {"name": "pasuram_en", "datatype": "str", "description" : "Transliteration of pasuram in english"},
|
|
|
|
| 222 |
{
|
| 223 |
"name": "divya_desams",
|
| 224 |
"datatype": "str",
|
| 225 |
+
"description": "comma separated list of divya desams. e.g. Thiruneermalai,Thiruvallikkeni.",
|
| 226 |
},
|
| 227 |
# {"name": "html_url", "datatype": "str", "description" : "Reference link for the source"},
|
| 228 |
# {"name": "pasuram_en", "datatype": "str", "description" : "Transliteration of pasuram in english"},
|
db.py
CHANGED
|
@@ -12,6 +12,7 @@ from metadata import MetadataFilter, MetadataWhereClause
|
|
| 12 |
from modules.db.relevance import validate_relevance_queryresult
|
| 13 |
from tqdm import tqdm
|
| 14 |
|
|
|
|
| 15 |
logger = logging.getLogger(__name__)
|
| 16 |
logger.setLevel(logging.INFO)
|
| 17 |
|
|
@@ -183,10 +184,10 @@ class SanatanDatabase:
|
|
| 183 |
)
|
| 184 |
if literal_to_search_for is None or literal_to_search_for.strip() == "":
|
| 185 |
logger.warning("Nothing to search literally.")
|
| 186 |
-
|
| 187 |
-
return self.fetch_random_data(
|
| 188 |
-
|
| 189 |
-
)
|
| 190 |
collection = self.chroma_client.get_or_create_collection(name=collection_name)
|
| 191 |
|
| 192 |
def normalize(text):
|
|
|
|
| 12 |
from modules.db.relevance import validate_relevance_queryresult
|
| 13 |
from tqdm import tqdm
|
| 14 |
|
| 15 |
+
logging.basicConfig()
|
| 16 |
logger = logging.getLogger(__name__)
|
| 17 |
logger.setLevel(logging.INFO)
|
| 18 |
|
|
|
|
| 184 |
)
|
| 185 |
if literal_to_search_for is None or literal_to_search_for.strip() == "":
|
| 186 |
logger.warning("Nothing to search literally.")
|
| 187 |
+
raise Exception("query cannot be None or empty for a literal search!")
|
| 188 |
+
# return self.fetch_random_data(
|
| 189 |
+
# collection_name=collection_name,
|
| 190 |
+
# )
|
| 191 |
collection = self.chroma_client.get_or_create_collection(name=collection_name)
|
| 192 |
|
| 193 |
def normalize(text):
|
modules/nodes/init.py
CHANGED
|
@@ -20,6 +20,7 @@ def init_system_prompt_node(state: ChatState) -> ChatState:
|
|
| 20 |
"collection_name",
|
| 21 |
"metadata_fields",
|
| 22 |
"llm_hints",
|
|
|
|
| 23 |
]
|
| 24 |
)
|
| 25 |
messages += [
|
|
@@ -47,30 +48,20 @@ In the header at the end for the field `verse_or_page`, show the `verse` or `pag
|
|
| 47 |
---
|
| 48 |
|
| 49 |
### โ
Default Response Format (always include unless it is a followup question and/or user requests specific details only)
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
### ๐ Verse Number
|
| 61 |
-
- Show verse number if available else skip the entire section including header. If available show this as a hyperlink with `html_url` if html_url is available.
|
| 62 |
-
|
| 63 |
-
### ๐ Title
|
| 64 |
-
- Show `title` if available else skip the entire section including header.
|
| 65 |
-
|
| 66 |
-
### ๐ Page
|
| 67 |
-
- Show `page` if available else skip the entire section including header.
|
| 68 |
-
|
| 69 |
### ๐ Original Verse
|
| 70 |
- Show exact original native-script verses from the context in a separate markdown block.
|
| 71 |
- Do not translate, transliterate, or explain.
|
| 72 |
- Preserve line breaks and spacing exactly.
|
| 73 |
-
|
| 74 |
### ๐ Sanitized Verse(s)
|
| 75 |
- Only include this section if sanitization changes anything otherwise don't even output the section heading .
|
| 76 |
- Sanitize by:
|
|
@@ -78,7 +69,6 @@ In the header at the end for the field `verse_or_page`, show the `verse` or `pag
|
|
| 78 |
2. Correcting broken diacritics, pulli markers, vowel signs, and punctuation.
|
| 79 |
3. Preserving original spacing and line order.
|
| 80 |
- If no change โ skip this section entirely including the heading.
|
| 81 |
-
|
| 82 |
### ๐ {state['language']} โ Simple Meaning
|
| 83 |
- Give a **short, natural summary/meaning** in {state['language']}.
|
| 84 |
- Keep it concise and error-free. Do not give word-by-word meanings here even if available.
|
|
|
|
| 20 |
"collection_name",
|
| 21 |
"metadata_fields",
|
| 22 |
"llm_hints",
|
| 23 |
+
"unit"
|
| 24 |
]
|
| 25 |
)
|
| 26 |
messages += [
|
|
|
|
| 48 |
---
|
| 49 |
|
| 50 |
### โ
Default Response Format (always include unless it is a followup question and/or user requests specific details only)
|
| 51 |
+
- Show the following sections only if data is available else skip the entire section including header. Do not show a heading without a value.
|
| 52 |
+
- Some scriptures are captured by page and some by verse. DO NOT not show both. show verse if available if not, look for page.
|
| 53 |
+
- Author is called Azhwar (เฎเฎดเฏเฎตเฎพเฎฐเฏ) in the context of divya_prabandham scripture.
|
| 54 |
+
- Scripture is calledd เฎฎเฎฑเฏเฎจเฏเฎฒเฏ in Tamil.
|
| 55 |
+
> ๐๏ธ **Scripture** : `collection`
|
| 56 |
+
> ๐ **Divya Desams** : `divya_desams`
|
| 57 |
+
> โ๏ธ **Author** : Show `author`
|
| 58 |
+
> ๐ **Verse Number** : `verse` number
|
| 59 |
+
> ๐ **Title** : `title`
|
| 60 |
+
> ๐ **Page** : `page`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
### ๐ Original Verse
|
| 62 |
- Show exact original native-script verses from the context in a separate markdown block.
|
| 63 |
- Do not translate, transliterate, or explain.
|
| 64 |
- Preserve line breaks and spacing exactly.
|
|
|
|
| 65 |
### ๐ Sanitized Verse(s)
|
| 66 |
- Only include this section if sanitization changes anything otherwise don't even output the section heading .
|
| 67 |
- Sanitize by:
|
|
|
|
| 69 |
2. Correcting broken diacritics, pulli markers, vowel signs, and punctuation.
|
| 70 |
3. Preserving original spacing and line order.
|
| 71 |
- If no change โ skip this section entirely including the heading.
|
|
|
|
| 72 |
### ๐ {state['language']} โ Simple Meaning
|
| 73 |
- Give a **short, natural summary/meaning** in {state['language']}.
|
| 74 |
- Keep it concise and error-free. Do not give word-by-word meanings here even if available.
|