randydev's picture
Create cohere.js
772a227 verified
raw
history blame
576 Bytes
import got from 'got';
async function CohereAI(message) {
const response = await got.post('https://api.cohere.com/v1/chat', {
headers: {
'Authorization': 'Bearer ' + process.env['COHERE_API_KEY'],
'Content-Type': 'application/json'
},
json: {
"model": "command-r-08-2024",
'message': `${message}`,
"temperature": 0.3,
"chat_history": [],
"prompt_truncation": "AUTO",
"stream": false
}
}).json();
return response;
}
export { CohereAI };