Skip to content

Commit

Permalink
bugfix on infer_gen_constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
parkervg committed Oct 22, 2024
1 parent b6cf509 commit ea09d82
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions blendsql/parse/_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ def create_regex(
start_node = child.parent
# Below handles when we're in a function
# Example: CAST({{LLMMap('jump distance', 'w::notes')}} AS FLOAT)
while isinstance(start_node, exp.Func) and start_node is not None:
start_node = start_node.parent
# while isinstance(start_node, exp.Func) and start_node is not None:
# start_node = start_node.parent
output_type: Literal["boolean", "integer", "float"] = None
predicate_literals: List[str] = []
modifier: Literal["*", "+", None] = None
Expand Down Expand Up @@ -479,8 +479,17 @@ def create_regex(
added_kwargs["example_outputs"] = predicate_literals
return added_kwargs
elif isinstance(
start_node.parent,
(exp.Order, exp.Ordered, exp.AggFunc, exp.GT, exp.GTE, exp.LT, exp.LTE),
start_node,
(
exp.Order,
exp.Ordered,
exp.AggFunc,
exp.GT,
exp.GTE,
exp.LT,
exp.LTE,
exp.Sum,
),
):
output_type = "float" # Use 'float' as default numeric regex, since it's more expressive than 'integer'
if output_type is not None:
Expand Down

0 comments on commit ea09d82

Please sign in to comment.