Spaces:
Sleeping
Sleeping
Handle empty responses in AI recommendation generation
Browse filesRefined prompt logic to address scenarios with no clinic data by removing redundant conditions and ensuring appropriate responses are generated. This improves clarity and consistency in AI feedback for edge cases.
trauma/api/message/ai/openai_request.py
CHANGED
|
@@ -56,11 +56,9 @@ async def generate_final_response(
|
|
| 56 |
if empty_field_instructions:
|
| 57 |
prompt = (TraumaPrompts.generate_not_fully_recommendations
|
| 58 |
.replace("{instructions}", empty_field_instructions))
|
| 59 |
-
|
| 60 |
prompt = (TraumaPrompts.generate_recommendation_decision
|
| 61 |
.replace("{final_entities}", final_entities))
|
| 62 |
-
else:
|
| 63 |
-
prompt = TraumaPrompts.generate_empty_recommendations
|
| 64 |
messages = [
|
| 65 |
{
|
| 66 |
"role": "system",
|
|
|
|
| 56 |
if empty_field_instructions:
|
| 57 |
prompt = (TraumaPrompts.generate_not_fully_recommendations
|
| 58 |
.replace("{instructions}", empty_field_instructions))
|
| 59 |
+
else:
|
| 60 |
prompt = (TraumaPrompts.generate_recommendation_decision
|
| 61 |
.replace("{final_entities}", final_entities))
|
|
|
|
|
|
|
| 62 |
messages = [
|
| 63 |
{
|
| 64 |
"role": "system",
|