aquibmoin commited on
Commit
becc0f5
·
verified ·
1 Parent(s): 8d70dba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -96,7 +96,7 @@ def encode_query(text):
96
 
97
 
98
  # Context retrieval function using Pinecone
99
- def retrieve_relevant_context(user_input, context_text, science_objectives="", top_k=3):
100
  query_text = f"Science Goal: {user_input}\nContext: {context_text}\nScience Objectives: {science_objectives}" if science_objectives else f"Science Goal: {user_input}\nContext: {context_text}"
101
  query_embedding = encode_query(query_text)
102
 
@@ -231,7 +231,7 @@ def chatbot(user_input, science_objectives="", context="", subdomain="", max_tok
231
 
232
  evaluation_dataset = EvaluationDataset.from_list(dataset)
233
 
234
- ragas_evaluation = evaluate(dataset=evaluation_dataset,metrics=[LLMContextRecall(), ContextRelevance(), Faithfulness(), ResponseRelevancy(), FactualCorrectness(coverage="high",atomicity="high")],llm=evaluator_llm, embeddings=embeddings)
235
 
236
  yield "Response generated successfully ✅ ", None, None, None, None, None, None
237
 
 
96
 
97
 
98
  # Context retrieval function using Pinecone
99
+ def retrieve_relevant_context(user_input, context_text, science_objectives="", top_k=5):
100
  query_text = f"Science Goal: {user_input}\nContext: {context_text}\nScience Objectives: {science_objectives}" if science_objectives else f"Science Goal: {user_input}\nContext: {context_text}"
101
  query_embedding = encode_query(query_text)
102
 
 
231
 
232
  evaluation_dataset = EvaluationDataset.from_list(dataset)
233
 
234
+ ragas_evaluation = evaluate(dataset=evaluation_dataset,metrics=[LLMContextRecall(), ContextRelevance(), Faithfulness(), ResponseRelevancy(), FactualCorrectness(coverage="low",atomicity="low")],llm=evaluator_llm, embeddings=embeddings)
235
 
236
  yield "Response generated successfully ✅ ", None, None, None, None, None, None
237