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
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/llama-v3-70b-instruct";
const data = {
"messages": [
{
"role": "user",
"content" : "tell me a joke on cats"
},
{
"role": "assistant",
"content" : "here is a joke about cats..."
},
{
"role": "user",
"content" : "now a joke on dogs"
},
]
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();
An array of objects containing the role and content
Could be "user", "assistant" or "system".
A string containing the user's query or the assistant's response.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
The 70b parameter version of Meta Llama 3 is the bigger and more powerful sibling of the 8b version.
Here's what makes the 70b stand out:
More Complex Tasks: The larger size allows the 70b model to handle more complex tasks that require a deeper understanding of language and context. This could include tasks like writing different creative text formats, translating languages with higher accuracy, or even generating complex code.
Enhanced Reasoning: The 70b version boasts improved reasoning abilities. It can better analyze information, draw conclusions, and answer questions that require logical thinking.
Trade-offs
Computational Cost: The larger size comes with a higher computational cost. Running the 70b model requires more powerful hardware compared to the 8b version. This might limit accessibility for some users.
Slower Inference: While still faster than previous models, the 70b version might take slightly longer to process information and generate responses compared to the 8b version.
Choosing the Right Version
The choice between the 8b and 70b versions depends on your specific needs. Here's a quick guide:
Choose the 8b version if: You prioritize accessibility, have limited computational resources, or need the model for simpler tasks like text summarization or question answering.
Choose the 70b version if: You require the model for complex tasks, prioritize stronger reasoning capabilities, and have access to powerful hardware.