Open jamerri opened 3 weeks ago
can you change the line to:
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload).json()
and let me know the output?
On Tue, Oct 29, 2024 at 11:26 AM jamerri @.***> wrote:
I tried to run the code you provided, but the following error occurred. I tried for a long time but still couldn't solve the problem.The error message is as follows: “Traceback (most recent call last): File "C:\Project_code\PycharmProjects\24_LLM-OSL-main\LLM_demo.py", line 41, in response = payload(api_key, prompt, image_base64, gpt_model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Project_code\PycharmProjects\24_LLM-OSL-main\gptPayload.py", line 31, in payload response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload).json()['choices'][0]['message']['content']
KeyError: 'choices'” — Reply to this email directly, view it on GitHub <https://github.com/SunzidHassan/24_LLM-OSL/issues/2>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ATS23CLI7XRRMUKDTDW5MNLZ56ZKDAVCNFSM6AAAAABQ2IDPP2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGYZDCNZWGY2DCNY> . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
The output is as follows:
"Please enter a timestamp (1-12): 2
Chemical concentration: 482
{'error': {'message': 'The model gpt-4o
does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}
"
Have you configured the openai api?
Yes, I have configured the API, but I am not sure which model my API uses. Do you have any good suggestions?
You can try running 'gpt-4o-mini'. You need to select a model that supports image input ('gpt-3.5-turbo' doesn't support image input). You can find more models in this link: https://platform.openai.com/docs/models
Thanks for your reply, I'll try again.
I tried to run the code you provided, but the following error occurred. I tried for a long time but still couldn't solve the problem.The error message is as follows: “Traceback (most recent call last): File "C:\Project_code\PycharmProjects\24_LLM-OSL-main\LLM_demo.py", line 41, in
response = payload(api_key, prompt, image_base64, gpt_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Project_code\PycharmProjects\24_LLM-OSL-main\gptPayload.py", line 31, in payload
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload).json()['choices'][0]['message']['content']