Update app.py
Browse files
app.py
CHANGED
|
@@ -9,29 +9,16 @@ import requests
|
|
| 9 |
from pydantic import BaseModel, Field
|
| 10 |
from typing import Optional
|
| 11 |
|
| 12 |
-
placeHolderPersona1 = """
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
##Rules
|
| 17 |
Ensure the query is concise
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
Do not respond with anything other than the query for the Semantic Search Engine."""
|
| 21 |
-
|
| 22 |
-
# placeHolderPersona2 = """## Mission
|
| 23 |
-
# To analyse a clinical triaging discussion between a patient and AI doctor interactions with a focus on Immunology symptoms, medical history, and test results to deduce the most probable Immunology diagnosis.
|
| 24 |
-
|
| 25 |
-
# ## Diagnostic Process
|
| 26 |
-
# Upon receipt of the clinical notes, I will follow a systematic approach to arrive at a diagnosis:
|
| 27 |
-
# 1. Review the patient's presenting symptoms and consider their relevance to immunopathology.
|
| 28 |
-
# 2. Cross-reference the gathered information with my knowledge base of immunology to identify patterns or indicators of specific immune disorders.
|
| 29 |
-
# 3. Formulate a diagnosis from the potential conditions.
|
| 30 |
-
# 4. Determine the most likely diagnosis and assign a confidence score from 1-100, with 100 being absolute certainty.
|
| 31 |
-
|
| 32 |
-
# # Limitations
|
| 33 |
-
# While I am specialized in immunology, I understand that not all cases will fall neatly within my domain. In instances where the clinical notes point to a condition outside of my expertise, I will provide the best possible diagnosis with the acknowledgment that my confidence score will reflect the limitations of my specialization in those cases"""
|
| 34 |
-
|
| 35 |
|
| 36 |
class ChatRequestClient(BaseModel):
|
| 37 |
|
|
@@ -101,14 +88,14 @@ st.sidebar.caption(f"Session ID: {genuuid()}")
|
|
| 101 |
|
| 102 |
|
| 103 |
# Main chat interface
|
| 104 |
-
st.header("
|
| 105 |
|
| 106 |
# User ID Input
|
| 107 |
-
user_id = st.text_input("
|
| 108 |
|
| 109 |
# Ensure user_id is defined or fallback to a default value
|
| 110 |
if not user_id:
|
| 111 |
-
st.warning("Please provide
|
| 112 |
else:
|
| 113 |
# Initialize chat history in session state
|
| 114 |
if "messages" not in st.session_state:
|
|
@@ -120,7 +107,7 @@ else:
|
|
| 120 |
st.markdown(message["content"])
|
| 121 |
|
| 122 |
# Collect user input
|
| 123 |
-
if user_input := st.chat_input("
|
| 124 |
# Add user message to the chat history
|
| 125 |
st.session_state.messages.append({"role": "user", "content": user_input})
|
| 126 |
st.chat_message("user").markdown(user_input)
|
|
@@ -157,6 +144,6 @@ else:
|
|
| 157 |
|
| 158 |
# Display additional metadata
|
| 159 |
st.caption(f"##### Time taken: {format_elapsed_time(elapsed_time)} seconds")
|
| 160 |
-
st.caption(f"##### Question Count: {count} of {numberOfQuestions}")
|
| 161 |
|
| 162 |
|
|
|
|
| 9 |
from pydantic import BaseModel, Field
|
| 10 |
from typing import Optional
|
| 11 |
|
| 12 |
+
placeHolderPersona1 = """
|
| 13 |
+
##Mission
|
| 14 |
+
Please create a highly targeted query for a semantic search engine. The query must represent the conversation to date.
|
| 15 |
+
** You will be given the converstaion to date in the user prompt.
|
| 16 |
+
** If no converstaion provided then this is the first converstaion
|
| 17 |
|
| 18 |
##Rules
|
| 19 |
Ensure the query is concise
|
| 20 |
+
Do not respond with anything other than the query for the Semantic Search Engine.
|
| 21 |
+
Respond with just a plain string """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
class ChatRequestClient(BaseModel):
|
| 24 |
|
|
|
|
| 88 |
|
| 89 |
|
| 90 |
# Main chat interface
|
| 91 |
+
st.header("Test Query Translation")
|
| 92 |
|
| 93 |
# User ID Input
|
| 94 |
+
user_id = st.text_input("Experiment ID:", key="user_id")
|
| 95 |
|
| 96 |
# Ensure user_id is defined or fallback to a default value
|
| 97 |
if not user_id:
|
| 98 |
+
st.warning("Please provide an experiment ID to start the chat.")
|
| 99 |
else:
|
| 100 |
# Initialize chat history in session state
|
| 101 |
if "messages" not in st.session_state:
|
|
|
|
| 107 |
st.markdown(message["content"])
|
| 108 |
|
| 109 |
# Collect user input
|
| 110 |
+
if user_input := st.chat_input("Start chat:"):
|
| 111 |
# Add user message to the chat history
|
| 112 |
st.session_state.messages.append({"role": "user", "content": user_input})
|
| 113 |
st.chat_message("user").markdown(user_input)
|
|
|
|
| 144 |
|
| 145 |
# Display additional metadata
|
| 146 |
st.caption(f"##### Time taken: {format_elapsed_time(elapsed_time)} seconds")
|
| 147 |
+
# st.caption(f"##### Question Count: {count} of {numberOfQuestions}")
|
| 148 |
|
| 149 |
|