zenaight commited on
Commit ·
217b7cf
1
Parent(s): fcb25fc
Add debug logging in chat_with_session_memory for property details
Browse files- Introduced debug print statements in `chat_with_session_memory` to log the number of properties, the first property details, and the property URLs being processed.
- These enhancements aim to improve traceability and facilitate debugging during the property listing generation process, ensuring better insights into the state of the application.
- ai_chat.py +6 -0
ai_chat.py
CHANGED
|
@@ -67,7 +67,9 @@ def chat_with_session_memory(state):
|
|
| 67 |
)
|
| 68 |
|
| 69 |
props = state.get("properties", [])
|
|
|
|
| 70 |
if props:
|
|
|
|
| 71 |
system_message += "\nHere are some listings I found:\n"
|
| 72 |
for p in props[:5]:
|
| 73 |
title = p.get("title", "[no title]")
|
|
@@ -82,8 +84,12 @@ def chat_with_session_memory(state):
|
|
| 82 |
f"{price} ({ptype}); features: {features}\n"
|
| 83 |
)
|
| 84 |
url = p.get("listing_url")
|
|
|
|
| 85 |
if url:
|
| 86 |
system_message += f" Link: {url}\n"
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
# After the listings loop, before building messages[]
|
| 89 |
extras = set()
|
|
|
|
| 67 |
)
|
| 68 |
|
| 69 |
props = state.get("properties", [])
|
| 70 |
+
print(f"DEBUG: Properties in state: {len(props)} properties")
|
| 71 |
if props:
|
| 72 |
+
print(f"DEBUG: First property: {props[0]}")
|
| 73 |
system_message += "\nHere are some listings I found:\n"
|
| 74 |
for p in props[:5]:
|
| 75 |
title = p.get("title", "[no title]")
|
|
|
|
| 84 |
f"{price} ({ptype}); features: {features}\n"
|
| 85 |
)
|
| 86 |
url = p.get("listing_url")
|
| 87 |
+
print(f"DEBUG: Property URL: {url}")
|
| 88 |
if url:
|
| 89 |
system_message += f" Link: {url}\n"
|
| 90 |
+
print(f"DEBUG: Added URL to system message")
|
| 91 |
+
else:
|
| 92 |
+
print(f"DEBUG: No URL found for property")
|
| 93 |
|
| 94 |
# After the listings loop, before building messages[]
|
| 95 |
extras = set()
|