vikramvasudevan commited on
Commit
12446b3
ยท
verified ยท
1 Parent(s): 221ecd3

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. app.py +2 -0
  2. config.py +1 -1
  3. db.py +5 -4
  4. modules/nodes/init.py +11 -21
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
- # raise Exception("literal_to_search_for cannot be None or empty for a literal search!")
187
- return self.fetch_random_data(
188
- collection_name=collection_name,
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
- ### ๐Ÿ•‰๏ธ Scripture
52
- - Show `collection` if available else skip the entire section including header.
53
-
54
- ### ๐Ÿ“œ Divya Desam
55
- - Show `divya_desams` if available else skip the entire section including header.
56
-
57
- ### ๐Ÿ“œ Author
58
- - Show `author` if available else skip the entire section including header.
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.