typetext
{
"debug": false,
"max_new_tokens": 500,
"min_new_tokens": -1,
"prompt": "Write a javascript function that calculates euclidean distance between two coordinates of any dimension",
"repetition_penalty": 1.15,
"repetition_penalty_sustain": 256,
"temperature": 0.95,
"token_repetition_penalty_decay": 128,
"top_k": 250,
"top_p": 0.95
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_b5m**********************************
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/codellama-13b-instruct using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"meta/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b",
{
input: {
debug: false,
max_new_tokens: 500,
min_new_tokens: -1,
prompt: "Write a javascript function that calculates euclidean distance between two coordinates of any dimension",
repetition_penalty: 1.15,
repetition_penalty_sustain: 256,
temperature: 0.95,
token_repetition_penalty_decay: 128,
top_k: 250,
top_p: 0.95
}
}
);
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_b5m**********************************
This is your API token. Keep it to yourself.
import replicate
Run meta/codellama-13b-instruct using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"meta/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b",
input={
"debug": False,
"max_new_tokens": 500,
"min_new_tokens": -1,
"prompt": "Write a javascript function that calculates euclidean distance between two coordinates of any dimension",
"repetition_penalty": 1.15,
"repetition_penalty_sustain": 256,
"temperature": 0.95,
"token_repetition_penalty_decay": 128,
"top_k": 250,
"top_p": 0.95
}
)
# The meta/codellama-13b-instruct 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/codellama-13b-instruct/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_b5m**********************************
This is your API token. Keep it to yourself.
Run meta/codellama-13b-instruct 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/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b",
"input": {
"debug": false,
"max_new_tokens": 500,
"min_new_tokens": -1,
"prompt": "Write a javascript function that calculates euclidean distance between two coordinates of any dimension",
"repetition_penalty": 1.15,
"repetition_penalty_sustain": 256,
"temperature": 0.95,
"token_repetition_penalty_decay": 128,
"top_k": 250,
"top_p": 0.95
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
```
function getEuclideanDistance(coord1, coord2) {
// Calculate the difference between each coordinate pair in both sets.
diffX = Math.abs(coord1[0] - coord2[0])) {
diffY = Math.abs(coord1[1] - coord2[1])))) {
diffZ = Math.abs(coord1[2] - coord2[2]]))))))) ???');
return dist; } var exampleCoordsArray = [[34.659,-118.8],[34.672,-118.7]], output = calculateEuclideanDistanceForTwoDimensionalCoordinatesOfAnyLength(exampleCoordsArray)); console.log('The output is: ', output]);{
"id": "xpxm323blxekdyaklbhmprtzve",
"model": "meta/codellama-13b-instruct",
"version": "da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b",
"input": {
"debug": false,
"max_new_tokens": 500,
"min_new_tokens": -1,
"prompt": "Write a javascript function that calculates euclidean distance between two coordinates of any dimension",
"repetition_penalty": 1.15,
"repetition_penalty_sustain": 256,
"temperature": 0.95,
"token_repetition_penalty_decay": 128,
"top_k": 250,
"top_p": 0.95
},
"logs": "Prompt:\n[INST] <<SYS>>\n<</SYS>>\nWrite a javascript function that calculates euclidean distance between two coordinates of any dimension [/INST]\n** Speed: 47.62 tokens/second",
"output": [
"",
" ```",
"\n",
"function",
" get",
"E",
"uclidean",
"Distance",
"(",
"co",
"ord",
"1",
",",
" coord",
"2",
")",
" {",
"\n",
"//",
" Calcul",
"ate",
" the",
" difference",
" between",
" each",
" coordinate",
" pair",
" in",
" both",
" sets",
".",
"\n",
"diff",
"X",
" =",
" Math",
".",
"abs",
"(",
"co",
"ord",
"1",
"[",
"0",
"]",
" -",
" coord",
"2",
"[",
"0",
"]))",
" {",
"\n",
"diff",
"Y",
" =",
" Math",
".",
"abs",
"(",
"co",
"ord",
"1",
"[",
"1",
"]",
" -",
" coord",
"2",
"[",
"1",
"]))",
"))",
" {",
"\n",
"diff",
"Z",
" =",
" Math",
".",
"abs",
"(",
"co",
"ord",
"1",
"[",
"2",
"]",
" -",
" coord",
"2",
"[",
"2",
"]]",
"))))",
")))",
" ?",
"??",
"');",
"\n",
" ",
" return",
" dist",
";",
" ",
" }",
" ",
" var",
" example",
"Co",
"ords",
"Array",
" =",
" [[",
"3",
"4",
".",
"6",
"5",
"9",
",-",
"1",
"1",
"8",
".",
"8",
"],[",
"3",
"4",
".",
"6",
"7",
"2",
",-",
"1",
"1",
"8",
".",
"7",
"]],",
" output",
" =",
" calculate",
"E",
"uclidean",
"Distance",
"For",
"Two",
"Dim",
"ensional",
"Co",
"ordinates",
"Of",
"Any",
"Length",
"(",
"example",
"Co",
"ords",
"Array",
"));",
" console",
".",
"log",
"('",
"The",
" output",
" is",
":",
" ',",
" output",
"]);"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-08-26T05:13:49.22026Z",
"started_at": "2023-08-26T05:13:49.170904Z",
"completed_at": "2023-08-26T05:13:52.787864Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/xpxm323blxekdyaklbhmprtzve/cancel",
"get": "https://api.replicate.com/v1/predictions/xpxm323blxekdyaklbhmprtzve"
},
"metrics": {
"predict_time": 3.61696,
"total_time": 3.567604
}
}