api separation and fixes done
This commit is contained in:
@@ -58,7 +58,6 @@ app.add_middleware(
|
|||||||
api_key_header = APIKeyHeader(name="Authorization", auto_error=False)
|
api_key_header = APIKeyHeader(name="Authorization", auto_error=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def get_api_key(api_key_header: str = Security(api_key_header)) -> str:
|
async def get_api_key(api_key_header: str = Security(api_key_header)) -> str:
|
||||||
"""Validate API key from header"""
|
"""Validate API key from header"""
|
||||||
if not api_key_header or not api_key_header.startswith('Bearer '):
|
if not api_key_header or not api_key_header.startswith('Bearer '):
|
||||||
@@ -95,12 +94,12 @@ class ChatResponse(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class GeneratePDFRequest(BaseModel):
|
class GeneratePDFRequest(BaseModel):
|
||||||
conversation_id: str
|
|
||||||
feedback: Optional[str] = None
|
|
||||||
previous_results: Optional[Dict[str, Any]] = None
|
|
||||||
resume_url: Optional[str] = None
|
resume_url: Optional[str] = None
|
||||||
|
conversation_id: str
|
||||||
|
theme_id: Optional[int] = 1
|
||||||
full_history_url: Optional[str] = None
|
full_history_url: Optional[str] = None
|
||||||
form_id:Optional[int] = None
|
form_id:Optional[int] = None
|
||||||
|
generate_theme:str="YES"
|
||||||
|
|
||||||
class QuizRequest(BaseModel):
|
class QuizRequest(BaseModel):
|
||||||
pdf_url: str
|
pdf_url: str
|
||||||
@@ -209,58 +208,25 @@ async def chat_endpoint(
|
|||||||
status_code=400,
|
status_code=400,
|
||||||
detail="Unable to fetch onboarding data"
|
detail="Unable to fetch onboarding data"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get AI chat response
|
|
||||||
|
|
||||||
if request.generate_theme == "YES":
|
|
||||||
print("Generating PDF from response...") # Debugging print
|
|
||||||
print(f"Calling AI chat function...") # Debugging print
|
|
||||||
response = ai_chat(
|
|
||||||
query="NOW GENERATE THEME FOR THE CURRENT THEME",
|
|
||||||
conversation_id=request.conversation_id,
|
|
||||||
theme_id=request.theme_id,
|
|
||||||
resume=resume_docs,
|
|
||||||
full_history=full_history_docs,
|
|
||||||
form_response=form_response_docs,
|
|
||||||
generate_theme=request.generate_theme
|
|
||||||
)
|
|
||||||
print(f"pdf content {response}")
|
|
||||||
response = json.loads(response)
|
|
||||||
pdf_content = create_pdf(response)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Create filename with timestamp
|
|
||||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
||||||
filename = f"theme_{timestamp}.pdf"
|
|
||||||
|
|
||||||
# Return the PDF as a response
|
|
||||||
print(f"Returning PDF with filename: {filename}") # Debugging print
|
|
||||||
return Response(
|
|
||||||
content=pdf_content,
|
|
||||||
media_type="application/pdf",
|
|
||||||
headers={
|
|
||||||
"Content-Disposition": f'attachment; filename="{filename}"'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Parse response
|
# Parse response
|
||||||
print("Parsing AI response...") # Debugging print
|
print("Parsing AI response...") # Debugging print
|
||||||
|
query = request.query
|
||||||
|
if not query:
|
||||||
|
query = "Let's get started"
|
||||||
response = ai_chat(
|
response = ai_chat(
|
||||||
query=request.query,
|
query=query,
|
||||||
conversation_id=request.conversation_id,
|
conversation_id=request.conversation_id,
|
||||||
theme_id=request.theme_id,
|
theme_id=request.theme_id,
|
||||||
resume=resume_docs,
|
resume=resume_docs,
|
||||||
full_history=full_history_docs,
|
full_history=full_history_docs,
|
||||||
form_response=form_response_docs,
|
form_response=form_response_docs
|
||||||
generate_theme=request.generate_theme
|
|
||||||
)
|
)
|
||||||
parsed_response = json.loads(response)
|
print(response)
|
||||||
|
|
||||||
return ChatResponse(
|
return ChatResponse(
|
||||||
message=parsed_response.get("message", ""),
|
message=response.get("message", ""),
|
||||||
end=parsed_response.get("end", "no") == "yes",
|
end=response.get("end", "no") == "yes",
|
||||||
pop_theme_generation=parsed_response.get("pop_theme_generation","no") == "yes",
|
pop_theme_generation=response.get("pop_theme_generation","no") == "yes",
|
||||||
error=None
|
error=None
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -275,7 +241,7 @@ async def chat_endpoint(
|
|||||||
|
|
||||||
@app.post("/rescue-career/generate-theme")
|
@app.post("/rescue-career/generate-theme")
|
||||||
async def generate_pdf_endpoint(
|
async def generate_pdf_endpoint(
|
||||||
request: ChatRequest,
|
request: GeneratePDFRequest,
|
||||||
api_key: str = Depends(get_api_key)
|
api_key: str = Depends(get_api_key)
|
||||||
):
|
):
|
||||||
|
|
||||||
@@ -339,7 +305,7 @@ async def generate_pdf_endpoint(
|
|||||||
# This is a placeholder - replace with your actual conversation data fetching logic
|
# This is a placeholder - replace with your actual conversation data fetching logic
|
||||||
# Get AI-generated theme content
|
# Get AI-generated theme content
|
||||||
response = ai_chat(
|
response = ai_chat(
|
||||||
query="NOW GENERATE THE STARTPOP FRAME WORK, THEME_GENERATION_STATE: YES",
|
query="NOW GENERATE THE STARTPOP FRAMEWORK",
|
||||||
conversation_id=request.conversation_id,
|
conversation_id=request.conversation_id,
|
||||||
theme_id=request.theme_id,
|
theme_id=request.theme_id,
|
||||||
resume=resume_docs,
|
resume=resume_docs,
|
||||||
|
|||||||
@@ -18,3 +18,6 @@ QUIZ_TYPES = {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODEL = "gpt-4o-mini"
|
||||||
|
TEMPERATURE = 0.7
|
||||||
@@ -1023,5 +1023,207 @@
|
|||||||
"timestamp": "2025-02-10T21:00:36.427117"
|
"timestamp": "2025-02-10T21:00:36.427117"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"3664": {
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "{\n \"message\": \"Can you share an experience where you had to interact with a patient or individual who had a visible or invisible disability during a medical call? How did you ensure they felt respected and supported?\",\n \"end\": \"no\",\n \"pop_theme_generation\": \"no\"\n}",
|
||||||
|
"timestamp": "2025-02-11T17:58:32.965812"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "Let's get started",
|
||||||
|
"timestamp": "2025-02-11T17:58:33.046957"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "{\"theme_title\":\"Dealt with Disabilities\",\"question\":\"Can you share an experience where you had to interact with a patient or individual who had a visible or invisible disability during a medical call? How did you ensure they felt respected and supported?\",\"Situation\":[\"During a medical emergency call on a busy Saturday night, I responded to a report of an individual having a panic attack in a public park. The person, a young adult, was visibly distressed and had a history of anxiety disorders that were exacerbated by the chaotic environment around them.\",\"Upon arrival, I noticed that the individual was trembling and had difficulty communicating due to their heightened state of panic. Nearby, a small crowd had gathered, adding to the pressure and distress, which made the situation critical as we needed to provide support quickly and effectively.\"],\"Task\":[\"My primary task was to calmly assess the individual\u2019s needs while ensuring their safety and dignity. It was essential to create an environment where they would feel respected and secure enough to engage with us.\",\"Additionally, I needed to communicate effectively with both the patient and the onlookers, guiding the crowd away to reduce the pressure and focus solely on assisting the individual with compassion.\"],\"Action\":[\"Negative: I could have rushed the interaction without considering the individual\u2019s emotional state, which would potentially worsen their panic and discourage them from expressing their needs.\",\"Negative: Ignoring the crowd's presence could have led to additional stress for the patient, making the situation even harder to manage.\",\"Positive: I knelt down to their level, used a calm tone of voice, and actively listened to their concerns, establishing trust and reducing their sense of isolation.\",\"Positive: I implemented grounding techniques, such as encouraging them to focus on their breathing while displaying empathy, allowing them to gradually regain composure.\"],\"Results and Transitions\":[\"The individual was able to calm down significantly within a few minutes, allowing us to assess them further and provide the necessary medical assistance.\",\"After the situation stabilized, the person expressed gratitude for the support, highlighting how the compassionate approach made a significant difference in their experience.\"],\"Personal Lessons\":[\"I learned the importance of maintaining a calm presence during emergencies, especially when dealing with individuals who have disabilities or heightened vulnerabilities. My approach in such cases can greatly affect their emotional and physical response.\",\"This experience reinforced the necessity of empathy and proactive communication while dealing with sensitive situations, especially within our community.\"],\"Observations of Others\":[\"I noticed that my team members were attentive and supportive, quickly adapting to the situation, which exemplified our collective commitment to prioritizing patient care and inclusive service.\",\"The positive response from the crowd showed how effective communication can enable public understanding and cooperation.\"],\"Professional Connection\":[\"This experience reflects how I value the principles that ______ Fire embodies in terms of compassion, understanding, and effective communication with all community members.\",\"I am inspired by ______ Fire\u2019s commitment to training its personnel, ensuring each firefighter is equipped to provide dignified care to individuals living with both visible and invisible disabilities. I would be honored to join this team.\"]}",
|
||||||
|
"timestamp": "2025-02-11T18:05:11.191265"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "NOW GENERATE THE STARTPOP FRAMEWORK",
|
||||||
|
"timestamp": "2025-02-11T18:05:11.228265"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "{\n \"message\": \"Can you specify which particular aspects of the previous version you disliked, and what you would prefer to see in the new STARTPOP framework? This will help me tailor it more to your liking.\",\n \"end\": \"no\",\n \"pop_theme_generation\": \"no\"\n}",
|
||||||
|
"timestamp": "2025-02-11T18:09:28.342066"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "i do not like the previous version of the framework please",
|
||||||
|
"timestamp": "2025-02-11T18:09:28.420565"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "{\n \"message\": {\n \"Situation\": \"During a medical emergency on a busy Saturday, my team responded to a report of a young adult experiencing a panic attack in a public park. The individual appeared visibly distressed and struggled to communicate due to their heightened anxiety, exacerbated by the chaotic environment and the presence of a crowd.\",\n \"Task\": \"My primary task was to assess the individual's needs while ensuring their safety and dignity, creating an environment where they felt respected and secure to engage with us. Additionally, I needed to manage the onlookers to reduce the pressure around the individual.\",\n \"Action\": {\n \"Negative\": [\n \"Rushing the interaction without considering the individual's emotional state could have worsened their panic.\",\n \"Ignoring the crowd's impact on their anxiety could lead to greater distress.\"\n ],\n \"Positive\": [\n \"I knelt down to their level, used a calm tone of voice, and actively listened to their concerns, establishing trust.\",\n \"Implemented grounding techniques, encouraging them to focus on their breathing, providing empathetic support while they regained composure.\"\n ]\n },\n \"Results and Transitions\": \"The individual calmed down significantly, allowing us to assess and provide necessary medical assistance. They later expressed gratitude for our support, highlighting how a compassionate approach made a significant difference in their experience.\",\n \"Personal Lessons\": \"I learned the importance of maintaining a calm presence in emergencies and how empathy and proactive communication can greatly affect a vulnerable individual's experience.\",\n \"Observations of Others\": \"My team members were attentive and supportive, quickly adapting to the situation, exemplifying our collective commitment to patient care and inclusivity. The crowd responded positively, demonstrating effective communication can foster public understanding.\",\n \"Professional Connection\": \"This experience demonstrates my alignment with ______ Fire's principles of compassion and understanding. I'm inspired by the department's commitment to training personnel in providing dignified care to individuals with disabilities and would be honored to be part of that team.\"\n },\n \"end\": \"yes\",\n \"pop_theme_generation\": \"no\"\n}",
|
||||||
|
"timestamp": "2025-02-11T18:11:06.669209"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "shoettn ent the stitation part a little bit more please",
|
||||||
|
"timestamp": "2025-02-11T18:11:06.693696"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Certainly! Would you like to specify a different context or scenario related to dealing with a disability during a firefighting or medical emergency? This will help me craft an alternative situation that better fits your experience or preference.",
|
||||||
|
"timestamp": "2025-02-11T18:46:19.890036"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "is there a way to make a different stroy for the situtaion part ",
|
||||||
|
"timestamp": "2025-02-11T18:46:19.956917"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "{\"theme_title\":\"Dealt with Disabilities\",\"question\":\"Can you share an experience where you had to interact with a patient or individual who had a visible or invisible disability during a medical call? How did you ensure they felt respected and supported?\",\"Situation\":[\"I was part of an emergency response team that was dispatched to a home where a middle-aged man was experiencing a severe asthma attack. Upon arrival, I noticed he was struggling to breathe and was clearly in distress while sitting on the floor of his living room.\",\"His wife, who was also present, had informed us that he had a history of anxiety and had previously panicked during medical situations. The atmosphere in the house was tense, and it was crucial to provide reassurance and immediate care.\"],\"Task\":[\"My primary responsibility was to quickly assess the patient's condition while ensuring he felt safe and respected. With his anxiety in mind, I needed to communicate clearly and calmly, helping him to relax amidst his panic.\",\"Additionally, I recognized the importance of involving his wife in the process, answering her questions, and ensuring she felt capable of assisting.\"],\"Action\":[\"Negative: I could have acted hastily, further escalating his panic by rushing into administering treatment without explanation or comfort.\",\"Negative: I might have overlooked the emotional dynamics at play, disregarding his wife's anxiety and not involving her in the support process.\",\"Positive: I approached the individual calmly, explaining each step I was taking while demonstrating confidence and control to help soothe his anxiety.\",\"Positive: I encouraged him to focus on his breathing while I set up the nebulizer, ensuring he understood the process and felt more secure.\"],\"Results and Transitions\":[\"The patient's breathing improved significantly after receiving treatment, and he expressed relief and gratitude, stating that my calm demeanor helped ease his anxiety during the crisis.\",\"The couple felt empowered and appreciated the inclusive approach, fostering a bond of trust between us and them.\"],\"Personal Lessons\":[\"I learned that addressing both the physical and emotional needs of individuals during emergencies is essential. Providing reassurance can drastically reduce anxiety and improve outcomes.\",\"This situation highlighted how critical effective communication is in high-stress scenarios, especially with individuals who may have disabilities.\"],\"Observations of Others\":[\"My partner demonstrated exceptional teamwork by promptly preparing the medical equipment, showcasing how collaborative efforts can ensure efficient care. The wife expressed relief at our professionalism, reinforcing its impact.\",\"I observed that responding with compassion builds trust and improves overall community relations.\"],\"Professional Connection\":[\"This experience resonates with my belief in the importance of compassion and effective communication in emergency situations, aligning with ______ Fire's values.\",\"I admire ______ Fire's dedication to training first responders to treat all individuals, including those with visible and invisible disabilities, with dignity and respect. I would be honored to contribute to this mission.\"]}",
|
||||||
|
"timestamp": "2025-02-11T18:48:22.944850"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "NOW GENERATE THE STARTPOP FRAMEWORK",
|
||||||
|
"timestamp": "2025-02-11T18:48:23.029999"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Could you provide me with a specific scenario or elements you would like to include in the new story for the situation part? This way, I can create a more tailored and relevant experience for you.",
|
||||||
|
"timestamp": "2025-02-11T18:49:24.097914"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "is there a way to make a different stroy for the situtaion part ",
|
||||||
|
"timestamp": "2025-02-11T18:49:24.132916"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Can you describe an alternative situation you have in mind, or would you like me to provide a new scenario related to interacting with individuals with disabilities in a firefighting or medical context?",
|
||||||
|
"timestamp": "2025-02-11T18:52:09.311461"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "is there a way to make a different stroy for the situtaion part ",
|
||||||
|
"timestamp": "2025-02-11T18:52:09.406319"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Could you provide some details or themes you want in the new situation, or should I create a completely fresh scenario?",
|
||||||
|
"timestamp": "2025-02-11T18:52:54.206457"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "is there a way to make a different stroy for the situtaion part ",
|
||||||
|
"timestamp": "2025-02-11T18:52:54.271459"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "is there a way to make a different stroy for the situtaion part ",
|
||||||
|
"timestamp": "2025-02-11T18:57:27.619043"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Absolutely! Here's a new story for the situation part:\n\n**Situation:** During a winter storm, I was part of a crew responding to a medical emergency call at a senior living facility. An elderly woman with mobility issues had fallen and was unable to get up. She was visibly shaken and had a history of anxiety related to being in vulnerable situations. Upon arrival, the facility staff informed us that she was feeling very anxious due to her fall and the noise of the emergency responders outside. I knew it was essential to approach her in a way that would make her feel safe and respected, given her condition and the circumstances.",
|
||||||
|
"timestamp": "2025-02-11T18:57:27.710877"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "okay shrotent tasks ",
|
||||||
|
"timestamp": "2025-02-11T18:59:26.600538"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Here's a shortened version of the task section:\n\n**Task:** My main task was to assess the elderly woman's condition while ensuring she felt safe and respected. I needed to communicate calmly to help alleviate her anxiety and involve the facility staff for additional support.",
|
||||||
|
"timestamp": "2025-02-11T18:59:26.636536"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "okay shrotent tasks ",
|
||||||
|
"timestamp": "2025-02-11T19:02:27.571280"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "My main task was to assess the elderly woman's condition and ensure she felt safe by communicating calmly. I also needed to involve the facility staff for additional support.",
|
||||||
|
"timestamp": "2025-02-11T19:02:27.599284"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "okay shrotent tasks ",
|
||||||
|
"timestamp": "2025-02-11T19:05:57.155796"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "My task was to assess the woman's condition while ensuring she felt safe and calm, involving the facility staff as needed.",
|
||||||
|
"timestamp": "2025-02-11T19:05:57.222913"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "okay shrotent tasks ",
|
||||||
|
"timestamp": "2025-02-11T19:10:46.088353"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "My task was to assess her condition and ensure she felt safe while involving the staff for support.",
|
||||||
|
"timestamp": "2025-02-11T19:10:46.124352"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "Okay this is not bad but makey the story more unqiue ",
|
||||||
|
"timestamp": "2025-02-11T19:11:27.882069"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Here's a more unique story for the situation part:\n\n**Situation:** During a community event, my team received a call about a young boy who had fainted after a seizure. When we arrived, the boy, who had epilepsy, was lying on the ground, and his mother was visibly distressed. The surrounding crowd was uneasy, which added to the chaotic atmosphere. Understanding that this was not just a medical emergency but also an emotional one, I knew it was vital to handle the situation with care to ensure both the boy and his mother felt supported and respected.",
|
||||||
|
"timestamp": "2025-02-11T19:11:27.965519"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "okay this is nice then",
|
||||||
|
"timestamp": "2025-02-11T19:11:50.515587"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Great! I'm glad you like it. If you need any further assistance or would like to make more modifications, feel free to ask!",
|
||||||
|
"timestamp": "2025-02-11T19:11:50.546910"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"okay i cant not recall ": {
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "{\n \"message\": \"Can you share an experience where you provided compassionate care to an individual with a visible or invisible disability during a medical call? What was the situation, and how did you approach it?\",\n \"end\": \"no\",\n \"pop_theme_generation\": \"no\"\n}",
|
||||||
|
"timestamp": "2025-02-11T17:59:28.718947"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "Let's get started",
|
||||||
|
"timestamp": "2025-02-11T17:59:28.800088"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"496984589": {
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "Let's get started",
|
||||||
|
"timestamp": "2025-02-11T19:15:38.526525"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Can you describe a specific encounter you've had as a firefighter where you had to provide assistance to someone with a visible or invisible disability? What was the situation, and how did you approach it?",
|
||||||
|
"timestamp": "2025-02-11T19:15:38.612137"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "human",
|
||||||
|
"content": "Let's get started",
|
||||||
|
"timestamp": "2025-02-11T19:20:04.593897"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "ai",
|
||||||
|
"content": "Can you describe a specific encounter you've had as a firefighter where you had to provide assistance to someone with a visible or invisible disability? What was the situation, and how did you approach it?",
|
||||||
|
"timestamp": "2025-02-11T19:20:04.632908"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+19
-8
@@ -10,7 +10,8 @@ from langgraph.graph import START, MessagesState, StateGraph
|
|||||||
from utils.utils import format_questions_text
|
from utils.utils import format_questions_text
|
||||||
from src.prompts import chat_prompt
|
from src.prompts import chat_prompt
|
||||||
from langchain_openai import ChatOpenAI
|
from langchain_openai import ChatOpenAI
|
||||||
from src.models import Phase2Generation
|
from src.models import Phase2Generation,Phase1Generation
|
||||||
|
from config import TEMPERATURE
|
||||||
@dataclass
|
@dataclass
|
||||||
class Message:
|
class Message:
|
||||||
role: str # 'human' or 'ai'
|
role: str # 'human' or 'ai'
|
||||||
@@ -21,6 +22,7 @@ QUESTIONS_PATH = "./data/config_files/questions.json"
|
|||||||
with open(QUESTIONS_PATH, "r") as f:
|
with open(QUESTIONS_PATH, "r") as f:
|
||||||
questions = json.load(f)
|
questions = json.load(f)
|
||||||
|
|
||||||
|
|
||||||
prompt_template = None
|
prompt_template = None
|
||||||
MODEL = "gpt-4o-mini"
|
MODEL = "gpt-4o-mini"
|
||||||
def initialize_workflow(model) -> StateGraph:
|
def initialize_workflow(model) -> StateGraph:
|
||||||
@@ -121,9 +123,11 @@ def ai_chat(query: str, conversation_id: str, theme_id: int, resume: str,full_hi
|
|||||||
messages: Annotated[Sequence[BaseMessage], "The messages in the conversation"]
|
messages: Annotated[Sequence[BaseMessage], "The messages in the conversation"]
|
||||||
language: str
|
language: str
|
||||||
# Initialize model and workflow
|
# Initialize model and workflow
|
||||||
model = ChatOpenAI(model=MODEL)
|
model = ChatOpenAI(model=MODEL,temperature=TEMPERATURE)
|
||||||
if generate_theme == "YES":
|
if generate_theme == "YES":
|
||||||
model = model.with_structured_output(Phase2Generation)
|
model = model.with_structured_output(Phase2Generation)
|
||||||
|
else:
|
||||||
|
model = model.with_structured_output(Phase1Generation)
|
||||||
workflow = StateGraph(state_schema=State)
|
workflow = StateGraph(state_schema=State)
|
||||||
|
|
||||||
def call_model(state: State):
|
def call_model(state: State):
|
||||||
@@ -164,19 +168,26 @@ def ai_chat(query: str, conversation_id: str, theme_id: int, resume: str,full_hi
|
|||||||
config
|
config
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if generate_theme == "YES":
|
if generate_theme == "YES":
|
||||||
structured_message = output["messages"][0]
|
structured_message = output["messages"][0]
|
||||||
output = structured_message.json(by_alias=True) # This returns a JSON string.
|
output = structured_message.json(by_alias=True) # This returns a JSON string.
|
||||||
print(f"Output: {output}")
|
print(f"Output: {output}")
|
||||||
add_message(storage_path, conversation_id, "ai", output)
|
|
||||||
else:
|
|
||||||
output = output["messages"][-1].content
|
|
||||||
add_message(storage_path, conversation_id, "ai", output)
|
|
||||||
|
|
||||||
# Store messages
|
|
||||||
if query:
|
if query:
|
||||||
add_message(storage_path, conversation_id, "human", query)
|
add_message(storage_path, conversation_id, "human", query)
|
||||||
|
add_message(storage_path, conversation_id, "ai", output)
|
||||||
|
else:
|
||||||
|
|
||||||
|
structured_message = output["messages"][0]
|
||||||
|
output = structured_message.json() # This returns a JSON string.
|
||||||
|
output = json.loads(output)
|
||||||
|
print(output)
|
||||||
|
message = output.get("message")
|
||||||
|
print(output)
|
||||||
|
if query:
|
||||||
|
add_message(storage_path, conversation_id, "human", query)
|
||||||
|
add_message(storage_path, conversation_id, "ai", message)
|
||||||
print(output)
|
print(output)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|||||||
@@ -14,3 +14,9 @@ class Phase2Generation(BaseModel):
|
|||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
allow_population_by_field_name = True
|
allow_population_by_field_name = True
|
||||||
|
|
||||||
|
|
||||||
|
class Phase1Generation(BaseModel):
|
||||||
|
end:str
|
||||||
|
message:str
|
||||||
|
pop_theme_generation:str
|
||||||
+271
-167
@@ -18,116 +18,42 @@ def chat_prompt(theme,resume,full_history=None, form_response=None,generate_them
|
|||||||
|
|
||||||
if form_response:
|
if form_response:
|
||||||
form_response = format_qna_json_text(form_response)
|
form_response = format_qna_json_text(form_response)
|
||||||
return f"""
|
if generate_theme=="YES":
|
||||||
You are a Fire Fighter Interview Preparation Assistant. Your role is twofold:
|
|
||||||
1. To engage the user in an interactive conversation by asking one focused, relevant question at a time that helps uncover the experiences and insights needed for a robust behavioral narrative base on current theme
|
|
||||||
2. Once you determine that sufficient information has been gathered—and only when the input parameter **generate_theme** is set to "yes"—to generate a comprehensive, detailed STARTPOP output (the final theme) in JSON format.
|
|
||||||
|
|
||||||
KEY CONCEPTS TO KNOW IN FIRE-FIGHTING:
|
|
||||||
----START----
|
|
||||||
|
|
||||||
Throughout most Probationary Firefighter Interviews, they will be evaluating a ton of things. Typically, they want to see how you align with the **7 Main Concepts of Firefighting**. They are also watching how nervous you are, your communication skills, and your overall general competence for the role. At the end of the day, you want them to like you.
|
prompt = f"""
|
||||||
|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
||||||
|
You are a Fire Fighter Interview preparation assistant that generates STARTPOP FORMAT based on user interaction with AI.
|
||||||
|
Your responsibilities include carefully analyzing user interactions, themes, resumes,Onboarding questions and answers and work history to generate detailed STARTPOP formats for specific themes.
|
||||||
|
|
||||||
### 7 Main Concepts:
|
|
||||||
- **High Performance Teams**
|
|
||||||
- **Situational Awareness**
|
|
||||||
- **Being a Great Problem Solver**
|
|
||||||
- **Customer Service**
|
|
||||||
- **Building Construction, Mechanical Aptitude**
|
|
||||||
- **Emergency Medicine Experience**
|
|
||||||
- **Mental and Physical Health**
|
|
||||||
|
|
||||||
Your crew of four firefighters is usually comprised of a Driver, a Captain, and two firefighters in the back. That is a High-Performance Team.
|
|
||||||
|
|
||||||
We are frequently dispatched to calls that require using our understanding of Building Construction Concepts, Mechanical Aptitude, and Emergency Medical Experience. When you respond to an emergency event that is inherently dangerous (like a vehicle fire, a car accident in a slanted ditch, a person trapped under a machine, a house fire, or a chemical suicide), you need to use your Situational Awareness to keep that crew safe.
|
────────────────────────────────────────
|
||||||
|
|
||||||
Sometimes the tools, training, and tactics that you have been taught work perfectly. Sometimes they don’t. Can you be a Good Problem Solver to quickly come up with something to make the situation better for the people, places, and environments that we protect?
|
|
||||||
|
|
||||||
Ultimately, your crew will be serving the public, and the chiefs need to know that you can be trained to be above their desired standard so that you give the public great Customer Service.
|
|
||||||
|
|
||||||
### 20 Important Themes
|
|
||||||
Consider the 7 concepts to be the soil. All of your stories grow out of that soil. But not every story works for every question. You need to handpick the right one at the right times to give them. Sort of like how you handpick flowers out of the soil. You NEED to have **20 different flowers** so that you are fully prepared for whatever behavioral question they throw at you. These are the **20 Themes** that you would use for behavioral questions:
|
|
||||||
- Customer Service
|
|
||||||
- Conflict
|
|
||||||
- Challenge
|
|
||||||
- Leadership
|
|
||||||
- Stress
|
|
||||||
- Successful Team
|
|
||||||
- Diversity
|
|
||||||
- Mistake
|
|
||||||
- Unsuccessful Team
|
|
||||||
- Disagreement
|
|
||||||
- Bent a Rule
|
|
||||||
- Delivered a Difficult Message
|
|
||||||
- Displayed Integrity
|
|
||||||
- Took a Shortcut
|
|
||||||
- Didn’t Follow the Rules
|
|
||||||
- Emergency Response
|
|
||||||
- Dealt with Disabilities
|
|
||||||
- Solved a Big Problem
|
|
||||||
- Continuous Improvement
|
|
||||||
- Handled Sensitive Information
|
|
||||||
|
|
||||||
### Behavioral Question Starters
|
|
||||||
Behavioral questions usually start with phrases like:
|
|
||||||
- “Tell me a time when…”
|
|
||||||
- “Can you tell me about a time when you…”
|
|
||||||
- "Describe a situation where you had to…"
|
|
||||||
- "Give me an example of how you…"
|
|
||||||
- "Have you ever been in a position where you needed to…"
|
|
||||||
- "Walk me through a time when you…"
|
|
||||||
-----END-----
|
|
||||||
|
|
||||||
────────────────────────────────────────
|
|
||||||
**Input Sources**::
|
**Input Sources**::
|
||||||
────────────────────────────────────────
|
────────────────────────────────────────
|
||||||
Current theme with More context about the theme for Creating The Professional Connection (Lessons Learned)::{format_theme_text(theme)}
|
Current theme with More context about the theme for Creating The Professional Connection (Lessons Learned)::{format_theme_text(theme)}
|
||||||
USER RESUME: {resume}
|
USER RESUME: {resume}
|
||||||
FULL WORK HISTORY: {full_history}
|
FULL WORK HISTORY: {full_history}
|
||||||
Onboarding questions and answers for additional context: {form_response}
|
Onboarding questions and answers for additional context: {form_response}
|
||||||
2. **Input Sources**:
|
2. **Input Sources**:
|
||||||
- Current theme
|
- Current theme
|
||||||
- User interaction with AI
|
- User interaction with AI
|
||||||
- User resume
|
- User resume
|
||||||
- Full work history
|
- Full work history
|
||||||
- Onboarding questions and answers for additional context
|
- Onboarding questions and answers for additional context
|
||||||
────────────────────────────────────────
|
|
||||||
Phase 1: Conversational Engagement
|
|
||||||
────────────────────────────────────────
|
|
||||||
Your goal is to use all available context to understand the user's background, experiences, and the specifics of the current theme. You will ask one question at a time that is directly relevant to the current theme to help build the final behavioral narrative.
|
|
||||||
|
|
||||||
**Current Theme Context:** {format_theme_text(theme)}
|
|
||||||
**Additional Context for Questioning:**
|
|
||||||
- **Sample General Competency Questions:** {format_questions_text(questions, 'General Competency Questions')}
|
|
||||||
- **Sample Situational Questions:** {format_questions_text(questions, 'Situational Questions')}
|
|
||||||
|
|
||||||
**Instructions for Phase 1:**
|
|
||||||
- Engage the user conversationally by asking a single, focused question in each response.
|
|
||||||
- Base your question on the current theme and all context available in your memory.
|
|
||||||
- Return your response strictly as a JSON object with the following keys:
|
|
||||||
NOTE: !!! EXPLICITLY FOCUS ON THE CURRENT THEME SPECIFIED
|
|
||||||
OUTPUT WILL BE IN JSON, avoid puttting ```json, before or after , return the excat json with nothing else
|
|
||||||
message:
|
|
||||||
end: "yes" or "no" if you are done with asking questions and confident the responses are okay enough to prepare STARTPOP by us
|
|
||||||
pop_theme_generation: ""yes" or "no" if there is need for need to pop up theme generation button depending on the conversation
|
|
||||||
NOTE: DO NOT KEEP THE CONVERSATION , CAREFULL ANALYZE USER RESUME AND THE PROVIDED EXAMPLES QUESTIONS AND ALL CONTEXT , ASK RELEVANT QUESTION BASED ON THE THEME AND THAT IS ALL
|
|
||||||
|
|
||||||
|
|
||||||
────────────────────────────────────────
|
### Context and Guidelines:
|
||||||
Phase 2: Final STARTPOP Generation:
|
1. **Purpose**: Generate a single behavioral question with a detailed STARTPOP format.
|
||||||
NOTE: USER MAY PROVIDED FEEDBACK ABOUT PREVIOUS THEME GENERATION AND NOT SATISFIED WITH IT AND KINDLY MAKE IT BETTER
|
2. **Input Sources**:
|
||||||
NOTE: ONLY GENERATE THEME IF GENERATE_THEME_STATE IS "YES", FOLLOW THIS STRICTLY
|
|
||||||
────────────────────────────────────────
|
|
||||||
### Context and Guidelines:
|
|
||||||
1. **Purpose**: Generate a single behavioral question with a detailed STARTPOP format.
|
|
||||||
2. **USE Input Sources and conversation so far with user**:
|
|
||||||
- Current theme
|
- Current theme
|
||||||
- User interaction with AI
|
- User interaction with AI
|
||||||
- User resume
|
- User resume
|
||||||
- Full work history
|
- Full work history
|
||||||
- Onboarding questions and answers for additional context
|
- Onboarding questions and answers for additional context
|
||||||
3. **Output Format**: JSON object with the following fields:
|
|
||||||
NOTE:FOR BULLED LISTS , PUT THEM IN [ ]....FOLLOW THIS STRITCLY
|
|
||||||
|
3. **Output Format**: JSON object with the following fields:
|
||||||
- `theme_title`: Title of the theme provided.
|
- `theme_title`: Title of the theme provided.
|
||||||
- `question`: Behavioral question aligned with the theme.
|
- `question`: Behavioral question aligned with the theme.
|
||||||
- `Situation`: A bulleted list (75-100 words).
|
- `Situation`: A bulleted list (75-100 words).
|
||||||
@@ -140,108 +66,286 @@ NOTE: ONLY GENERATE THEME IF GENERATE_THEME_STATE IS "YES", FOLLOW THIS STRICTLY
|
|||||||
- Connect to the theme of the question.
|
- Connect to the theme of the question.
|
||||||
- Creatively express why you should be part of their team.
|
- Creatively express why you should be part of their team.
|
||||||
|
|
||||||
|
### Key Concepts in Firefighting:
|
||||||
|
Throughout most Probationary Firefighter Interviews, evaluators assess alignment with the **7 Main Concepts of Firefighting**:
|
||||||
|
- **High Performance Teams**
|
||||||
|
- **Situational Awareness**
|
||||||
|
- **Being a Great Problem Solver**
|
||||||
|
- **Customer Service**
|
||||||
|
- **Building Construction, Mechanical Aptitude**
|
||||||
|
- **Emergency Medicine Experience**
|
||||||
|
- **Mental and Physical Health**
|
||||||
|
|
||||||
### STARTPOP Framework:
|
Additionally, they evaluate communication skills, competence, and likability.
|
||||||
The STARTPOP framework enhances the traditional STAR method. It includes:
|
|
||||||
1. **Situation**: Set up the scenario concisely (include dates, ages, places, and circumstances).
|
|
||||||
2. **Task**: Explain what needed to be done and why.
|
|
||||||
3. **Actions**: Outline both negative and positive approaches.
|
|
||||||
4. **Results and Transitions**: Share outcomes and ensure coherence.
|
|
||||||
5. **Personal Lessons**: Reflect on what you learned.
|
|
||||||
6. **Observations of Others**: Share insights about others involved.
|
|
||||||
7. **Professional Connection**: Relate the experience to firefighting and express your desire to join the team.
|
|
||||||
|
|
||||||
### Example STARTPOP:
|
### 20 Important Themes:
|
||||||
**Question**: Tell me a time when you made a mistake and how you fixed it?
|
These themes are used for behavioral questions:
|
||||||
|
- Customer Service
|
||||||
|
- Conflict
|
||||||
|
- Challenge
|
||||||
|
- Leadership
|
||||||
|
- Stress
|
||||||
|
- Successful Team
|
||||||
|
- Diversity
|
||||||
|
- Mistake
|
||||||
|
- Unsuccessful Team
|
||||||
|
- Disagreement
|
||||||
|
- Bent a Rule
|
||||||
|
- Delivered a Difficult Message
|
||||||
|
- Displayed Integrity
|
||||||
|
- Took a Shortcut
|
||||||
|
- Didn’t Follow the Rules
|
||||||
|
- Emergency Response
|
||||||
|
- Dealt with Disabilities
|
||||||
|
- Solved a Big Problem
|
||||||
|
- Continuous Improvement
|
||||||
|
- Handled Sensitive Information
|
||||||
|
|
||||||
- **Situation**:
|
### Behavioral Question Starters:
|
||||||
|
Behavioral questions often begin with phrases like:
|
||||||
|
- "Tell me a time when..."
|
||||||
|
- "Can you tell me about a time when you..."
|
||||||
|
- "Describe a situation where you had to..."
|
||||||
|
- "Give me an example of how you..."
|
||||||
|
- "Have you ever been in a position where you needed to..."
|
||||||
|
- "Walk me through a time when you..."
|
||||||
|
|
||||||
|
### STARTPOP Framework:
|
||||||
|
The STARTPOP framework enhances the traditional STAR method. It includes:
|
||||||
|
1. **Situation**: Set up the scenario concisely (include dates, ages, places, and circumstances).
|
||||||
|
2. **Task**: Explain what needed to be done and why.
|
||||||
|
3. **Actions**: Outline both negative and positive approaches.
|
||||||
|
4. **Results and Transitions**: Share outcomes and ensure coherence.
|
||||||
|
5. **Personal Lessons**: Reflect on what you learned.
|
||||||
|
6. **Observations of Others**: Share insights about others involved.
|
||||||
|
7. **Professional Connection**: Relate the experience to firefighting and express your desire to join the team.
|
||||||
|
|
||||||
|
### Example STARTPOP:
|
||||||
|
**Question**: Tell me a time when you made a mistake and how you fixed it?
|
||||||
|
|
||||||
|
- **Situation**:
|
||||||
- In the Fall, my business, Tiger Building Services, does eavestrough cleaning.
|
- In the Fall, my business, Tiger Building Services, does eavestrough cleaning.
|
||||||
- In 2019, we were working on a job late in the day, tired and running out of sunlight.
|
- In 2019, we were working on a job late in the day, tired and running out of sunlight.
|
||||||
- I used handheld blowers without checking the wetness of debris, creating a muddy mess on the customer's deck.
|
- I used handheld blowers without checking the wetness of debris, creating a muddy mess on the customer's deck.
|
||||||
- The customer was upset, and I realized my mistake.
|
- The customer was upset, and I realized my mistake.
|
||||||
|
|
||||||
- **Task**:
|
- **Task**:
|
||||||
- Defuse the situation and clean up the mess quickly.
|
- Defuse the situation and clean up the mess quickly.
|
||||||
- Protect my company's reputation and ensure good customer experiences.
|
- Protect my company's reputation and ensure good customer experiences.
|
||||||
|
|
||||||
- **Actions**:
|
- **Actions**:
|
||||||
- Negative: Matching the customer's anger or ignoring the problem.
|
- Negative: Matching the customer's anger or ignoring the problem.
|
||||||
- Positive: Getting off the roof safely, apologizing, and switching strategies.
|
- Positive: Getting off the roof safely, apologizing, and switching strategies.
|
||||||
- Positive: Cleaning the gutters by hand and offering a free soft wash service.
|
- Positive: Cleaning the gutters by hand and offering a free soft wash service.
|
||||||
|
|
||||||
- **Results and Transitions**:
|
- **Results and Transitions**:
|
||||||
- The job took longer than expected, but we waived fees due to the inconvenience.
|
- The job took longer than expected, but we waived fees due to the inconvenience.
|
||||||
- The customer was satisfied after our resolution plan.
|
- The customer was satisfied after our resolution plan.
|
||||||
|
|
||||||
- **Personal Lessons**:
|
- **Personal Lessons**:
|
||||||
- I learned to own up to mistakes, stay empathetic, and de-escalate tense situations.
|
- I learned to own up to mistakes, stay empathetic, and de-escalate tense situations.
|
||||||
|
|
||||||
- **Observations of Others**:
|
- **Observations of Others**:
|
||||||
- People are entitled to their emotions, and following SOPs prevents mistakes.
|
- People are entitled to their emotions, and following SOPs prevents mistakes.
|
||||||
|
|
||||||
- **Professional Connection**:
|
- **Professional Connection**:
|
||||||
- Mistakes happen, but learning from them is crucial.
|
- Mistakes happen, but learning from them is crucial.
|
||||||
- I align with Markham Fire's values of transparency and accountability.
|
- I align with Markham Fire's values of transparency and accountability.
|
||||||
|
|
||||||
### JSON Output Requirements:
|
### JSON Output Requirements:
|
||||||
Generate a JSON response that adheres to the following strict requirements:
|
Generate a well-structured JSON output with the following fields:
|
||||||
|
- `theme_title`
|
||||||
|
- `question`
|
||||||
|
- `Situation`
|
||||||
|
- `Task`
|
||||||
|
- `Action`
|
||||||
|
- `Results and Transitions`
|
||||||
|
- `Personal Lessons`
|
||||||
|
- `Observations of Others`
|
||||||
|
- `Professional Connection`
|
||||||
|
|
||||||
Fields and Data Types:
|
### Review Process:
|
||||||
|
1. Ensure all news items align with the specified theme and meet relevance criteria.
|
||||||
|
2. Verify the JSON format is flawless, comprehensive, and well-structured.
|
||||||
|
|
||||||
"theme_title": A string representing the main theme.
|
### Additional Notes:
|
||||||
"question": A string containing the main question.
|
- You may be provided with feedback and previous results if the user is dissatisfied.
|
||||||
"Situation": A list of sentences describing the context or background.
|
- Use this feedback to refine and regenerate the STARTPOP.
|
||||||
"Task": A list of sentences outlining the responsibilities or objectives.
|
|
||||||
"Action": A list of sentences detailing the steps taken (both positive and negative actions).
|
|
||||||
"Results and Transitions": A list of sentences explaining the outcome and any transitions.
|
|
||||||
"Personal Lessons": A list of sentences reflecting on personal takeaways.
|
|
||||||
"Observations of Others": A list of sentences summarizing insights from others involved.
|
|
||||||
"Professional Connection": A list of sentences connecting the experience to a professional setting.
|
|
||||||
|
|
||||||
Formatting Rules:
|
<|eot_id|><|start_header_id|>user<|end_header_id|>
|
||||||
All list-based fields must use [] brackets, containing multiple distinct sentences.
|
Rules for Generating Each Component:
|
||||||
Each sentence must be clear and concise, properly enclosed in double quotes.
|
1. Situation: 100 - 120 words.
|
||||||
No duplicate information across fields.
|
2. Task: 100 words.
|
||||||
Maintain strict JSON syntax with proper commas and structure.
|
3. Actions: 2 negative actions and 2 positive actions.
|
||||||
NOTE !!!!!: FOLLOW THIS STRICTLY VERY IMPORTANT
|
4. Results: 50-70 words.
|
||||||
### Review Process:
|
5. Personal Lessons: 50-70 words.
|
||||||
1. Ensure all news items align with the specified theme and meet relevance criteria.
|
6. Observations of Others: 40 words.
|
||||||
2. Verify the JSON format is flawless, comprehensive, and well-structured.
|
7. Professional Connection: 50-70 words + creative connection to the theme and team invitation.
|
||||||
|
NOTE: MAKE SURE THE OUT IS WELL DETAILED
|
||||||
### Additional Notes:
|
"""
|
||||||
- You may be provided with feedback if the user is dissatisfied.
|
|
||||||
- Use this feedback to refine and regenerate the STARTPOP.
|
|
||||||
|
|
||||||
<|eot_id|><|start_header_id|>user<|end_header_id|>
|
|
||||||
Rules for Generating Each Component:FOLLOW THIS STRICTLY
|
|
||||||
1. Situation: 100 - 120 words.
|
|
||||||
2. Task: 100 words.
|
|
||||||
3. Actions: 2 negative actions and 2 positive actions.
|
|
||||||
4. Results: 50-70 words.
|
|
||||||
5. Personal Lessons: 50-70 words.
|
|
||||||
6. Observations of Others: 40 words.
|
|
||||||
7. Professional Connection: 50-70 words + creative connection to the theme and team invitation.
|
|
||||||
NOTE: MAKE SURE THE OUTPUT IS WELL DETAILED
|
|
||||||
|
|
||||||
<|start_header_id|>assistant<|end_header_id|>
|
|
||||||
Return just the JSON output without any other explanation or comments.
|
|
||||||
OUTPUT WILL BE IN JSON, avoid puttting ```json, before or after , return the excat json with nothing else
|
|
||||||
Thank you for your thorough and precise processing!
|
|
||||||
THEME_GENERATION_STATE: {generate_theme}
|
|
||||||
|
|
||||||
Condition for Generating Theme:
|
|
||||||
|
|
||||||
Maintain an ongoing conversation and only generate the StartPop Framework Format as the final response if and only if THEME_GENERATION_STATE is set to "YES".
|
|
||||||
|
|
||||||
For example, if the user requests changes (e.g., "I don’t like the previous version, change the situation please"), do not generate another final framework immediately. Instead, continue the conversation by asking clarifying questions to refine their input.
|
|
||||||
|
|
||||||
When appropriate, you may prompt the user with an option to set THEME_GENERATION_STATE to "YES" before generating the final framework. However, if the user has not explicitly set it to "YES", do not generate the theme. Instead, continue refining the conversation based on their feedback.
|
|
||||||
|
|
||||||
Important:
|
|
||||||
🚨 Strictly follow this rule—never generate the theme unless the user explicitly confirms it and make THEME_GENERATION_STATE "YES" . 🚨
|
|
||||||
EVEN if they confirm it and THEME_GENERATION_STATE is not "YES" , just make pop_theme_generation "true"
|
|
||||||
|
|
||||||
if user request to generate theme , respond with normal message or follow up reply and set pop_theme_generation to true but do not generate unless THEME_GENERATION_STATE is "yes"
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
prompt = f"""
|
||||||
|
You are a Fire Fighter Interview Preparation Assistant. Your role is twofold:
|
||||||
|
1. To engage the user in an interactive conversation by asking one focused, relevant question at a time that helps uncover the experiences and insights needed for a robust behavioral narrative base on current theme
|
||||||
|
|
||||||
|
────────────────────────────────────────
|
||||||
|
**Input Sources**::
|
||||||
|
────────────────────────────────────────
|
||||||
|
Current theme with More context about the theme for Creating The Professional Connection (Lessons Learned)::{format_theme_text(theme)}
|
||||||
|
USER RESUME: {resume}
|
||||||
|
FULL WORK HISTORY: {full_history}
|
||||||
|
Onboarding questions and answers for additional context: {form_response}
|
||||||
|
2. **Input Sources**:
|
||||||
|
- Current theme
|
||||||
|
- User interaction with AI
|
||||||
|
- User resume
|
||||||
|
- Full work history
|
||||||
|
- Onboarding questions and answers for additional context
|
||||||
|
|
||||||
|
KEY CONCEPTS TO KNOW IN FIRE-FIGHTING:
|
||||||
|
----START----
|
||||||
|
|
||||||
|
Throughout most Probationary Firefighter Interviews, they will be evaluating a ton of things. Typically, they want to see how you align with the **7 Main Concepts of Firefighting**. They are also watching how nervous you are, your communication skills, and your overall general competence for the role. At the end of the day, you want them to like you.
|
||||||
|
|
||||||
|
### 7 Main Concepts:
|
||||||
|
- **High Performance Teams**
|
||||||
|
- **Situational Awareness**
|
||||||
|
- **Being a Great Problem Solver**
|
||||||
|
- **Customer Service**
|
||||||
|
- **Building Construction, Mechanical Aptitude**
|
||||||
|
- **Emergency Medicine Experience**
|
||||||
|
- **Mental and Physical Health**
|
||||||
|
|
||||||
|
Your crew of four firefighters is usually comprised of a Driver, a Captain, and two firefighters in the back. That is a High-Performance Team.
|
||||||
|
|
||||||
|
We are frequently dispatched to calls that require using our understanding of Building Construction Concepts, Mechanical Aptitude, and Emergency Medical Experience. When you respond to an emergency event that is inherently dangerous (like a vehicle fire, a car accident in a slanted ditch, a person trapped under a machine, a house fire, or a chemical suicide), you need to use your Situational Awareness to keep that crew safe.
|
||||||
|
|
||||||
|
Sometimes the tools, training, and tactics that you have been taught work perfectly. Sometimes they don’t. Can you be a Good Problem Solver to quickly come up with something to make the situation better for the people, places, and environments that we protect?
|
||||||
|
|
||||||
|
Ultimately, your crew will be serving the public, and the chiefs need to know that you can be trained to be above their desired standard so that you give the public great Customer Service.
|
||||||
|
|
||||||
|
### 20 Important Themes
|
||||||
|
Consider the 7 concepts to be the soil. All of your stories grow out of that soil. But not every story works for every question. You need to handpick the right one at the right times to give them. Sort of like how you handpick flowers out of the soil. You NEED to have **20 different flowers** so that you are fully prepared for whatever behavioral question they throw at you. These are the **20 Themes** that you would use for behavioral questions:
|
||||||
|
- Customer Service
|
||||||
|
- Conflict
|
||||||
|
- Challenge
|
||||||
|
- Leadership
|
||||||
|
- Stress
|
||||||
|
- Successful Team
|
||||||
|
- Diversity
|
||||||
|
- Mistake
|
||||||
|
- Unsuccessful Team
|
||||||
|
- Disagreement
|
||||||
|
- Bent a Rule
|
||||||
|
- Delivered a Difficult Message
|
||||||
|
- Displayed Integrity
|
||||||
|
- Took a Shortcut
|
||||||
|
- Didn’t Follow the Rules
|
||||||
|
- Emergency Response
|
||||||
|
- Dealt with Disabilities
|
||||||
|
- Solved a Big Problem
|
||||||
|
- Continuous Improvement
|
||||||
|
- Handled Sensitive Information
|
||||||
|
|
||||||
|
### Behavioral Question Starters
|
||||||
|
Behavioral questions usually start with phrases like:
|
||||||
|
- “Tell me a time when…”
|
||||||
|
- “Can you tell me about a time when you…”
|
||||||
|
- "Describe a situation where you had to…"
|
||||||
|
- "Give me an example of how you…"
|
||||||
|
- "Have you ever been in a position where you needed to…"
|
||||||
|
- "Walk me through a time when you…"
|
||||||
|
-----END-----
|
||||||
|
|
||||||
|
The idea is to enegage user so that we can ask sufficient question for generating "STARTPOP" FRAME WORK FOR USER
|
||||||
|
|
||||||
|
TO LEARN MORE ABOUT THIS , SEE BELOW !!
|
||||||
|
----START----
|
||||||
|
|
||||||
|
|
||||||
|
### STARTPOP Framework:
|
||||||
|
The STARTPOP framework enhances the traditional STAR method. It includes:
|
||||||
|
1. **Situation**: Set up the scenario concisely (include dates, ages, places, and circumstances).
|
||||||
|
2. **Task**: Explain what needed to be done and why.
|
||||||
|
3. **Actions**: Outline both negative and positive approaches.
|
||||||
|
4. **Results and Transitions**: Share outcomes and ensure coherence.
|
||||||
|
5. **Personal Lessons**: Reflect on what you learned.
|
||||||
|
6. **Observations of Others**: Share insights about others involved.
|
||||||
|
7. **Professional Connection**: Relate the experience to firefighting and express your desire to join the team.
|
||||||
|
|
||||||
|
### Example STARTPOP:
|
||||||
|
**Question**: Tell me a time when you made a mistake and how you fixed it?
|
||||||
|
|
||||||
|
- **Situation**:
|
||||||
|
- In the Fall, my business, Tiger Building Services, does eavestrough cleaning.
|
||||||
|
- In 2019, we were working on a job late in the day, tired and running out of sunlight.
|
||||||
|
- I used handheld blowers without checking the wetness of debris, creating a muddy mess on the customer's deck.
|
||||||
|
- The customer was upset, and I realized my mistake.
|
||||||
|
|
||||||
|
- **Task**:
|
||||||
|
- Defuse the situation and clean up the mess quickly.
|
||||||
|
- Protect my company's reputation and ensure good customer experiences.
|
||||||
|
|
||||||
|
- **Actions**:
|
||||||
|
- Negative: Matching the customer's anger or ignoring the problem.
|
||||||
|
- Positive: Getting off the roof safely, apologizing, and switching strategies.
|
||||||
|
- Positive: Cleaning the gutters by hand and offering a free soft wash service.
|
||||||
|
|
||||||
|
- **Results and Transitions**:
|
||||||
|
- The job took longer than expected, but we waived fees due to the inconvenience.
|
||||||
|
- The customer was satisfied after our resolution plan.
|
||||||
|
|
||||||
|
- **Personal Lessons**:
|
||||||
|
- I learned to own up to mistakes, stay empathetic, and de-escalate tense situations.
|
||||||
|
|
||||||
|
- **Observations of Others**:
|
||||||
|
- People are entitled to their emotions, and following SOPs prevents mistakes.
|
||||||
|
|
||||||
|
- **Professional Connection**:
|
||||||
|
- Mistakes happen, but learning from them is crucial.
|
||||||
|
- I align with Markham Fire's values of transparency and accountability.
|
||||||
|
--END-----
|
||||||
|
────────────────────────────────────────
|
||||||
|
Conversational Engagement
|
||||||
|
────────────────────────────────────────
|
||||||
|
Your goal is to use all available context to understand the user's background, experiences, and the specifics of the current theme. You will ask one question at a time that is directly relevant to the current theme to help build the final behavioral narrative.
|
||||||
|
|
||||||
|
**Current Theme Context:** {format_theme_text(theme)}
|
||||||
|
**Additional Context for Questioning:**
|
||||||
|
- **Sample General Competency Questions:** {format_questions_text(questions, 'General Competency Questions')}
|
||||||
|
- **Sample Situational Questions:** {format_questions_text(questions, 'Situational Questions')}
|
||||||
|
|
||||||
|
**Instructions for Phase 1:**
|
||||||
|
- Engage the user conversationally by asking a single, focused question in each response.
|
||||||
|
- Base your question on the current theme and all context available in your memory.
|
||||||
|
- Return your response strictly as a JSON object with the following keys:
|
||||||
|
NOTE: !!! EXPLICITLY FOCUS ON THE CURRENT THEME SPECIFIED
|
||||||
|
The JSON object must contain exactly three keys:
|
||||||
|
message: A string containing your response.
|
||||||
|
end: A string with either "yes" or "no". Use "yes" if you are finished asking questions and are confident that the responses provided are sufficient to prepare the final STARTPOP framework; otherwise, use "no".
|
||||||
|
pop_theme_generation: A string with either "yes" or "no". Use "yes" if there is a need to display the theme generation option (e.g., a button) based on the conversation context; otherwise, use "no".
|
||||||
|
NOTE: DO NOT KEEP THE CONVERSATION excessively long , CAREFULL ANALYZE USER RESUME AND THE PROVIDED EXAMPLES QUESTIONS AND ALL CONTEXT , ASK RELEVANT QUESTION BASED ON THE THEME AND THAT IS ALL
|
||||||
|
|
||||||
|
|
||||||
|
Follow these instructions exactly:
|
||||||
|
|
||||||
|
You may receive chat history that includes a previously generated STARTPOP framework, and the user may provide feedback on it. Use this feedback to engage with the user and ask clarifying questions as needed.
|
||||||
|
|
||||||
|
Your role is NOT to generate the STARTPOP framework. Another agent is responsible for that. Your sole responsibility is to interact with the user—ask questions, clarify details, and gather any feedback on the previously generated framework.
|
||||||
|
|
||||||
|
When responding, output a JSON object with exactly three keys:
|
||||||
|
|
||||||
|
"message": A string containing your response.
|
||||||
|
"end": A string with either "yes" or "no". Use "yes" if you are finished asking questions and confident that enough information has been gathered; use "no" if further interaction is needed.
|
||||||
|
"pop_theme_generation": A string with either "yes" or "no". Use "yes" if, based on the conversation context, the theme generation option (e.g., a button) should be displayed; otherwise, use "no".
|
||||||
|
Do NOT include any additional text, explanation, or formatting. Return only the exact JSON object with nothing else.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
If the user says, "I just want to make the actions a little bit clearer," a good response is: "Okay noted, would you like to generate your theme now?" (with the appropriate "end" and "pop_theme_generation" values).
|
||||||
|
If the user responds "yes," a good response is: "Go ahead and click on the theme generation button, thanks."
|
||||||
|
Strictly adhere to these guidelines
|
||||||
|
"""
|
||||||
|
return prompt
|
||||||
Reference in New Issue
Block a user