The ResponseCX Vision API is a powerful tool that allows you to generate text based on image input. It is powered by OpenAI’s GPT-4 model and is currently in preview.
const chatId = req.body.chat_id;
console.log(`Chat ID: ${chatId.id}`);
const context = await client.request(FETCH_CHAT_CONTEXT, { uuid: chatId.id });
let history = [{ role: 'system', content: 'Initiating ResponseCX.' }];
context.channel_thread[0].messages.forEach(message => {
let role = message.username !== 'ReSponseAI' ? 'user' : 'assistant';
let content = message.image_url === null ? message.body : [
{ "type": "text", "text": message.body },
{ "type": "image_url", "image_url": { "url": message.image_url } }
];
history.push({ role, content });
});
let options = {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': process.env.OPEN_AI },
body: JSON.stringify({
model: 'gpt-4-vision-preview',
temperature: 1.2,
max_tokens: 300,
messages: history
}),
redirect: 'follow'
};
The ResponseCX Vision API is a powerful tool that allows you to generate text based on image input. It is powered by OpenAI’s GPT-4 model and is currently in preview.