import requests
import json
payload = [{
"context": "In what year did Neil Armstrong land on the moon?",
"correct_response": "1969"
}, {
"context": "Who is the author of the book 'To Kill a Mockingbird'?",
"correct_response": "Harper Lee"
}, {
"context": "What is the capital of France?",
"correct_response": "Paris"
}]
url = "https://api.berri.ai/finetune_instance"
args = {
"user_email": "krrish@berri.ai",
"instance_id": "7156c47f-2f70-4c81-a622-5dc21ef716d2"
}
headers = {'Content-Type': 'application/json'}
data = json.dumps(payload)
response = requests.post(url, params=args, headers=headers, data=data)
print(response.text)
<?php
$payload = array(
array(
"context" => "In what year did Neil Armstrong land on the moon?",
"correct_response" => "1969"
),
array(
"context" => "Who is the author of the book 'To Kill a Mockingbird'?",
"correct_response" => "Harper Lee"
),
array(
"context" => "What is the capital of France?",
"correct_response" => "Paris"
)
);
$url = "https://api.berri.ai/finetune_instance";
$args = array(
"user_email" => "krrishdholakia@gmail.com",
"instance_id" => "6eaa6359-7d27-4083-98d0-989c9d05930c"
);
$headers = array('Content-Type' => 'application/json');
$data = json_encode($payload);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => $data
)
);
$context = stream_context_create($options);
$response = file_get_contents($url . '?' . http_build_query($args), false, $context);
echo $response;
?>
{
"status": "<string>",
"api_endpoint": "<string>"
}Endpoints
FineTuning
Finetune your instance by providing it context and correct answer
POST
/
finetune_instance
import requests
import json
payload = [{
"context": "In what year did Neil Armstrong land on the moon?",
"correct_response": "1969"
}, {
"context": "Who is the author of the book 'To Kill a Mockingbird'?",
"correct_response": "Harper Lee"
}, {
"context": "What is the capital of France?",
"correct_response": "Paris"
}]
url = "https://api.berri.ai/finetune_instance"
args = {
"user_email": "krrish@berri.ai",
"instance_id": "7156c47f-2f70-4c81-a622-5dc21ef716d2"
}
headers = {'Content-Type': 'application/json'}
data = json.dumps(payload)
response = requests.post(url, params=args, headers=headers, data=data)
print(response.text)
<?php
$payload = array(
array(
"context" => "In what year did Neil Armstrong land on the moon?",
"correct_response" => "1969"
),
array(
"context" => "Who is the author of the book 'To Kill a Mockingbird'?",
"correct_response" => "Harper Lee"
),
array(
"context" => "What is the capital of France?",
"correct_response" => "Paris"
)
);
$url = "https://api.berri.ai/finetune_instance";
$args = array(
"user_email" => "krrishdholakia@gmail.com",
"instance_id" => "6eaa6359-7d27-4083-98d0-989c9d05930c"
);
$headers = array('Content-Type' => 'application/json');
$data = json_encode($payload);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => $data
)
);
$context = stream_context_create($options);
$response = file_get_contents($url . '?' . http_build_query($args), false, $context);
echo $response;
?>
{
"status": "<string>",
"api_endpoint": "<string>"
}Fine-tune
This endpoint is used to finetune an instance by passing in the required information as parameters in the request. Request Body The request body should contain a list of JSON objects, with each object containing both context and correct_response attributes. The structure of the request body should be as follows:string
Pass in your email, this will map the app you create to your account.
string
The instance_id you received after calling create_app
string
default:"[]"
required
The request body should contain a list of JSON objects, with each object containing both context
and correct_response attributes. The structure of the request body should be as follows:
[
{
"context": "In what year did Neil Armstrong land on the moon?",
"correct_response": "1969"
},
{ "context": "Who is the author of the book 'To Kill a Mockingbird'?",
"correct_response": "Harper Lee"
},
{ "context": "What is the capital of France?",
"correct_response": "Paris"
}
]
Response
string
A string indicating the status of the request. This will be “success” if the
request was successful and the feedback was stored
string
Your api endpoint of the finetuned instance
import requests
import json
payload = [{
"context": "In what year did Neil Armstrong land on the moon?",
"correct_response": "1969"
}, {
"context": "Who is the author of the book 'To Kill a Mockingbird'?",
"correct_response": "Harper Lee"
}, {
"context": "What is the capital of France?",
"correct_response": "Paris"
}]
url = "https://api.berri.ai/finetune_instance"
args = {
"user_email": "krrish@berri.ai",
"instance_id": "7156c47f-2f70-4c81-a622-5dc21ef716d2"
}
headers = {'Content-Type': 'application/json'}
data = json.dumps(payload)
response = requests.post(url, params=args, headers=headers, data=data)
print(response.text)
<?php
$payload = array(
array(
"context" => "In what year did Neil Armstrong land on the moon?",
"correct_response" => "1969"
),
array(
"context" => "Who is the author of the book 'To Kill a Mockingbird'?",
"correct_response" => "Harper Lee"
),
array(
"context" => "What is the capital of France?",
"correct_response" => "Paris"
)
);
$url = "https://api.berri.ai/finetune_instance";
$args = array(
"user_email" => "krrishdholakia@gmail.com",
"instance_id" => "6eaa6359-7d27-4083-98d0-989c9d05930c"
);
$headers = array('Content-Type' => 'application/json');
$data = json_encode($payload);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => $data
)
);
$context = stream_context_create($options);
$response = file_get_contents($url . '?' . http_build_query($args), false, $context);
echo $response;
?>

