-
Notifications
You must be signed in to change notification settings - Fork 0
/
g.js
39 lines (35 loc) · 3 KB
/
g.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"use strict";
const Groq = require("groq-sdk");
const groq = new Groq({
apiKey: "##"
});
async function main() {
try {
const chatCompletion = await getGroqChatCompletion();
// Print the completion returned by the LLM.
console.log(chatCompletion.choices[0]?.message?.content || "No content received");
} catch (error) {
console.error("Error fetching chat completion:", error);
}
}
async function getGroqChatCompletion() {
return groq.chat.completions.create({
messages: [
{
role: "user",
content: `Analyze the provided text in detail to determine the likelihood of it being generated by an artificial intelligence (AI) system or written by a human.
also tell the percentage of AI-Generated content and Human-Written content.:
text:Ripple counters, up counters, and down counters are all types of digital counters used for counting events or pulses, but they have different functionalities and applications: Ripple Counters: As mentioned earlier, ripple counters are digital counters where the output of each stage serves as the clock input for the next stage. The counting process ripples through the stages, with each stage triggering the next one. Ripple counters can be either asynchronous or synchronous. Up Counters: Up counters are digital counters that count upward, incrementing by one with each clock pulse. They are also known as binary counters. Up counters are used when you need to count events or pulses in an ascending order, such as measuring the number of times a process occurs or tracking the number of occurrences of an event. Down Counters: Down counters are digital counters that count downward, decrementing by one with each clock pulse. They start from a preset value and count down to zero. Down counters are used when you need to count events or pulses in a descending order, such as in timing applications or controlling the duration of an operation. The main difference between ripple counters and up/down counters lies in their counting direction and behavior: Ripple counters focus on the mechanism of how the counting process propagates through the stages, regardless of whether it's counting up or down. Up and down counters, on the other hand, describe the specific counting direction: up for incrementing counts and down for decrementing counts. While ripple counters can be designed to count either up or down, they are often associated with asynchronous counting, whereas up and down counters are designed specifically for their respective counting directions. Additionally, up/down counters often feature additional control inputs to switch between up and down counting modes, offering more flexibility in applications where both counting directions are required.`
}
],
model: "llama3-70b-8192"
});
}
module.exports = {
main,
getGroqChatCompletion
};
// Run the main function if this file is executed directly.
if (require.main === module) {
main();
}