code-philia / microbat

A feedback-based debugger for interactively recommending suspicious step in buggy program execution.
3 stars 2 forks source link

Prompt Engineering: fix invalid JSON format problem #10

Closed HongshuW closed 1 month ago

HongshuW commented 4 months ago

Sometimes the JSON object from LLM response doesn't have a value

HongshuW commented 4 months ago

01943e8d2cac4be930f693078605fb87125268de Retry when an exception is thrown.

HongshuW commented 3 months ago

Cli 18: step 360 CommandLine cl response parsing json\n{"cl:org.apache.commons.cli.CommandLine":{"args:java.util.LinkedList":{"first:class java.util.LinkedList$Node":"null","modCount:int":"0","size:int":"0","last:class java.util.LinkedList$Node":"null"},"options:java.util.HashMap":{"TREEIFY_THRESHOLD:int":"8","entrySet:java.util.HashMap$EntrySet":{"this$0:java.util.HashMap":{"TREEIFY_THRESHOLD:int":"8","entrySet:java.util.HashMap$EntrySet":"[]","UNTREEIFY_THRESHOLD:int":"6","MIN_TREEIFY_CAPACITY:int":"64","table:java.util.HashMap$Node[]":["null"],"size:int":"0"}},"values:interface java.util.Collection":"null","UNTREEIFY_THRESHOLD:int":"6","MIN_TREEIFY_CAPACITY:int":"64","modCount:int":"1","keySet:interface java.util.Set":"","table:java.util.HashMap$Node[]":["null"],"size:int":"0"},"hashcodeMap:java.util.HashMap":{"TREEIFY_THRESHOLD:int":"8","entrySet:java.util.HashMap$EntrySet":{"this$0:java.util.HashMap":{"TREEIFY_THRESHOLD:int":"8","entrySet:java.util.HashMap$EntrySet":"","UNTREEIFY_THRESHOLD:int": "6", "MIN_TREEIFY_CAPACITY": "64", "table": "array of nulls", "size": 0}},"values": "interface java.utils.Collection:null", "UNTREEIFY_THRESHOLD": 6, "MIN_TREEIFY_CAPACITY": 64, "modCount": 1, "keySet": "", table:"array of nulls", size:"int=0"}}}\n

Cli 20: step 412 LinkedList response parsing json\n{"org.apache.commons.cli.CommandLine#getArgList()Ljava/util/List;":{"modCount:int":"0","size:int":"7","first:java.util.LinkedList$Node":{"item:java.lang.String":"--zop","next:class java.util.LinkedList$Node":{"item:java.lang.String"=>"=1","next:class java.util.LinkedList$Node":{"item:java.lang.String":"-a","next:class java.util.LinkedList$Node":{"item:java.lang.String":"-b","next:class java.util.LinkedList$Node":{"item:java.lang.String":"toast","next:class java.util.LinkedList$Node":{"item:java.lang.String}=="--b","next:null,"prev:null},"prev:null},"prev:null},"prev:null},"prev:null},"last:java.util.LinkedList$Node":{"item.java.lang.String}=="--b","next:null,"prev:last}}}\n

Expected a ':' after a key at 233 [character 234 line 1]