import got from 'got'; | |
async function NvidiaTogether(message, { system_prompt = "" } = {}) { | |
const response = await got.post('https://api.together.xyz/v1/chat/completions', { | |
headers: { | |
'Authorization': 'Bearer ' + process.env['TOGETHER_API_KEY'], | |
'Content-Type': 'application/json' | |
}, | |
json: { | |
'model': 'nvidia/Llama-3.1-Nemotron-70B-Instruct-HF', | |
'messages': [ | |
{"role": "system", "content": `${system_prompt}`}, | |
{'role': 'user', 'content': `${message}`} | |
], | |
'max_tokens': null, | |
'temperature': 0.7, | |
'top_p': 0.7, | |
'top_k': 50, | |
'repetition_penalty': 1, | |
'stream': false | |
} | |
}).json(); | |
return response.choices[0].message.content; | |
} | |
export { NvidiaTogether }; |