Skip to content

Commit

Permalink
smoothed out response when filters are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
alexj1701 committed Apr 15, 2024
1 parent 610e0a3 commit 2c8a51b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def chat():
if message["role"] == "ai":
message["role"] = "assistant"

print(user_messages)
#print(user_messages)

if SAFETY_CHECK_ENABLED:
# for safety check, not to be included in final response
Expand Down Expand Up @@ -211,14 +211,12 @@ def chat():
filtered_data = json.loads(filtered_response.choices[0].message.tool_calls[0].function.arguments)
print("")
print("Completion Request: Filtered Response")
print(filtered_data)
print(filtered_data)
print("")

natural_filter_subject = filtered_data.get("subject_code", None)
natural_filter_season_codes = filtered_data.get("season_code", None)
natural_filter_areas = filtered_data.get("area", None)



if filter_season_codes:
aggregate_pipeline["$vectorSearch"]["filter"] = {
Expand Down Expand Up @@ -298,10 +296,10 @@ def chat():

json_response = {"response": response, "courses": recommended_courses}

print("")
print("Completion Request: Recommendation")
print(json_response)
print("")
# print("")
# print("Completion Request: Recommendation")
# print(json_response)
# print("")

return jsonify(json_response)

Expand Down

0 comments on commit 2c8a51b

Please sign in to comment.