I am creating a resume evaluator I want the ai to give suggestion how a resume can be enhanced. And then in the second prompt I want a mock image of resume based on that data
const pdfData = await pdfToText(pdfBuffer);
const resumeText = pdfData.text;
const chatCompletion = await openai.chat.completions.create({
messages: [
{
role: ‘system’,
content: ‘You are a resume evaluator. You are given a resume. You give response in json only. Do not write anything extra in begining or end’
},
{
role: ‘user’,
content: You are provided with a text extracted from a pdf resume. You have to return response with these keys. Name, email, contact, address(string), skills(array). Also you can give suggestion(array) to improve user resume. Here is the text ${resumeText}
}
],
model: ‘gpt-4o’,
response_format: { type: “json_object” },
});
const data = JSON.parse(chatCompletion.choices[0].message.content);
//Till above it works fine problem starts from the below api
const resumeAiImage = await openai.images.generate({
model: “dall-e-3”,
prompt: Generate a mock image of a resume based on this mock data ${data}
,
n: 1,
size: “1024x1024”,
});
return res.status(200).json({data, resumeAiImage});
I get error => “code”: “content_policy_violation”,
“message”: “Your request was rejected as a result of our safety system. Your prompt may contain text that is not allowed by our safety system.”,
The data that is returned by first api call is like this
{
“data”: {
“Name”: “Zainul Khan”,
“email”: “kzainul22@gmail.com”,
“contact”: null,
“address”: “Bhopal, Madhya Pradesh, India”,
“skills”: [
“React.js”,
“Node.js”,
“MongoDB”
],
“suggestion”: [
“Add a contact number to your resume.”,
“Provide specific details about your roles and responsibilities for each job experience.”,
“Include any certifications, awards, or notable achievements to make your resume stand out.”,
“Consider formatting your resume more clearly, breaking sections with appropriate headings.”,
“Include a section for your personal projects or contributions to open-source projects if applicable.”
]
}
}