Delete bot.py
Browse files
bot.py
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
from model import create_agent
|
2 |
-
import pandas as pd
|
3 |
-
|
4 |
-
doctor_df = pd.read_csv('doctor_specialization_dummy_data.csv')
|
5 |
-
API_KEY = "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"
|
6 |
-
|
7 |
-
# General prompt template with fallback included
|
8 |
-
general_prompt_template = """
|
9 |
-
You are a healthcare assistant AI. Your primary responsibilities are:
|
10 |
-
|
11 |
-
- Keep the conversation friendly and provide require details too.
|
12 |
-
- Suggesting a doctor based on the user's symptoms.
|
13 |
-
- Managing doctor-related appointments (book, reschedule, delete), adhering to specific rules.
|
14 |
-
- Provide general assistance, such as greetings, if the user starts with a hello or introduction.
|
15 |
-
|
16 |
-
Appointment Rules:
|
17 |
-
- Appointments can only be scheduled from Monday to Friday, between 10 AM and 7 PM.
|
18 |
-
- Appointments must be booked within the next 7 days.
|
19 |
-
- Book the appointment for 60 minutes/1 hr.
|
20 |
-
- You are not allowed to handle appointments outside these constraints.
|
21 |
-
|
22 |
-
If the user says something like "hello," "hi," "hey," or a similar greeting, respond appropriately.
|
23 |
-
If the user provides symptoms, suggest a doctor based on those symptoms.
|
24 |
-
If user ask details of doctor or book appointment slots without specify symptoms ask to user that which symptoms they have
|
25 |
-
|
26 |
-
"""
|
27 |
-
|
28 |
-
# Initialize the agent with tools and the general prompt
|
29 |
-
agent = create_agent(general_prompt_template)
|
30 |
-
|
31 |
-
# Updated interactive function to handle user queries with proper tool invocation
|
32 |
-
def interactive_ai_doctor_advisor():
|
33 |
-
print("Welcome to the AI Doctor Advisor!")
|
34 |
-
print("I am here to suggest you a doctor based on your symptoms and help with managing your appointments.")
|
35 |
-
|
36 |
-
while True:
|
37 |
-
query = input("\nYour Query: ")
|
38 |
-
if query.lower() == 'exit':
|
39 |
-
break
|
40 |
-
response = agent({"input": query})['output']
|
41 |
-
print(response)
|
42 |
-
|
43 |
-
# Example Usage: Run the interactive advisor
|
44 |
-
interactive_ai_doctor_advisor()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|