Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload folder using huggingface_hub
Browse files- sanatan_assistant.py +4 -3
sanatan_assistant.py
CHANGED
|
@@ -9,8 +9,9 @@ logger = logging.getLogger(__name__)
|
|
| 9 |
logger.setLevel(logging.INFO)
|
| 10 |
|
| 11 |
sanatanDatabase = SanatanDatabase()
|
|
|
|
| 12 |
allowedCollections = Literal[
|
| 13 |
-
*[scripture["collection_name"] for scripture in
|
| 14 |
]
|
| 15 |
|
| 16 |
|
|
@@ -42,7 +43,7 @@ If the user query is not small talk, use the following response format (in Markd
|
|
| 42 |
- Present a brief summary of your response in concise **English**.
|
| 43 |
|
| 44 |
### 🕉️ Scripture
|
| 45 |
-
- {
|
| 46 |
|
| 47 |
### 🕮 Chapter Title
|
| 48 |
- Mention the chapter(s) from which the references were taken. Use the field *title* here from the context if available. For example `TVM 1.8.3`
|
|
@@ -186,7 +187,7 @@ def query_by_metadata_field(
|
|
| 186 |
logger.info("Searching collection [%s] for [%s]", collection_name, query)
|
| 187 |
|
| 188 |
try:
|
| 189 |
-
|
| 190 |
except:
|
| 191 |
raise
|
| 192 |
|
|
|
|
| 9 |
logger.setLevel(logging.INFO)
|
| 10 |
|
| 11 |
sanatanDatabase = SanatanDatabase()
|
| 12 |
+
sanatanConfig = SanatanConfig()
|
| 13 |
allowedCollections = Literal[
|
| 14 |
+
*[scripture["collection_name"] for scripture in sanatanConfig.scriptures]
|
| 15 |
]
|
| 16 |
|
| 17 |
|
|
|
|
| 43 |
- Present a brief summary of your response in concise **English**.
|
| 44 |
|
| 45 |
### 🕉️ Scripture
|
| 46 |
+
- {sanatanConfig.get_scripture_by_collection(collection_name=collection_name)["title"]}
|
| 47 |
|
| 48 |
### 🕮 Chapter Title
|
| 49 |
- Mention the chapter(s) from which the references were taken. Use the field *title* here from the context if available. For example `TVM 1.8.3`
|
|
|
|
| 187 |
logger.info("Searching collection [%s] for [%s]", collection_name, query)
|
| 188 |
|
| 189 |
try:
|
| 190 |
+
sanatanConfig.is_metadata_field_allowed(collection_name=collection_name, metadata_field=metadata_field)
|
| 191 |
except:
|
| 192 |
raise
|
| 193 |
|