Update app.py
Browse files
app.py
CHANGED
@@ -2,82 +2,23 @@ import streamlit as st
|
|
2 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
|
3 |
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
Task: Today, I had an appointment with Bella, a 5-year-old Golden Retriever owned by John Smith. She came in for her annual check-up. Bella weighs 25 kilograms and is in great condition overall.
|
9 |
-
|
10 |
-
During the exam, I checked her vital signs: her temperature was 38.5°C, her heart rate was 80 bpm, and her respiratory rate was 20 breaths per minute—all perfectly normal. Her coat was shiny and free of any abnormalities, her eyes were clear with no discharge, and her ears showed no signs of infection. I did notice some mild tartar on her teeth, which I mentioned to John, and her skin was healthy with no rashes or lesions.
|
11 |
-
|
12 |
-
As part of her routine care, I administered her rabies vaccine, which was due, and confirmed that her distemper vaccination is up to date. We also performed a fecal test and a heartworm test, both of which came back negative.
|
13 |
-
|
14 |
-
For prevention, I prescribed her a monthly heartworm medication and provided her with flea and tick prevention. I told John that Bella is healthy and has no current health concerns. I recommended he continue her balanced diet, keep up her regular exercise, and return in a year for her next check-up.
|
15 |
-
|
16 |
-
It was a pleasure to see Bella, and I look forward to her next visit. – Dr. Emily Carter
|
17 |
-
|
18 |
-
|
19 |
-
Final answer:
|
20 |
-
|
21 |
-
Date of Visit January 9, 2025
|
22 |
-
Pet's Name Bella
|
23 |
-
Species Dog
|
24 |
-
Breed Golden Retriever
|
25 |
-
Age 5 years
|
26 |
-
Weight 25 kg
|
27 |
-
Owner's Name John Smith
|
28 |
-
Reason for Visit Annual Check-up
|
29 |
-
Vital Signs - Temperature: 38.5°C
|
30 |
-
- Heart Rate: 80 bpm
|
31 |
-
- Respiratory Rate: 20/min
|
32 |
-
Physical Exam - Coat: Shiny, no abnormalities
|
33 |
-
- Eyes: Clear, no discharge
|
34 |
-
- Ears: No signs of infection
|
35 |
-
- Teeth: Mild tartar
|
36 |
-
- Skin: No rashes or lesions
|
37 |
-
Vaccinations - Rabies Vaccine: Administered
|
38 |
-
- Distemper: Up to date
|
39 |
-
Tests Performed - Fecal Test: Negative
|
40 |
-
- Heartworm Test: Negative
|
41 |
-
Medications - Monthly Heartworm Prevention prescribed
|
42 |
-
- Flea and Tick prevention given
|
43 |
-
Diagnosis Healthy; No concerns detected
|
44 |
-
Recommendations - Continue balanced diet
|
45 |
-
- Regular exercise
|
46 |
-
- Return in 1 year for next annual check-up
|
47 |
-
Veterinarian Dr. Emily Carter
|
48 |
-
|
49 |
-
"""
|
50 |
-
|
51 |
-
sys_admin_prompt = f"""
|
52 |
-
You are a systems admin at a veterinary clinic. It is your job to organize my reports.
|
53 |
-
|
54 |
-
Here is my report:
|
55 |
-
|
56 |
-
{{task}}
|
57 |
-
|
58 |
-
Here are a few examples of previous tasks
|
59 |
-
|
60 |
-
{{additional_prompting}}
|
61 |
-
"""
|
62 |
-
|
63 |
-
|
64 |
-
admin_agent = CodeAgent(
|
65 |
-
tools=[],
|
66 |
model=HfApiModel(),
|
67 |
)
|
68 |
|
69 |
-
|
70 |
-
agent=
|
71 |
-
name="
|
72 |
-
|
73 |
-
additional_prompting=examples,
|
74 |
-
description="Returns a rough draft of an organized report",
|
75 |
)
|
76 |
|
77 |
manager_agent = CodeAgent(
|
78 |
tools=[],
|
79 |
-
model=HfApiModel(),
|
80 |
-
managed_agents=[
|
|
|
|
|
81 |
)
|
82 |
|
83 |
# Function to log agent actions
|
@@ -89,7 +30,7 @@ def log_agent_action(prompt, result, agent_name):
|
|
89 |
st.code(result, language="text")
|
90 |
|
91 |
# Streamlit app title
|
92 |
-
st.title("AI Veterinary Assistant Agent
|
93 |
|
94 |
# App description
|
95 |
st.write("Generate reports enriched with real-time insights using the AI Veterinary Report Writing Agent powered by SmolAgents and DuckDuckGo.")
|
@@ -109,7 +50,7 @@ if st.button("Generate Report"):
|
|
109 |
st.write(result)
|
110 |
|
111 |
# Log backend activity
|
112 |
-
log_agent_action(prompt, result, "
|
113 |
except Exception as e:
|
114 |
st.error(f"An error occurred: {e}")
|
115 |
else:
|
|
|
2 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
|
3 |
|
4 |
|
5 |
+
web_agent = ToolCallingAgent(
|
6 |
+
tools=[DuckDuckGoSearchTool(max_results=3), VisitWebpageTool()],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
model=HfApiModel(),
|
8 |
)
|
9 |
|
10 |
+
managed_web_agent = ManagedAgent(
|
11 |
+
agent=web_agent,
|
12 |
+
name="search",
|
13 |
+
description="Runs veterinarian web searches. Give it your query as an argument. Also, this agent should link to the sources you are using. If any specific sites are provided, this agent will only those sources.",
|
|
|
|
|
14 |
)
|
15 |
|
16 |
manager_agent = CodeAgent(
|
17 |
tools=[],
|
18 |
+
model=HfApiModel(model_id = "Qwen/Qwen2.5-Coder-32B-Instruct"),
|
19 |
+
managed_agents=[managed_web_agent],
|
20 |
+
additional_authorized_imports=['pyparsing', 'matplotlib', 'datetime', 'statistics', 'bs4', 'request', 'unicodedata', 'queue', 'time', 'collections', 're', 'math', 'stat', 'random',
|
21 |
+
'itertools'],
|
22 |
)
|
23 |
|
24 |
# Function to log agent actions
|
|
|
30 |
st.code(result, language="text")
|
31 |
|
32 |
# Streamlit app title
|
33 |
+
st.title("AI Veterinary Assistant Agent researching your query and summarizing it")
|
34 |
|
35 |
# App description
|
36 |
st.write("Generate reports enriched with real-time insights using the AI Veterinary Report Writing Agent powered by SmolAgents and DuckDuckGo.")
|
|
|
50 |
st.write(result)
|
51 |
|
52 |
# Log backend activity
|
53 |
+
log_agent_action(prompt, result, "Veterinary Research Agent with DuckDuckGo")
|
54 |
except Exception as e:
|
55 |
st.error(f"An error occurred: {e}")
|
56 |
else:
|