gpt-prompt-engineer icon indicating copy to clipboard operation
gpt-prompt-engineer copied to clipboard

JSONDecodeError

Open Kaizoku99 opened this issue 1 year ago • 4 comments

when I try to run the notebook I keep getting this error:

"JSONDecodeError Traceback (most recent call last) Cell In[10], line 1 ----> 1 generate_optimal_prompt(description, input_variables, NUMBER_OF_TEST_CASES, NUMBER_OF_PROMPTS, use_wandb)

Cell In[7], line 182 179 if wandb.run is None: 180 start_wandb_run() --> 182 test_cases = generate_test_cases(description, input_variables, num_test_cases) 183 prompts = generate_candidate_prompts(description, input_variables, test_cases, number_of_prompts) 184 print('Here are the possible prompts:', prompts)

Cell In[7], line 231 227 message = response.json() 229 response_text = message['content'][0]['text'] --> 231 test_cases = json.loads(response_text) 233 print('Here are the test cases:', test_cases) 235 return test_cases

File c:\Users\ABDUL RAHMAN\AppData\Local\Programs\Python\Python311\Lib\json_init_.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 341 s = s.decode(detect_encoding(s), 'surrogatepass') 343 if (cls is None and object_hook is None and 344 parse_int is None and parse_float is None and 345 parse_constant is None and object_pairs_hook is None and not kw): --> 346 return _default_decoder.decode(s) ... --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: 355 raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Unterminated string starting at: line 165 column 29 (char 5609)"

when the only thing I changed is the description and adding my API key thats it

Kaizoku99 avatar Mar 20 '24 22:03 Kaizoku99

I'm also getting the JSONDecodeError multiple times when I try to run this. Would love some insight into this issue.

beastmodeplatinum avatar Mar 21 '24 10:03 beastmodeplatinum

Seems to happen when you change the names of the variables. I'm getting the same error as well. When I use the default config, it ran fine.

mgunnin avatar Mar 21 '24 16:03 mgunnin

I've encountered the same error. Tried increasing GENERATION_MODEL_MAX_TOKENS and decreasing NUMBER_OF_TEST_CASES to no avail.

lightshifted avatar Mar 22 '24 00:03 lightshifted

Darn, I wish the above worked with keeping the variable names the same but I'm still getting an error if I just change any part of the text. I'm wondering what about the query causes it to fail, maybe if the description doesn't match the variable name?

beastmodeplatinum avatar Mar 22 '24 05:03 beastmodeplatinum