mshumer/gpt-prompt-engineer

是因为我的claude api key 没权限吗

younggggger opened this issue · 1 comments

Generating the prompts / responses...


KeyError Traceback (most recent call last)

in <cell line: 1>()
----> 1 result = run_haiku_conversion_process(task, prompt_example, response_example)

1 frames

in generate_candidate_prompts(task, prompt_example, response_example)
60 response = requests.post("https://api.anthropic.com/v1/messages", headers=headers, json=data)
61
---> 62 response_text = response.json()['content'][0]['text']
63
64 # Parse out the prompts and responses

KeyError: 'content'

I am getting the same error but I am getting this in generate_test_cases .

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[<ipython-input-18-9088abbc351a>](https://localhost:8080/#) in <cell line: 1>()
----> 1 generate_optimal_prompt(description, input_variables, NUMBER_OF_TEST_CASES, NUMBER_OF_PROMPTS, use_wandb)

1 frames
[<ipython-input-15-46e678895f92>](https://localhost:8080/#) in generate_test_cases(description, input_variables, num_test_cases)
    227     message = response.json()
    228 
--> 229     response_text = message['content'][0]['text']
    230 
    231     test_cases = json.loads(response_text)

KeyError: 'content'