davidfearne commited on
Commit
3062d69
·
verified ·
1 Parent(s): 17ed52d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -99
app.py CHANGED
@@ -11,100 +11,47 @@ from typing import Optional
11
 
12
 
13
 
14
- placeHolderPersona1 = """##Diagnostic Agent (DA):
15
- ##Objective: Gather comprehensive details about the user's illness.
16
- ##Conversation Flow:
17
- #Symptom Collection:
18
- Primary Symptoms: Ask about the main symptoms the user is experiencing.
19
- Duration and Severity: Gather details on how long the symptoms have been present and their severity.
20
- Medical History: Collect information on any relevant medical history or existing conditions.
21
- Current Medications: Inquire about any current medications the user
22
- is taking.
23
- Allergies: Identify any known allergies to medications.
24
- Lifestyle Factors: Consider any lifestyle factors that may affect the choice of medication.
25
-
26
- ##Example Interaction:
27
-
28
- DA: "Can you describe the primary symptoms you are experiencing?"
29
- User: "I have a persistent cough and fever."
30
- DA: "How long have you been experiencing these symptoms?"
31
- """
32
-
33
- placeHolderPersona2 = """## You are an advisor for a doctor, augmenting their professional opinion on prescribed drug options
34
-
35
- ## Objective: Analyse the structured data to identify suitable medicinal products for the list given in the user message from the given conversation between an AI doctor and a human patient
36
-
37
- ## Processing Steps:
38
-
39
- Symptom Analysis: Evaluate the symptoms and other collected information.
40
- Product Matching: Match the symptoms and patient profile to suitable medicinal products.
41
- IDMP Compliance: Ensure the identified products are compliant with IDMP standards.
42
- Recommendation Generation: Generate a list of recommended medicinal products.
43
- Feedback Loop: If needed, request additional information from the DA or user.
44
-
45
- # Example Interaction:
46
- RA: "Based on the symptoms of a persistent cough and fever, along with your medical history, we recommend considering ProductX and ProductY. Please consult with your healthcare provider before use."""
47
-
48
- placeHolderUser2 = """This is the list of available drugs on offer to prescribe please use your understanding of the Generic version of each drug and give the Trademark Name
49
- Trademark Name,Generic,Product area
50
- Amoxil,amoxiicillin,General medicines
51
- Anoro Ellipta,umeclidinium and vilanterol,General medicines
52
- Arnuity Ellipta,Fluticasone,General medicines
53
- Augmentin,amoxicillin/clavulanate potassium,General medicines
54
- Avamys / Veramyst,fluticasone furoate,General medicines
55
- Avodart/Avolve / Duodart,dutasteride,General medicines
56
- Bactroban,mupirocin,General medicines
57
- Beconase,beclomethasone,General medicines
58
- Becotide/Becloforte,beclomethasone dipropionate,General medicines
59
- Betnovate,betamethasone valerate,General medicines
60
- Cutivate,fluticasone propionate,General medicines
61
- Dermovate,clobetasol propionate,General medicines
62
- Duac,clindamycin phosphate and benzoyl peroxide,General medicines
63
- Eltroxin,Levothyroxin sodium,General medicines
64
- Eumovate,clobetasone butyrate,General medicines
65
- Flixonase/Flonase,fluticasone propionate,General medicines
66
- Flixotide / Flovent - Diskus / MDI,fluticasone propionate,General medicines
67
- Flolan,epoprostenol,General medicines
68
- Fortum,ceftazidime,General medicines
69
- Hepsera,Adefovir,General medicines
70
- Imigran/ImITrex FDT,sumatriptan succinate,General medicines
71
- Imuran,Azathioprine,General medicines
72
- Incruse,umeclidinium,General medicines
73
- Keppra,Levetiracetam,General medicines
74
- Lacipil,Lacidipine,General medicines
75
- Lacticare - Family,Lactic Acid,General medicines
76
- Lamictal,lamotrigine,General medicines
77
- Lanoxin,Digoxin,General medicines
78
- Levoxacin,Levofloxacin,General medicines
79
- Lovaza,omega-3 acid ethyl esters,General medicines
80
- Malarone,atovaquone and proguanil hydrochloride,General medicines
81
- Mepron,atovaquone,General medicines
82
- Naramig/Amerge,naratriptan hydrochloride,General medicines
83
- Paxil / Seroxat,paroxetine hydrochloride,General medicines
84
- Relenza,zanamivir,General medicines
85
- Relvar/Breo,Fluticasone furoate/vilanterol,General medicines
86
- Requip,ropinirole hydrochloride,General medicines
87
- Rythmol,propafenone hydrochloride,General medicines
88
- Septrin,Cotrimoxazole,General medicines
89
- Seretide / Advair - Diskus / MDI,"salmeterol xinofoate, fluticasone propionate",General medicines
90
- Serevent - Diskus / MDI,salmeterol xinafoate,General medicines
91
- Toctino,Alitretinoin,General medicines
92
- Trelegy - Ellipta,"fluticasone furoate, umeclidinium, and vilanterol inhalation powder",General medicines
93
- Valtrex,valaciclovir hydrochloride,General medicines
94
- Ventolin - Diskus / MDI,Salbutamol,General medicines
95
- Volibris (Ambrisentan),ambrisentan,General medicines
96
- Wellbutrin,bupropion hydrochloride,General medicines
97
- Xyzal,Levocetirizine,General medicines
98
- Zagallo,Dutasteride,General medicines
99
- Zeffix,lamivudine,General medicines
100
- Zentel,Albendazole,General medicines
101
- Zinacef,cefuroxime,General medicines
102
- Zovirax,aciclovir,General medicines
103
- Zyban,bupropion hydrochloride,General medicines
104
- Zyloric,Allopurinol,General medicines
105
- Zyrtec,cetirizine,General medicines
106
-
107
- This is the conversation to date,
108
  """
109
 
110
 
@@ -154,21 +101,21 @@ st.sidebar.image('agentBuilderLogo.png')
154
  st.sidebar.header("Agent Personas Design")
155
  # st.sidebar.subheader("Welcome Message")
156
  # welcomeMessage = st.sidebar.text_area("Define Triaging Persona", value=welcomeMessage, height=300)
157
- st.sidebar.subheader("Symptom Intake AI")
158
  numberOfQuestions = st.sidebar.slider("Number of Questions", min_value=0, max_value=10, step=1, value=5, key='persona1_questions')
159
- persona1SystemMessage = st.sidebar.text_area("Define Triaging Persona", value=placeHolderPersona1, height=300)
160
  with st.sidebar.expander("See explanation"):
161
- st.write("This AI persona will converse with the patient to gather their symptoms. With each round of chat, the object of the AI is to ask more specific follow up questions as it narrows down to the specific diagnosis. However this AI should never give a diagnosis")
162
  st.image("agentPersona1.png")
163
  llm1 = st.sidebar.selectbox("Model Selection", ['GPT3.5','GPT-4'], key='persona1_size')
164
  temp1 = st.sidebar.slider("Tempreature", min_value=0.0, max_value=1.0, step=0.1, value=0.5, key='persona1_temp')
165
  tokens1 = st.sidebar.slider("Tokens", min_value=0, max_value=4000, step=100, value=500, key='persona1_tokens')
166
 
167
  # Persona 2
168
- st.sidebar.subheader("Diagnosis and Next Best Action AI")
169
  persona2SystemMessage = st.sidebar.text_area("Define Diagnosis Persona", value=placeHolderPersona2, height=300)
170
  with st.sidebar.expander("See explanation"):
171
- st.write("This AI persona uses the output of the symptom intake AI as its input. This AI’s job is to augment a health professional by assisting with a diagnosis and possible next best action. The teams will need to determine if this should be a tool used directly by the patient, as an assistant to the health professional or a hybrid of the two. ")
172
  st.image("agentPersona2.png")
173
  llm2 = st.sidebar.selectbox("Model Selection", ['GPT-4', 'GPT3.5'], key='persona2_size')
174
  temp2 = st.sidebar.slider("Tempreature", min_value=0.0, max_value=1.0, step=0.1, value=0.3, key='persona2_temp')
 
11
 
12
 
13
 
14
+ placeHolderPersona1 = """ ## Objective - You are a Car Selection Assistant AI designed to help the user find the perfect car based on their needs, preferences, and lifestyle. Your role is to guide the user through a conversational journey by asking thoughtful, relevant questions. Your ultimate goal is to build a complete understanding of the user’s requirements and preferences to recommend the ideal car.
15
+
16
+ ## Guidelines:
17
+ ** Conversation Focus: Only ask questions that are directly relevant to car selection and build upon the user's responses. Do not offer recommendations until explicitly requested.
18
+ ** Personalization: Tailor your questions to the user’s answers to better understand their priorities, such as budget, lifestyle, driving habits, and aesthetic preferences.
19
+ ** Prioritize Clarity: Ask clear and concise questions, avoiding jargon unless the user demonstrates expertise in cars.
20
+ ** Avoid Bias: Do not push a specific car brand or model unless the user provides clear preferences or constraints.
21
+ ** Progressive Inquiry: Start with broad questions and narrow down to specifics based on the user's responses (e.g., from "What will you primarily use the car for?" to "Do you need all-wheel drive for winter conditions?").
22
+ ** Budget Sensitivity: Gently uncover budget constraints without making the user feel pressured or uncomfortable.
23
+ ## End Goal: Use the conversation to identify the perfect car, ensuring the recommendation aligns with the user’s stated needs and preferences.
24
+ ## Examples of Topics to Explore:
25
+ ** Purpose: Commuting, family use, off-road adventures, etc.
26
+ ** Preferences: Brand loyalty, new vs. used, color, design, etc.
27
+ ** Budget: Purchase price, financing, long-term costs (fuel efficiency, maintenance).
28
+ ** Features: Technology, safety, comfort, storage, performance.
29
+ ** Lifestyle: Family size, hobbies, travel habits, local weather.
30
+ ## Expected Output:
31
+ At the end of the conversation, synthesize the user's responses into a clear and concise profile of their ideal car and provide a personalized recommendation only when explicitly asked. """
32
+
33
+ placeHolderPersona2 = """## objective - You are a Car Selection Justifier AI tasked with selecting the best car for the user from a provided list based on a detailed conversation profile. Your role is to analyze the conversation data, match the user’s preferences and requirements to the cars in the list, and justify your selection with clear reasoning.
34
+
35
+ ## Guidelines:
36
+ ** Input Understanding: Carefully analyze the conversation summary or profile provided. Identify key factors such as purpose, preferences, budget, required features, and lifestyle needs.
37
+ ** Car Matching: Review the list of cars and evaluate each option against the user’s stated requirements. Eliminate unsuitable options and focus on the best matches.
38
+ ## Weighted Justification:
39
+ Justify your selection by explicitly linking the car’s features, specifications, and qualities to the user’s needs.
40
+ Highlight why the chosen car is better suited than other options in the list.
41
+ If multiple cars are equally suitable, present them as alternatives and explain the pros and cons of each.
42
+ Clarity and Relevance: Keep your reasoning concise, easy to understand, and directly tied to the user's preferences. Avoid technical jargon unless necessary for the explanation.
43
+ ## Recommendation Format:
44
+ ** Selected Car: State the recommended car(s) from the list.
45
+ ** Justification: Provide a detailed explanation of how the car(s) align with the user’s profile.
46
+ ** Alternative Options (if any): Suggest additional options and why they could also work, if appropriate.
47
+ ## Expected Output:
48
+ A structured recommendation including:
49
+
50
+ ** Selected Car(s): Name the car(s) from the list.
51
+ ** Justification: Describe how the car meets the user’s stated needs and preferences, citing specific features or attributes.
52
+ ** Alternative(s) (Optional): Mention any close alternatives with a brief comparison."""
53
+
54
+ placeHolderUser2 = """This is the conversation to date,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  """
56
 
57
 
 
101
  st.sidebar.header("Agent Personas Design")
102
  # st.sidebar.subheader("Welcome Message")
103
  # welcomeMessage = st.sidebar.text_area("Define Triaging Persona", value=welcomeMessage, height=300)
104
+ st.sidebar.subheader("AI Sales Person")
105
  numberOfQuestions = st.sidebar.slider("Number of Questions", min_value=0, max_value=10, step=1, value=5, key='persona1_questions')
106
+ persona1SystemMessage = st.sidebar.text_area("AI Sales Persona", value=placeHolderPersona1, height=300)
107
  with st.sidebar.expander("See explanation"):
108
+ st.write("This AI persona will converse with the customer to gather their requirements. With each round of chat, the object of the AI is to ask more specific follow up questions as it narrows down to the specific requirements. However this AI should never give a selection")
109
  st.image("agentPersona1.png")
110
  llm1 = st.sidebar.selectbox("Model Selection", ['GPT3.5','GPT-4'], key='persona1_size')
111
  temp1 = st.sidebar.slider("Tempreature", min_value=0.0, max_value=1.0, step=0.1, value=0.5, key='persona1_temp')
112
  tokens1 = st.sidebar.slider("Tokens", min_value=0, max_value=4000, step=100, value=500, key='persona1_tokens')
113
 
114
  # Persona 2
115
+ st.sidebar.subheader("Car Selection AI")
116
  persona2SystemMessage = st.sidebar.text_area("Define Diagnosis Persona", value=placeHolderPersona2, height=300)
117
  with st.sidebar.expander("See explanation"):
118
+ st.write("This AI persona uses the output of the sales AI as its input. This AI’s job is to augment a sales professional by assisting with a car selection and justification.")
119
  st.image("agentPersona2.png")
120
  llm2 = st.sidebar.selectbox("Model Selection", ['GPT-4', 'GPT3.5'], key='persona2_size')
121
  temp2 = st.sidebar.slider("Tempreature", min_value=0.0, max_value=1.0, step=0.1, value=0.3, key='persona2_temp')