typetext
{
"debug": false,
"max_new_tokens": 500,
"min_new_tokens": -1,
"prompt": "Can you write a poem about open source machine learning? Let's make it in the style of Martin Luther King.",
"repetition_penalty": 1,
"repetition_penalty_sustain": 256,
"system_prompt": "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.",
"temperature": 0.5,
"token_repetition_penalty_decay": 128,
"top_k": 250,
"top_p": 1
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Lys**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run meta/llama-2-70b-chat using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"meta/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1",
{
input: {
debug: false,
max_new_tokens: 500,
min_new_tokens: -1,
prompt: "Can you write a poem about open source machine learning? Let's make it in the style of Martin Luther King.",
repetition_penalty: 1,
repetition_penalty_sustain: 256,
system_prompt: "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.",
temperature: 0.5,
token_repetition_penalty_decay: 128,
top_k: 250,
top_p: 1
}
}
);
console.log(output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Lys**********************************
This is your API token. Keep it to yourself.
import replicate
Run meta/llama-2-70b-chat using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"meta/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1",
input={
"debug": False,
"max_new_tokens": 500,
"min_new_tokens": -1,
"prompt": "Can you write a poem about open source machine learning? Let's make it in the style of Martin Luther King.",
"repetition_penalty": 1,
"repetition_penalty_sustain": 256,
"system_prompt": "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.",
"temperature": 0.5,
"token_repetition_penalty_decay": 128,
"top_k": 250,
"top_p": 1
}
)
# The meta/llama-2-70b-chat model can stream output as it's running.
# The predict method returns an iterator, and you can iterate over that output.
for item in output:
# https://replicate.com/meta/llama-2-70b-chat/api#output-schema
print(item, end="")
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Lys**********************************
This is your API token. Keep it to yourself.
Run meta/llama-2-70b-chat using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "meta/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1",
"input": {
"debug": false,
"max_new_tokens": 500,
"min_new_tokens": -1,
"prompt": "Can you write a poem about open source machine learning? Let\'s make it in the style of Martin Luther King.",
"repetition_penalty": 1,
"repetition_penalty_sustain": 256,
"system_prompt": "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\\n\\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don\'t know the answer to a question, please don\'t share false information.",
"temperature": 0.5,
"token_repetition_penalty_decay": 128,
"top_k": 250,
"top_p": 1
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Sure, here's a poem about open source machine learning in the style of Martin Luther King: In the land of technology, a movement brews, A call to open source, for all to use, Machine learning, once a closed-off art, Now free for all, a new depart. The code, once locked away, now free, A gift to all, for all to see, The power of AI, for everyone, To learn, to grow, to be the sun. The community, diverse and strong, Works together, right where they belong, Sharing knowledge, skills and time, A bond that's strong, a bond that's fine. Together they strive, for a world that's fair, Where AI is used, to show they care, For justice, equality and rights, A future bright, with open sight. The open source way, a path they choose, To make a difference, they don't refuse, For the greater good, they toil and strive, A movement strong, they will survive. With each line of code, a door is opened, A chance for all, to be empowered, To learn, to grow, to be the change, A world where AI, is a human range. So let us join, this open source band, And work together, hand in hand, For a brighter future, we'll stand, With open source machine learning, we'll take a stand.
{
"id": "7omksadbmcnqkj6gtsyczhjhqq",
"model": "meta/llama-2-70b-chat",
"version": "2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1",
"input": {
"debug": false,
"max_new_tokens": 500,
"min_new_tokens": -1,
"prompt": "Can you write a poem about open source machine learning? Let's make it in the style of Martin Luther King.",
"repetition_penalty": 1,
"repetition_penalty_sustain": 256,
"system_prompt": "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.",
"temperature": 0.5,
"token_repetition_penalty_decay": 128,
"top_k": 250,
"top_p": 1
},
"logs": "** Speed: 11.55 tokens/second",
"output": [
"",
" Sure",
",",
" here",
"'",
"s",
" a",
" poem",
" about",
" open",
" source",
" machine",
" learning",
" in",
" the",
" style",
" of",
" Martin",
" Luther",
" King",
":",
"\n",
"\n",
"In",
" the",
" land",
" of",
" technology",
",",
" a",
" movement",
" bre",
"ws",
",",
"\n",
"A",
" call",
" to",
" open",
" source",
",",
" for",
" all",
" to",
" use",
",",
"\n",
"Machine",
" learning",
",",
" once",
" a",
" closed",
"-",
"off",
" art",
",",
"\n",
"Now",
" free",
" for",
" all",
",",
" a",
" new",
" depart",
".",
"\n",
"\n",
"The",
" code",
",",
" once",
" locked",
" away",
",",
" now",
" free",
",",
"\n",
"A",
" gift",
" to",
" all",
",",
" for",
" all",
" to",
" see",
",",
"\n",
"The",
" power",
" of",
" A",
"I",
",",
" for",
" everyone",
",",
"\n",
"To",
" learn",
",",
" to",
" grow",
",",
" to",
" be",
" the",
" sun",
".",
"\n",
"\n",
"The",
" community",
",",
" diverse",
" and",
" strong",
",",
"\n",
"Work",
"s",
" together",
",",
" right",
" where",
" they",
" belong",
",",
"\n",
"Sh",
"aring",
" knowledge",
",",
" skills",
" and",
" time",
",",
"\n",
"A",
" bond",
" that",
"'",
"s",
" strong",
",",
" a",
" bond",
" that",
"'",
"s",
" fine",
".",
"\n",
"\n",
"T",
"ogether",
" they",
" st",
"rive",
",",
" for",
" a",
" world",
" that",
"'",
"s",
" fair",
",",
"\n",
"Where",
" A",
"I",
" is",
" used",
",",
" to",
" show",
" they",
" care",
",",
"\n",
"For",
" justice",
",",
" equality",
" and",
" rights",
",",
"\n",
"A",
" future",
" bright",
",",
" with",
" open",
" sight",
".",
"\n",
"\n",
"The",
" open",
" source",
" way",
",",
" a",
" path",
" they",
" choose",
",",
"\n",
"To",
" make",
" a",
" difference",
",",
" they",
" don",
"'",
"t",
" refuse",
",",
"\n",
"For",
" the",
" greater",
" good",
",",
" they",
" to",
"il",
" and",
" st",
"rive",
",",
"\n",
"A",
" movement",
" strong",
",",
" they",
" will",
" surv",
"ive",
".",
"\n",
"\n",
"With",
" each",
" line",
" of",
" code",
",",
" a",
" door",
" is",
" opened",
",",
"\n",
"A",
" chance",
" for",
" all",
",",
" to",
" be",
" emp",
"ower",
"ed",
",",
"\n",
"To",
" learn",
",",
" to",
" grow",
",",
" to",
" be",
" the",
" change",
",",
"\n",
"A",
" world",
" where",
" A",
"I",
",",
" is",
" a",
" human",
" range",
".",
"\n",
"\n",
"So",
" let",
" us",
" join",
",",
" this",
" open",
" source",
" band",
",",
"\n",
"And",
" work",
" together",
",",
" hand",
" in",
" hand",
",",
"\n",
"For",
" a",
" br",
"ighter",
" future",
",",
" we",
"'",
"ll",
" stand",
",",
"\n",
"With",
" open",
" source",
" machine",
" learning",
",",
" we",
"'",
"ll",
" take",
" a",
" stand",
"."
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-08-11T15:25:09.514281Z",
"started_at": "2023-08-11T15:25:16.774265Z",
"completed_at": "2023-08-11T15:25:46.486576Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/7omksadbmcnqkj6gtsyczhjhqq/cancel",
"get": "https://api.replicate.com/v1/predictions/7omksadbmcnqkj6gtsyczhjhqq"
},
"metrics": {
"predict_time": 29.712311,
"total_time": 36.972295
}
}