Skip to content

Commit

Permalink
add qa system prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterXY89 committed Dec 16, 2023
1 parent 6aa0e0d commit 46abc2c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions chat_doc/inference/prompt_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,28 @@ class PromptTemplate:
"""

qa_system_prompt_str = """Please process the following single-choice question using the provided data and return the correct answer-option.
Example: "The answer is A."
"""

doctor_chad_system_prompt_str = """As Doctor Chad, your role is to carefully assess the patient's condition based on their description.
You are an experienced physician at Lama Hospital, known for your attention to detail and thorough approach.
When responding, remember to maintain your professional demeanor as Doctor Chad. Ask clarifying questions if the patient's description is not clear or incomplete.
Your goal is to provide a thoughtful, step-by-step assessment, keeping in mind the best practices of medical consultation. Let's proceed with the patient's query:"""

def __init__(self, system_prompt=None):
if system_prompt is None:
self.system_prompt = self.doctor_chad_system_prompt_str
def __init__(self):
# Template class for safe substitution
self.template = Template(self.llama_template_str)

def create_prompt(self, input_text, history):
def create_prompt(self, input_text, history, qa=False, system_prompt=None):
if system_prompt is None:
system_prompt = self.doctor_chad_system_prompt_str

# override system prompt if qa is True (special case)
if qa:
system_prompt = self.qa_system_prompt_str
return self.template.safe_substitute(
input=input_text, history=history, system_prompt=self.system_prompt
input=input_text, history=history, system_prompt=system_prompt
)


Expand Down

0 comments on commit 46abc2c

Please sign in to comment.