Skip to content

Commit

Permalink
Add an option to warn for unknown strings when calling `parse_predict…
Browse files Browse the repository at this point in the history
…ed_output_string`
  • Loading branch information
xhluca committed Sep 25, 2024
1 parent b27473f commit 971a99d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions weblinx/processing/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def find_intent_and_raw_args(raw_output_string: str) -> dict:



def parse_predicted_output_string(raw_output_string: str) -> dict:
def parse_predicted_output_string(raw_output_string: str, warn_for_unknown=True) -> dict:
"""
Given an output string, try to find a substring of format <intent>(<key1>=<value1>, <key2>=<value2>, ...) and return a dictionary of format:
{
Expand Down Expand Up @@ -184,7 +184,7 @@ def parse_predicted_output_string(raw_output_string: str) -> dict:
else:
intent = Intent.UNKNOWN

if intent == Intent.UNKNOWN:
if warn_for_unknown and intent == Intent.UNKNOWN:
preview = raw_output_string[:100].replace("\n", "\\n")
logger.warning(f"Unknown intent '{raw_intent}': {preview}")

Expand Down

0 comments on commit 971a99d

Please sign in to comment.