I apologize in advance and extend profuse thanks to anyone willing to read this! I am a very inexperienced user (clumsy academic) but very enthusiastically trying to design a very simple code to use ai to combine two graders’ comments on student work. I’m using ChatGPT 4o to help me code a python app using flask and my API key. We (ChatGPT and I) keep getting hung up on the function that calls AI - even though ChatGPT is actually writing the code, we’re going in circles with this syntax depreciation. I have not been able to get the helper that is supposed to update the code to work either. Here is the function - can anyone tell me how to write it correctly with the new syntax? This particular version returns: openai.NotFoundError: Error code: 404 - {‘error’: {‘message’: ‘This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?’, ‘type’: ‘invalid_request_error’, ‘param’: ‘model’, ‘code’: None}}
And here is the function:
def combine_comments_with_ai(info1, info2):
prompt = (
f"Please combine the following comments for the thesis titled ‘{info1[‘title’]}’ "
f"while removing any harsh or offensive language and making the feedback constructive:\n\n"
f"Marker 1 - Clarity and coherence: {info1[‘clarity’]}\n"
f"Marker 2 - Clarity and coherence: {info2[‘clarity’]}\n\n"
f"Marker 1 - Theoretical sophistication: {info1[‘theory’]}\n"
f"Marker 2 - Theoretical sophistication: {info2[‘theory’]}\n\n"
f"Marker 1 - Skilful use of empirical material: {info1[‘empirical’]}\n"
f"Marker 2 - Skilful use of empirical material: {info2[‘empirical’]}\n\n"
f"Marker 1 - Structure of chapters and sections: {info1[‘structure’]}\n"
f"Marker 2 - Structure of chapters and sections: {info2[‘structure’]}\n\n"
f"Marker 1 - Quality of documentation: {info1[‘documentation’]}\n"
f"Marker 2 - Quality of documentation: {info2[‘documentation’]}"
)
# Use the correct API call for chat completions
response = openai.completions.create(
model=“gpt-4o-mini”, # Replace with the correct model you’re using
prompt=prompt,
max_tokens=1000,
temperature=0.7
)
combined_comment = response[‘choices’][0][‘text’].strip()
return combined_comment
You might want to make note of the error you’re getting and you should also read the documentation, as that might help. https://platform.openai.com/docs/guides/chat-completions/getting-started
Since you are an academic and all, you might want to research the tools you’re using before you’re using them. And using a hallucinating tech to comment/grade students work is probably not the best idea.