zenaight commited on
Commit
11f5f36
·
1 Parent(s): 69d3b80

Enhance intent classification to include request_details

Browse files

- Updated the classification logic in `extract_and_update_intent` and `extract_and_search_properties` to recognize "request_details" as a valid classification, allowing the system to handle specific property inquiries more effectively.
- Expanded the documentation to clarify the intent classification options and provided examples for better user understanding.
- These changes aim to improve the AI chat's responsiveness to user requests for detailed property information, enhancing overall user experience.

Files changed (1) hide show
  1. ai_chat.py +13 -3
ai_chat.py CHANGED
@@ -289,7 +289,8 @@ async def extract_and_update_intent(state):
289
  skip_preferences = (
290
  classification == "search_listings" or
291
  classification.startswith("request_images") or
292
- classification == "request_address"
 
293
  )
294
 
295
  if skip_preferences:
@@ -328,12 +329,20 @@ Classify the user's message into exactly one of:
328
  - search_listings (user wants to see property listings)
329
  - request_images (user wants to see images/photos/pictures of a listing)
330
  - request_address (user wants the address/location of a listing)
331
- - request_details (user wants other info like features, floorplan, video)
332
  - other (anything else)
333
 
334
  If the user is asking for images and mentions a specific property (like "option 1", "the office", "warehouse", etc.),
335
  extract the property identifier and return: request_images:IDENTIFIER
336
 
 
 
 
 
 
 
 
 
337
  Return only the tag (and identifier if applicable).
338
  Message: {user_message}
339
  """
@@ -356,7 +365,8 @@ async def extract_and_search_properties(state):
356
  is_search_request = (
357
  classification == "search_listings" or
358
  classification.startswith("request_images") or
359
- classification == "request_address"
 
360
  )
361
 
362
  if not is_search_request:
 
289
  skip_preferences = (
290
  classification == "search_listings" or
291
  classification.startswith("request_images") or
292
+ classification == "request_address" or
293
+ classification == "request_details"
294
  )
295
 
296
  if skip_preferences:
 
329
  - search_listings (user wants to see property listings)
330
  - request_images (user wants to see images/photos/pictures of a listing)
331
  - request_address (user wants the address/location of a listing)
332
+ - request_details (user wants specific property info like price, features, floorplan, video, size, etc.)
333
  - other (anything else)
334
 
335
  If the user is asking for images and mentions a specific property (like "option 1", "the office", "warehouse", etc.),
336
  extract the property identifier and return: request_images:IDENTIFIER
337
 
338
+ Examples:
339
+ - "How much is this warehouse?" → request_details
340
+ - "What is the price?" → request_details
341
+ - "What are the features?" → request_details
342
+ - "How big is it?" → request_details
343
+ - "Show me images" → request_images
344
+ - "What do you have in JHB?" → search_listings
345
+
346
  Return only the tag (and identifier if applicable).
347
  Message: {user_message}
348
  """
 
365
  is_search_request = (
366
  classification == "search_listings" or
367
  classification.startswith("request_images") or
368
+ classification == "request_address" or
369
+ classification == "request_details"
370
  )
371
 
372
  if not is_search_request: