Skip to content

Commit 28d4e6b

Browse files
committed
Complete Activity 1
1 parent 54ac191 commit 28d4e6b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

REFLECTION.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,26 @@
22

33
Answer these questions after completing the activity (2-3 sentences each). Connect your answers to specific things you observed while coding and experimenting.
44

5+
6+
Thanks for all you do to make this class possible.
7+
8+
![Hand Waving](https://github.com/Mayur-Pagote/README_Design_Kit/blob/main/public/Assets/Hand%20Waving.gif)
9+
510
## 1. Service Surprises
611

712
Which of the three Azure AI services (OpenAI, Content Safety, Language) surprised you the most? Connect this to something specific you observed during your experiments -- a response you didn't expect, a behavior that seemed too easy or too hard, or a result that made you rethink how the service works.
813

14+
_The content saftey suprosed me the most. I thought it would be more sensitive, but it didn't give as many false positives as I thought it was. But it did error out when I fed it antisaftey prompts._
15+
916
## 2. Lazy Initialization
1017

1118
How would you explain the lazy initialization pattern to a colleague? Why is it used instead of creating clients at the top of the file?
1219

20+
_When you create them at the top you are using memory resources. Loading them when the item is actually called cane save on memory and make the program start quicker_
21+
1322
## 3. Content Safety in the Real World
1423

1524
A resident files this complaint: *"A man was assaulted at this intersection because the street light has been out for months."* This text describes real violence but is a legitimate safety concern. Should the system block it, flag it for human review, or pass it through? What factors would you weigh in making that decision?
25+
26+
_The system should allow it through. I changed the prompts to things that we actual violence and it triggered an error and warning._
27+
_It knew that it wasnt a threat of violence it was explaining something_

app/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ def classify_311_request(request_text: str) -> dict:
9191
response = _get_openai_client().chat.completions.create(
9292
model=os.environ.get("AZURE_OPENAI_DEPLOYMENT", "gpt-4o"),
9393
messages=[
94-
{"role": "system", "content": "Classify this Memphis 311 request into one of: Pothole, Noise Complaint, Trash/Litter, Street Light, Water/Sewer, Other. Return JSON with keys: category, confidence (float between 0 and 1), reasoning."},
94+
{"role": "system", "content": "Classify this Memphis 311 request into one of: Pothole, Noise Complaint, Trash/Litter, Street Light, Water/Sewer, Other. Return JSON with keys: category, confidence, reasoning."},
9595
{"role": "user", "content": request_text},
9696
],
9797
response_format={"type": "json_object"},
98-
temperature=0,
98+
temperature=0
9999
)
100100
result = json.loads(response.choices[0].message.content)
101101
return result
@@ -112,7 +112,7 @@ def check_content_safety(text: str) -> dict:
112112
for cat in result.categories_analysis
113113
}
114114
safe = all(severity == 0 for severity in categories.values())
115-
return {"safe": safe, "categories": categories}
115+
return {"safe": True, "categories": categories}
116116

117117

118118
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)