Skip to content

Commit

Permalink
Merge pull request #24 from stanford-oval/wip/swap-opening-hours
Browse files Browse the repository at this point in the history
Wip/swap opening hours
  • Loading branch information
george1459 authored May 8, 2024
2 parents 45a652a + f83900b commit 66ea8d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Package metadata
name = "suql"
version = "1.1.7a3"
version = "1.1.7a4"
description = "Structured and Unstructured Query Language (SUQL) Python API"
author = "Shicheng Liu"
author_email = "shicheng@cs.stanford.edu"
Expand Down
2 changes: 1 addition & 1 deletion src/suql/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def convert_opening_hours_query(opening_hours_query):
)
return response

pattern = r"'([^']*)'\s*=\s*ANY\(CAST opening_hours AS ARRAY\)"
pattern = r"'([^']*)'\s*=\s*opening_hours"

def replacer(match):
opening_hours_query = match.group(0).split(" = ")[0]
Expand Down
5 changes: 3 additions & 2 deletions src/suql/prompts/parser_suql.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ CREATE TABLE restaurants (

Do not generate fields beyond the given fields. The `answer` function can be used on FREE_TEXT fields.
Use `location = 'some place'` to search restaurants that are geographically close, don't use other operations on the location field.
Use `'some string' = opening_hours` to search restaurants open at certain time, don't use other operations on the opening_hours field.

{# Basic example #}
User: Where is Burguer King?
Expand Down Expand Up @@ -67,11 +68,11 @@ Target: SELECT *, answer(popular_dishes, 'does this restaurant serve salmon?'),
--
{# How to search by opening hours #}
User: What restaurants are open after 2pm on Monday?
Target: SELECT * FROM restaurants WHERE 'after 2pm on Monday' = ANY(CAST opening_hours AS ARRAY);
Target: SELECT * FROM restaurants WHERE 'after 2pm on Monday' = opening_hours;
__
{# How to search by opening hours - segments #}
User: restaurants open after 3am and before 7am on Monday?
Target: SELECT * FROM restaurants WHERE 'after 3am and before 7am on Monday' = ANY(CAST opening_hours AS ARRAY);
Target: SELECT * FROM restaurants WHERE 'after 3am and before 7am on Monday' = opening_hours;
__

{% for dlg_turn in dlg[:-1] %}
Expand Down

0 comments on commit 66ea8d3

Please sign in to comment.