Spaces:
Sleeping
Sleeping
Update alz_companion/agent.py
Browse files- alz_companion/agent.py +6 -3
alz_companion/agent.py
CHANGED
|
@@ -102,7 +102,8 @@ def describe_image(image_path: str) -> str:
|
|
| 102 |
|
| 103 |
# In agent.py
|
| 104 |
|
| 105 |
-
def detect_tags_from_query(query: str, behavior_options: list, emotion_options: list, topic_options: list, context_options: list) -> Dict[str, Any]:
|
|
|
|
| 106 |
"""Uses a Chain-of-Thought prompt to classify the user's query."""
|
| 107 |
behavior_str = ", ".join(f'"{opt}"' for opt in behavior_options if opt != "None")
|
| 108 |
emotion_str = ", ".join(f'"{opt}"' for opt in emotion_options if opt != "None")
|
|
@@ -119,8 +120,10 @@ def detect_tags_from_query(query: str, behavior_options: list, emotion_options:
|
|
| 119 |
|
| 120 |
messages = [{"role": "system", "content": "You are a helpful NLU classification assistant. Follow the instructions precisely."}, {"role": "user", "content": prompt}]
|
| 121 |
response_str = call_llm(messages, temperature=0.1)
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
| 124 |
|
| 125 |
result_dict = {
|
| 126 |
"detected_behaviors": [], "detected_emotion": "None",
|
|
|
|
| 102 |
|
| 103 |
# In agent.py
|
| 104 |
|
| 105 |
+
# def detect_tags_from_query(query: str, behavior_options: list, emotion_options: list, topic_options: list, context_options: list) -> Dict[str, Any]:
|
| 106 |
+
def detect_tags_from_query(query: str, behavior_options: list, emotion_options: list, topic_options: list, context_options: list, settings: dict = None) -> Dict[str, Any]:
|
| 107 |
"""Uses a Chain-of-Thought prompt to classify the user's query."""
|
| 108 |
behavior_str = ", ".join(f'"{opt}"' for opt in behavior_options if opt != "None")
|
| 109 |
emotion_str = ", ".join(f'"{opt}"' for opt in emotion_options if opt != "None")
|
|
|
|
| 120 |
|
| 121 |
messages = [{"role": "system", "content": "You are a helpful NLU classification assistant. Follow the instructions precisely."}, {"role": "user", "content": prompt}]
|
| 122 |
response_str = call_llm(messages, temperature=0.1)
|
| 123 |
+
|
| 124 |
+
# logging based on debug mode
|
| 125 |
+
if settings and settings.get("debug_mode"):
|
| 126 |
+
print(f"\n--- NLU Full Response ---\n{response_str}\n-----------------------\n")
|
| 127 |
|
| 128 |
result_dict = {
|
| 129 |
"detected_behaviors": [], "detected_emotion": "None",
|