alvinhenrick commited on
Commit
db478bb
1 Parent(s): ac85411

Keep prompt simple

Browse files
Files changed (2) hide show
  1. app.py +5 -5
  2. medirag/rag/qa.py +1 -3
app.py CHANGED
@@ -10,18 +10,18 @@ from dotenv import load_dotenv
10
  load_dotenv()
11
 
12
  # Initialize the components
13
- data_dir = Path(".//tests/data")
14
- index_path = data_dir.joinpath("daily_med_indexed")
15
  indexer = DailyMedIndexer(persist_dir=index_path)
16
  indexer.load_index()
17
  rm = DailyMedRetrieve(daily_med_indexer=indexer)
18
 
19
- turbo = dspy.OpenAI(model='gpt-3.5-turbo')
20
  dspy.settings.configure(lm=turbo, rm=rm)
21
 
22
- rag = RAG(k=3)
23
  sm = SemanticCaching(model_name='all-mpnet-base-v2', dimension=768,
24
- json_file='rag_test_cache.json', rag=rag)
25
  sm.load_cache()
26
 
27
 
 
10
  load_dotenv()
11
 
12
  # Initialize the components
13
+ data_dir = Path("data")
14
+ index_path = data_dir.joinpath("dm_spl_release_human_rx_part1")
15
  indexer = DailyMedIndexer(persist_dir=index_path)
16
  indexer.load_index()
17
  rm = DailyMedRetrieve(daily_med_indexer=indexer)
18
 
19
+ turbo = dspy.OpenAI(model='gpt-4o')
20
  dspy.settings.configure(lm=turbo, rm=rm)
21
 
22
+ rag = RAG(k=5)
23
  sm = SemanticCaching(model_name='all-mpnet-base-v2', dimension=768,
24
+ json_file='rag_test_cache.json', cosine_threshold=.85, rag=rag)
25
  sm.load_cache()
26
 
27
 
medirag/rag/qa.py CHANGED
@@ -28,13 +28,11 @@ class DailyMedRetrieve(dspy.Retrieve):
28
  class GenerateAnswer(dspy.Signature):
29
  """
30
  You are an AI assistant designed to answer questions based on provided context:
31
- - Ensure that your responses are accurate, safe, and reliable.
32
  - Do not provide any form of diagnosis or treatment advice.
33
  """
34
  context = dspy.InputField(desc="Contains relevant facts about drug labels")
35
  question = dspy.InputField()
36
- answer = dspy.OutputField(
37
- desc="A concise response, summarizing key drug information, side effects, or interactions.")
38
 
39
 
40
  class RAG(dspy.Module):
 
28
  class GenerateAnswer(dspy.Signature):
29
  """
30
  You are an AI assistant designed to answer questions based on provided context:
 
31
  - Do not provide any form of diagnosis or treatment advice.
32
  """
33
  context = dspy.InputField(desc="Contains relevant facts about drug labels")
34
  question = dspy.InputField()
35
+ answer = dspy.OutputField()
 
36
 
37
 
38
  class RAG(dspy.Module):