typetext
{
"debug": false,
"max_new_tokens": 500,
"prompt": "# sum 2 numbers\ndef s",
"temperature": 0.95,
"top_k": 250,
"top_p": 0.95
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_EZM**********************************
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-7b-python using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"meta/codellama-7b-python:27009070dd7c1166317c35cd637f3cb9170e43d38234110089ea355a85a67deb",
{
input: {
debug: false,
max_new_tokens: 500,
prompt: "# sum 2 numbers\ndef s",
temperature: 0.95,
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_EZM**********************************
This is your API token. Keep it to yourself.
import replicate
Run meta/codellama-7b-python using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"meta/codellama-7b-python:27009070dd7c1166317c35cd637f3cb9170e43d38234110089ea355a85a67deb",
input={
"debug": False,
"max_new_tokens": 500,
"prompt": "# sum 2 numbers\ndef s",
"temperature": 0.95,
"top_k": 250,
"top_p": 0.95
}
)
# The meta/codellama-7b-python 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-7b-python/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_EZM**********************************
This is your API token. Keep it to yourself.
Run meta/codellama-7b-python 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-7b-python:27009070dd7c1166317c35cd637f3cb9170e43d38234110089ea355a85a67deb",
"input": {
"debug": false,
"max_new_tokens": 500,
"prompt": "# sum 2 numbers\\ndef s",
"temperature": 0.95,
"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.
1():
return 2 + 4
def s2(x, y):
return x + y
def s3(x, y):
return x + y
a = s1(){
"id": "dz6tualbnqbcfd66cxb3bwec7a",
"model": "meta/codellama-7b-python",
"version": "27009070dd7c1166317c35cd637f3cb9170e43d38234110089ea355a85a67deb",
"input": {
"debug": false,
"max_new_tokens": 500,
"prompt": "# sum 2 numbers\ndef s",
"temperature": 0.95,
"top_k": 250,
"top_p": 0.95
},
"logs": "Prompt:\n# sum 2 numbers\ndef s\nINFO 09-06 19:10:01 async_llm_engine.py:117] Received request 0: prompt: '# sum 2 numbers\\ndef s', sampling params: SamplingParams(n=1, best_of=1, presence_penalty=0.0, frequency_penalty=1.0, temperature=0.95, top_p=0.95, top_k=250, use_beam_search=False, stop=['</s>'], ignore_eos=False, max_tokens=500, logprobs=None), prompt token ids: None.\nINFO 09-06 19:10:02 async_llm_engine.py:171] Finished request 0.",
"output": [
"1",
"():",
"\n",
" ",
" return",
" ",
"2",
" +",
" ",
"4",
"\n",
"def",
" s",
"2",
"(",
"x",
",",
" y",
"):",
"\n",
" ",
" return",
" x",
" +",
" y",
"\n",
"def",
" s",
"3",
"(",
"x",
",",
" y",
"):",
"\n",
" ",
" return",
" x",
" +",
" y",
"\n",
"a",
" =",
" s",
"1",
"()",
""
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-09-06T19:09:05.113924Z",
"started_at": "2023-09-06T19:10:01.302028Z",
"completed_at": "2023-09-06T19:10:02.416547Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/dz6tualbnqbcfd66cxb3bwec7a/cancel",
"get": "https://api.replicate.com/v1/predictions/dz6tualbnqbcfd66cxb3bwec7a"
},
"metrics": {
"predict_time": 1.114519,
"total_time": 57.302623
}
}