Update app.py
Browse files
app.py
CHANGED
@@ -119,14 +119,14 @@ def fetch_context(db, model, query, template, use_compressor=True):
|
|
119 |
retriever = db.as_retriever(search_type = "mmr")
|
120 |
compression_retriever = ContextualCompressionRetriever(base_compressor=compressor,
|
121 |
base_retriever=retriever)
|
122 |
-
logger.info(f"User Query : {query}")
|
123 |
compressed_docs = compression_retriever.get_relevant_documents(query)
|
124 |
-
logger.info(f"Retrieved Compressed Docs : {compressed_docs}")
|
125 |
|
126 |
return compressed_docs
|
127 |
|
128 |
docs = db.max_marginal_relevance_search(query)
|
129 |
-
logger.info(f"Retrieved Docs : {docs}")
|
130 |
|
131 |
return docs
|
132 |
|
@@ -240,7 +240,7 @@ if __name__=="__main__":
|
|
240 |
|
241 |
model_name = "llama" if device=="cpu" else "mistral"
|
242 |
|
243 |
-
logger.info(f
|
244 |
|
245 |
|
246 |
all_templates = { "llama_prompt_template" : """<s>[INST]\n<<SYS>>\nYou are a stoic teacher that provide guidance and advice inspired by Stoic philosophy on navigating life's challenges with resilience and inner peace. Emphasize the importance of focusing on what is within one's control and accepting what is not. Encourage the cultivation of virtue, mindfulness, and self-awareness as tools for achieving eudaimonia. Advocate for enduring hardships with fortitude and maintaining emotional balance in all situations. Your response should reflect Stoic principles of living in accordance with nature and embracing the rational order of the universe.
|
|
|
119 |
retriever = db.as_retriever(search_type = "mmr")
|
120 |
compression_retriever = ContextualCompressionRetriever(base_compressor=compressor,
|
121 |
base_retriever=retriever)
|
122 |
+
#logger.info(f"User Query : {query}")
|
123 |
compressed_docs = compression_retriever.get_relevant_documents(query)
|
124 |
+
#logger.info(f"Retrieved Compressed Docs : {compressed_docs}")
|
125 |
|
126 |
return compressed_docs
|
127 |
|
128 |
docs = db.max_marginal_relevance_search(query)
|
129 |
+
#logger.info(f"Retrieved Docs : {docs}")
|
130 |
|
131 |
return docs
|
132 |
|
|
|
240 |
|
241 |
model_name = "llama" if device=="cpu" else "mistral"
|
242 |
|
243 |
+
logger.info(f"Running {model_name} model for inference on {device}")
|
244 |
|
245 |
|
246 |
all_templates = { "llama_prompt_template" : """<s>[INST]\n<<SYS>>\nYou are a stoic teacher that provide guidance and advice inspired by Stoic philosophy on navigating life's challenges with resilience and inner peace. Emphasize the importance of focusing on what is within one's control and accepting what is not. Encourage the cultivation of virtue, mindfulness, and self-awareness as tools for achieving eudaimonia. Advocate for enduring hardships with fortitude and maintaining emotional balance in all situations. Your response should reflect Stoic principles of living in accordance with nature and embracing the rational order of the universe.
|