mshumer / gpt-prompt-engineer

MIT License
9.39k stars 642 forks source link

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

Open younggggger opened 8 months ago

younggggger commented 8 months ago

Generating the prompts / responses...


KeyError Traceback (most recent call last)

in () ----> 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'
nilukush commented 8 months ago

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'