typetext
{
"frequency_penalty": 0,
"max_tokens": 512,
"min_tokens": 0,
"presence_penalty": 0,
"prompt": "Could you please explain what APR means?",
"system_prompt": "You are an expert in finance that knows many concepts related to loans and credit.",
"temperature": 0.6,
"top_k": 50,
"top_p": 0.9
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_EdU**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run ibm-granite/granite-3.0-8b-instruct using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"ibm-granite/granite-3.0-8b-instruct:8d8fb55950fb8eb2817fc078b7b05a0bd3ecc612d6332d8009fb0c007839192e",
{
input: {
frequency_penalty: 0,
max_tokens: 512,
min_tokens: 0,
presence_penalty: 0,
prompt: "Could you please explain what APR means?",
system_prompt: "You are an expert in finance that knows many concepts related to loans and credit.",
temperature: 0.6,
top_k: 50,
top_p: 0.9
}
}
);
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_EdU**********************************
This is your API token. Keep it to yourself.
import replicate
Run ibm-granite/granite-3.0-8b-instruct using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"ibm-granite/granite-3.0-8b-instruct:8d8fb55950fb8eb2817fc078b7b05a0bd3ecc612d6332d8009fb0c007839192e",
input={
"frequency_penalty": 0,
"max_tokens": 512,
"min_tokens": 0,
"presence_penalty": 0,
"prompt": "Could you please explain what APR means?",
"system_prompt": "You are an expert in finance that knows many concepts related to loans and credit.",
"temperature": 0.6,
"top_k": 50,
"top_p": 0.9
}
)
# The ibm-granite/granite-3.0-8b-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/ibm-granite/granite-3.0-8b-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_EdU**********************************
This is your API token. Keep it to yourself.
Run ibm-granite/granite-3.0-8b-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": "ibm-granite/granite-3.0-8b-instruct:8d8fb55950fb8eb2817fc078b7b05a0bd3ecc612d6332d8009fb0c007839192e",
"input": {
"frequency_penalty": 0,
"max_tokens": 512,
"min_tokens": 0,
"presence_penalty": 0,
"prompt": "Could you please explain what APR means?",
"system_prompt": "You are an expert in finance that knows many concepts related to loans and credit.",
"temperature": 0.6,
"top_k": 50,
"top_p": 0.9
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
APR stands for Annual Percentage Rate. It is the annual interest rate charged for borrowing, expressed as a single percentage number that represents the actual yearly cost of funds over the term of a loan. It includes any fees or additional costs associated with the transaction.
{
"id": "7pt3wrb6n5rm60cjkd7bpszaqg",
"model": "ibm-granite/granite-3.0-8b-instruct",
"version": "8d8fb55950fb8eb2817fc078b7b05a0bd3ecc612d6332d8009fb0c007839192e",
"input": {
"frequency_penalty": 0,
"max_tokens": 512,
"min_tokens": 0,
"presence_penalty": 0,
"prompt": "Could you please explain what APR means?",
"system_prompt": "You are an expert in finance that knows many concepts related to loans and credit.",
"temperature": 0.6,
"top_k": 50,
"top_p": 0.9
},
"logs": "INFO: ::1:39096 - \"POST /v1/chat/completions HTTP/1.1\" 200 OK\nGeneration took 3.01sFormatted prompt: Could you please explain what APR means?",
"output": [
"",
"AP",
"R",
" stands",
" for",
" Ann",
"ual",
" Per",
"centage",
" Rate",
".",
" It",
" is",
" the",
" annual",
" interest",
" rate",
" char",
"ged",
" for",
" borrow",
"ing",
",",
" expressed",
" as",
" a",
" single",
" percentage",
" number",
" that",
" represents",
" the",
" actual",
" year",
"ly",
" cost",
" of",
" funds",
" over",
" the",
" term",
" of",
" a",
" loan",
".",
" It",
" includes",
" any",
" fees",
" or",
" additional",
" costs",
" associated",
" with",
" the",
" transaction",
".",
""
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-10-17T16:27:39.561Z",
"started_at": "2024-10-17T16:28:22.739612Z",
"completed_at": "2024-10-17T16:28:25.751401Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/7pt3wrb6n5rm60cjkd7bpszaqg/cancel",
"get": "https://api.replicate.com/v1/predictions/7pt3wrb6n5rm60cjkd7bpszaqg",
"stream": "https://stream-b.svc.sea.v.replicate.net/v1/streams/tq2zgdwiyff7rsnnaetvsgys5vu56t7urztchhzpmxjq4g7oggja",
"web": "https://replicate.com/p/7pt3wrb6n5rm60cjkd7bpszaqg"
},
"metrics": {
"predict_time": 3.011789148,
"total_time": 46.190401
}
}