Skip to content

Commit 971a99d

Browse files
committed
Add an option to warn for unknown strings when calling parse_predicted_output_string
1 parent b27473f commit 971a99d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

weblinx/processing/outputs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def find_intent_and_raw_args(raw_output_string: str) -> dict:
149149

150150

151151

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

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

0 commit comments

Comments
 (0)