Add conversational-property-finder under stripe-payment-agents#20
Add conversational-property-finder under stripe-payment-agents#20shahchayan9 wants to merge 1 commit intomainfrom
Conversation
| if m: | ||
| raw = m.group(1).replace(",", "").strip() | ||
| if "k" in lower[m.start() : m.end()] or re.search(r"\d+\s*k", lower): | ||
| try: | ||
| return int(float(raw) * 1000) | ||
| except ValueError: |
There was a problem hiding this comment.
Bug: The _parse_price function incorrectly multiplies prices by 1,000 if a 'k' suffix appears anywhere in the user's query, not just next to the price itself.
Severity: HIGH
Suggested Fix
Modify the logic in _parse_price to ensure the check for a 'k' suffix is scoped only to the substring that was matched as the price. Instead of re.search(r"\d+\s*k", lower), the check should be performed on m.group(0) or a similarly scoped part of the string to confirm the 'k' is associated with the extracted number.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location:
stripe-payment-agents/conversational-property-finder/asi1_agent/nl_parser.py#L63-L68
Potential issue: The `_parse_price` function incorrectly detects a 'k' suffix for
thousands. It searches the entire input string for a pattern like `200k` instead of only
checking the text immediately surrounding the matched price. For an input like "under
$600000 near 200k area", the function will match `$600000` but see `200k` elsewhere in
the string. It will then incorrectly multiply 600,000 by 1,000, resulting in a
`max_price` of 600,000,000. This leads to incorrect search results without raising an
error.
Did we get this right? 👍 / 👎 to inform future reviews.
| if is_refinement: | ||
| updates = {k: v for k, v in parsed.items() if v is not None and k != "page"} | ||
| if not updates: | ||
| return get_state(session_id) | ||
| # Any refinement should restart pagination from page 1 | ||
| updates["page"] = 1 | ||
| return update_state(session_id, **updates) |
There was a problem hiding this comment.
Bug: The merge_parsed_into_state function can crash with a TypeError if the LLM provides unexpected filter keys, as they are not validated before being unpacked into update_state.
Severity: MEDIUM
Suggested Fix
Before calling update_state, filter the updates dictionary to only include keys that correspond to the accepted parameters of the update_state function. This will discard any unexpected keys returned by the LLM and prevent the TypeError.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location:
stripe-payment-agents/conversational-property-finder/asi1_agent/state_manager.py#L101-L107
Potential issue: When handling a search refinement, the `merge_parsed_into_state`
function receives filters from an LLM. These filters are collected into a dictionary and
unpacked directly as keyword arguments into the `update_state` function. However, there
is no validation to ensure the LLM-provided filter keys are valid. If the LLM
hallucinates and returns an unexpected key (e.g., `"location_radius"`), the application
will raise a `TypeError` when calling `update_state`, causing the request handler to
crash and fail to respond to the user.
Did we get this right? 👍 / 👎 to inform future reviews.
Summary
This PR adds a Conversational Property Finder agent built on ASI:One.
The agent enables natural language property search over real MLS data (via Repliers), supports multi-turn refinements (price, bedrooms, type), pagination, detailed listing views, wishlist management, and optional actions like email export and Stripe-based gated access for premium details.
Type of Change
Checklist
README.mdfor changed example(s).Related Issue
N/A
Notes for Reviewers
This is an example-focused implementation showcasing agentic conversational workflows on top of real-world data sources.
Key areas to review:
Natural language parsing and intent handling
State management across turns (search → refine → details → wishlist)
Integration points with Repliers, Stripe, and email export