quick-musician-29561
04/19/2024, 4:10 AMjs
const main = async () => {
try {
const response = await axios.post(
'https://api.llama-api.com/chat/completions',
{
messages: [
{
role: 'system',
content: "Assistant is a large language model trained by META."
},
{
role: 'user',
content: workflow.question
}
],
model: 'llama-3-8b',
max_tokens: 800,
stream: false
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${env.LlamaAPI}`
}
}
);
workflow.llamaAnswer = response.data.choices[0].message.content;
} catch (error) {
console.error('Error fetching completion:', error);
}
};
await main();
https://cdn.discordapp.com/attachments/1230732214891712674/1230732215067869246/Screenshot_from_2024-04-19_07-04-35.png?ex=663463b1&is=6621eeb1&hm=14fcc04bb4a1fe6a5819a139998194227085288f51ab269c6502923be0379909&quick-musician-29561
04/19/2024, 4:11 AMquick-musician-29561
04/19/2024, 4:14 AMjolly-policeman-82775
04/19/2024, 4:17 AMjolly-policeman-82775
04/19/2024, 4:17 AMfresh-fireman-491
04/19/2024, 4:28 AMfresh-fireman-491
04/19/2024, 4:29 AMquick-musician-29561
04/19/2024, 4:31 AMfresh-fireman-491
04/19/2024, 4:34 AMfresh-fireman-491
04/19/2024, 4:34 AMquick-musician-29561
04/19/2024, 4:38 AMquick-musician-29561
04/19/2024, 4:40 AMquick-musician-29561
04/19/2024, 5:09 AMjs
workflow.llamaAnswer = response.data.choices[0].message.content;
console.log("TEST:" + JSON.stringify(response.data.choices[0].message))
quick-musician-29561
04/19/2024, 5:12 AMfresh-fireman-491
04/19/2024, 5:13 AMfresh-fireman-491
04/19/2024, 5:13 AMquick-musician-29561
04/19/2024, 5:14 AMfresh-fireman-491
04/19/2024, 5:17 AMfresh-fireman-491
04/19/2024, 5:18 AMquick-musician-29561
04/19/2024, 5:20 AMfresh-fireman-491
04/19/2024, 5:21 AMfresh-fireman-491
04/19/2024, 5:22 AMfresh-fireman-491
04/19/2024, 5:23 AMfresh-fireman-491
04/19/2024, 5:25 AMfresh-fireman-491
04/19/2024, 5:26 AMquick-musician-29561
04/19/2024, 5:55 AMquick-musician-29561
04/19/2024, 7:10 AMjs
const main = async () => {
try {
const response = await axios.post(
'https://api.llama-api.com/chat/completions',
{
messages: [
{
role: 'system',
content: 'Assistant is a large language model trained by META.'
},
{
role: 'user',
content: workflow.question
}
],
model: 'llama-3-8b',
max_tokens: 800,
stream: false
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${env.LlamaAPI}`
}
}
)
let formattedResponse = response.data.choices[0].message.content
.replace(/\n/g, ' ')
.replace(/\[",\"function_call\":null}/g, '')
.replace(/[<>\[\]\/]/g, '')
console.log('TEST:' + JSON.stringify(response.data.choices[0].message))
workflow.llamaAnswer = formattedResponse
} catch (error) {
console.error('Error fetching completion:', error)
}
}
await main()
https://cdn.discordapp.com/attachments/1230732214891712674/1230777626638155786/Screenshot_from_2024-04-19_10-05-29.png?ex=66348dfc&is=662218fc&hm=559749b934a5a4e93a3398c750dd4896e9a4b74a6d779c3be04695d69e45c800&
https://cdn.discordapp.com/attachments/1230732214891712674/1230777626965049364/Screenshot_from_2024-04-19_10-05-15.png?ex=66236a7d&is=662218fd&hm=91023c8c17eff5c56b5f1a4ad1355194f8d565ae2707b937c059581e702fbba2&quick-musician-29561
04/19/2024, 7:19 AMquick-musician-29561
04/19/2024, 7:23 AMquick-musician-29561
04/19/2024, 3:43 PMquick-musician-29561
04/19/2024, 3:53 PMquick-musician-29561
04/19/2024, 5:09 PMquick-musician-29561
04/19/2024, 5:09 PMquick-musician-29561
04/19/2024, 5:10 PMquick-musician-29561
04/19/2024, 5:31 PMhundreds-battery-97158
04/19/2024, 6:02 PMhundreds-battery-97158
04/19/2024, 6:03 PMhundreds-battery-97158
04/19/2024, 6:04 PMquick-musician-29561
04/19/2024, 6:04 PMquick-musician-29561
04/19/2024, 6:10 PMhundreds-battery-97158
04/19/2024, 6:15 PMquick-musician-29561
04/19/2024, 6:27 PMjs
const GROQ_API_KEY = env.GROQ_API_KEY;
const data = {
messages: [
{
role: 'system',
content: `Assistant is a large language model trained by META.`
},
{
role: 'user',
content: workflow.question
}
],
model: 'llama3-8b-8192'
};
const main = async () => {
try {
const response = await axios.post('https://api.groq.com/openai/v1/chat/completions', data, {
headers: {
Authorization: `Bearer ${GROQ_API_KEY}`,
'Content-Type': 'application/json'
}
});
workflow.llamaAnswer = response.data.choices[0].message.content;
//console.log(response.data.choices[0].message.content);
return workflow.llamaAnswer;
} catch (error) {
console.error(error);
throw error;
}
};
await main()
.then(message => console.log('Groq message:', message))
.catch(error => console.error('Error:', error));
quick-musician-29561
04/19/2024, 6:30 PMquick-musician-29561
04/19/2024, 6:45 PMhundreds-battery-97158
04/19/2024, 7:13 PMhundreds-battery-97158
04/19/2024, 7:19 PMquick-musician-29561
04/19/2024, 7:24 PMquick-musician-29561
04/19/2024, 7:25 PMquick-musician-29561
04/19/2024, 7:27 PMquick-musician-29561
04/19/2024, 7:32 PMquick-musician-29561
04/19/2024, 8:48 PMagreeable-accountant-7248
04/20/2024, 7:28 AMquick-musician-29561
04/20/2024, 7:31 AMquick-musician-29561
04/20/2024, 7:32 AMquick-musician-29561
04/20/2024, 7:44 AMquick-musician-29561
04/20/2024, 8:03 AMagreeable-accountant-7248
04/20/2024, 8:05 AMagreeable-accountant-7248
04/20/2024, 8:11 AMagreeable-accountant-7248
04/20/2024, 8:31 AMfresh-fireman-491
04/20/2024, 8:40 AMfresh-fireman-491
04/20/2024, 8:40 AMfresh-fireman-491
04/20/2024, 8:41 AMquick-musician-29561
04/20/2024, 8:41 AMquick-musician-29561
04/20/2024, 8:59 AMagreeable-accountant-7248
04/20/2024, 9:32 AMjolly-policeman-82775
04/21/2024, 4:40 AMquick-musician-29561
04/21/2024, 5:04 AMjolly-policeman-82775
04/21/2024, 5:05 AMquick-musician-29561
04/21/2024, 5:08 AMjolly-policeman-82775
04/21/2024, 5:09 AMjolly-policeman-82775
04/21/2024, 5:09 AMquick-musician-29561
04/21/2024, 5:09 AMjolly-policeman-82775
04/21/2024, 5:10 AMquick-musician-29561
04/21/2024, 5:10 AMjolly-policeman-82775
04/21/2024, 5:10 AMjolly-policeman-82775
04/21/2024, 5:10 AMjolly-policeman-82775
04/21/2024, 5:10 AMquick-musician-29561
04/21/2024, 5:14 AMquick-musician-29561
04/21/2024, 5:17 AMfresh-fireman-491
04/21/2024, 6:17 AMquick-musician-29561
04/21/2024, 6:25 AMquick-musician-29561
04/21/2024, 7:31 AMcold-jewelry-54343
04/21/2024, 9:53 AMcold-jewelry-54343
04/21/2024, 9:58 AMcold-jewelry-54343
04/21/2024, 10:35 AMjolly-policeman-82775
04/21/2024, 10:37 AMjolly-policeman-82775
04/21/2024, 10:37 AMagreeable-accountant-7248
04/21/2024, 10:48 AMagreeable-accountant-7248
04/21/2024, 10:49 AMagreeable-accountant-7248
04/21/2024, 10:55 AMquick-musician-29561
04/21/2024, 10:58 AMquick-musician-29561
04/21/2024, 11:03 AMjs
malaga ice cream shops site:malaga-tourist-info.com
agreeable-accountant-7248
04/21/2024, 11:04 AMquick-musician-29561
04/21/2024, 11:05 AMjs
malaga ice cream shops site:malaga-tourist-info.com OR site:icecream-malaga.com
quick-musician-29561
04/21/2024, 11:06 AMquick-musician-29561
04/21/2024, 11:07 AMagreeable-accountant-7248
04/21/2024, 11:08 AMquick-musician-29561
04/21/2024, 11:09 AMagreeable-accountant-7248
04/21/2024, 11:13 AMquick-musician-29561
04/21/2024, 11:14 AMcold-jewelry-54343
04/21/2024, 11:15 AMcold-jewelry-54343
04/21/2024, 11:18 AMquick-musician-29561
04/21/2024, 11:22 AMquick-musician-29561
04/21/2024, 11:25 AMcold-jewelry-54343
04/21/2024, 11:25 AMcold-jewelry-54343
04/21/2024, 11:30 AMquick-musician-29561
04/21/2024, 11:30 AMquick-musician-29561
04/21/2024, 11:43 AMquick-musician-29561
04/21/2024, 11:48 AMfresh-fireman-491
04/21/2024, 11:49 AMcold-jewelry-54343
04/21/2024, 11:50 AMquick-musician-29561
04/21/2024, 11:53 AMquick-musician-29561
04/21/2024, 12:00 PMjolly-policeman-82775
04/21/2024, 12:06 PMquick-musician-29561
04/21/2024, 12:08 PMquick-musician-29561
04/21/2024, 12:09 PMquick-musician-29561
04/21/2024, 12:11 PMjolly-policeman-82775
04/21/2024, 12:12 PMquick-musician-29561
04/21/2024, 12:15 PMjolly-policeman-82775
04/21/2024, 12:17 PMjolly-policeman-82775
04/21/2024, 12:18 PMjolly-policeman-82775
04/21/2024, 12:18 PMjolly-policeman-82775
04/21/2024, 12:19 PMjolly-policeman-82775
04/21/2024, 12:19 PMagreeable-accountant-7248
04/21/2024, 12:23 PMquick-musician-29561
04/21/2024, 1:50 PMcold-jewelry-54343
04/21/2024, 1:56 PMagreeable-accountant-7248
04/21/2024, 2:07 PMquick-musician-29561
04/21/2024, 2:08 PMquick-musician-29561
04/21/2024, 2:18 PMquick-musician-29561
04/21/2024, 2:19 PMagreeable-accountant-7248
04/21/2024, 2:21 PMquick-musician-29561
04/21/2024, 2:29 PMquick-musician-29561
04/21/2024, 3:14 PMjolly-policeman-82775
04/21/2024, 3:18 PMquick-musician-29561
04/21/2024, 3:20 PMagreeable-accountant-7248
04/21/2024, 3:23 PMquick-musician-29561
04/21/2024, 3:24 PMquick-musician-29561
04/21/2024, 3:37 PMjs
await Data1Table.createRecord()
await DataTable1.findRecords()
If for some reason it doesn't work, Botpress now also has a KB Tables API.
https://botpress.com/docs/api-documentation/#tablesquick-musician-29561
04/21/2024, 3:37 PMhundreds-battery-97158
04/21/2024, 3:40 PMhundreds-battery-97158
04/21/2024, 3:41 PMfresh-fireman-491
04/21/2024, 3:48 PMfresh-fireman-491
04/21/2024, 3:49 PMfresh-fireman-491
04/21/2024, 3:51 PMquick-musician-29561
04/21/2024, 3:52 PMfresh-fireman-491
04/21/2024, 3:52 PMfresh-fireman-491
04/21/2024, 3:52 PMquick-musician-29561
04/21/2024, 3:54 PMfresh-fireman-491
04/21/2024, 3:55 PMfresh-fireman-491
04/21/2024, 3:55 PMquick-musician-29561
04/21/2024, 3:56 PMfresh-fireman-491
04/21/2024, 3:57 PMfresh-fireman-491
04/21/2024, 3:58 PMfresh-fireman-491
04/21/2024, 4:00 PMfresh-fireman-491
04/21/2024, 4:00 PMfresh-fireman-491
04/21/2024, 4:00 PMagreeable-accountant-7248
04/21/2024, 4:00 PMquick-musician-29561
04/21/2024, 4:01 PMagreeable-accountant-7248
04/21/2024, 4:02 PMfresh-fireman-491
04/21/2024, 4:02 PMagreeable-accountant-7248
04/21/2024, 4:03 PMagreeable-accountant-7248
04/21/2024, 4:04 PMfresh-fireman-491
04/21/2024, 4:07 PMagreeable-accountant-7248
04/21/2024, 4:14 PMfresh-fireman-491
04/21/2024, 4:19 PMagreeable-accountant-7248
04/21/2024, 4:38 PMcold-jewelry-54343
04/21/2024, 8:03 PMcold-jewelry-54343
04/21/2024, 8:05 PMagreeable-accountant-7248
04/22/2024, 8:03 AMcold-jewelry-54343
04/22/2024, 8:50 AMjolly-policeman-82775
04/22/2024, 9:12 AMjolly-policeman-82775
04/22/2024, 9:12 AMfresh-fireman-491
04/22/2024, 10:45 AMagreeable-accountant-7248
04/22/2024, 11:10 AMquick-musician-29561
04/22/2024, 11:32 AMjolly-policeman-82775
04/22/2024, 11:32 AMquick-musician-29561
04/22/2024, 11:46 AMlemon-football-92902
04/22/2024, 1:44 PMagreeable-accountant-7248
04/22/2024, 3:01 PMlemon-football-92902
04/22/2024, 3:16 PMquick-musician-29561
04/23/2024, 5:37 AMagreeable-accountant-7248
04/23/2024, 1:26 PMagreeable-accountant-7248
04/23/2024, 1:29 PMBearer ${GROQ_API_KEY}
,
> 'Content-Type': 'application/json'
> }
> });
>
> workflow.respuestaIA2 = response.data.choices[0].message.content
> return workflow.respuestaIA2;
> } catch (error) {
> console.error(error);
> throw error;
> }
> };
>
>
> }
>
> }
I'm sure that it's not best code ever but I make so many test that I need to go fast :-p
Feel free to ask me anything!agreeable-accountant-7248
04/23/2024, 1:30 PMlemon-football-92902
04/23/2024, 3:36 PMquick-musician-29561
04/23/2024, 4:50 PMquick-musician-29561
04/23/2024, 4:50 PMquick-musician-29561
05/02/2024, 5:12 PMfresh-fireman-491
05/03/2024, 10:02 AMquick-musician-29561
05/03/2024, 12:18 PMquick-musician-29561
05/03/2024, 12:20 PMquick-musician-29561
05/03/2024, 12:22 PMfresh-fireman-491
05/03/2024, 5:37 PMquick-musician-29561
07/24/2024, 3:00 AMfresh-fireman-491
07/24/2024, 8:46 AM