Run selected cells in AI table cells are in [(document_id,column_id),(document_id,column_id),...] format
curl --request POST \
--url https://cite.petal.org/api/ai/table/{ai_table_id}/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"doc_id_col_id": [
[
123
]
],
"continue_response": true
}
'import requests
url = "https://cite.petal.org/api/ai/table/{ai_table_id}/run"
payload = {
"doc_id_col_id": [[123]],
"continue_response": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({doc_id_col_id: [[123]], continue_response: true})
};
fetch('https://cite.petal.org/api/ai/table/{ai_table_id}/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cite.petal.org/api/ai/table/{ai_table_id}/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'doc_id_col_id' => [
[
123
]
],
'continue_response' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cite.petal.org/api/ai/table/{ai_table_id}/run"
payload := strings.NewReader("{\n \"doc_id_col_id\": [\n [\n 123\n ]\n ],\n \"continue_response\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cite.petal.org/api/ai/table/{ai_table_id}/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"doc_id_col_id\": [\n [\n 123\n ]\n ],\n \"continue_response\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cite.petal.org/api/ai/table/{ai_table_id}/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"doc_id_col_id\": [\n [\n 123\n ]\n ],\n \"continue_response\": true\n}"
response = http.request(request)
puts response.read_body[
{
"ai_column_id": 123,
"document_id": 123,
"id": 123,
"meta": {},
"modified_at": "<string>",
"response": "<string>",
"task_id": "<string>",
"task_status": "<string>"
}
][
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {}
}
]AI Table
Create cells and run AI
Create cells for the given column-Document pairs if cells do not already exist, and invoke the AI to generate responses for them
POST
/
api
/
ai
/
table
/
{ai_table_id}
/
run
Run selected cells in AI table cells are in [(document_id,column_id),(document_id,column_id),...] format
curl --request POST \
--url https://cite.petal.org/api/ai/table/{ai_table_id}/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"doc_id_col_id": [
[
123
]
],
"continue_response": true
}
'import requests
url = "https://cite.petal.org/api/ai/table/{ai_table_id}/run"
payload = {
"doc_id_col_id": [[123]],
"continue_response": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({doc_id_col_id: [[123]], continue_response: true})
};
fetch('https://cite.petal.org/api/ai/table/{ai_table_id}/run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cite.petal.org/api/ai/table/{ai_table_id}/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'doc_id_col_id' => [
[
123
]
],
'continue_response' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cite.petal.org/api/ai/table/{ai_table_id}/run"
payload := strings.NewReader("{\n \"doc_id_col_id\": [\n [\n 123\n ]\n ],\n \"continue_response\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cite.petal.org/api/ai/table/{ai_table_id}/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"doc_id_col_id\": [\n [\n 123\n ]\n ],\n \"continue_response\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cite.petal.org/api/ai/table/{ai_table_id}/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"doc_id_col_id\": [\n [\n 123\n ]\n ],\n \"continue_response\": true\n}"
response = http.request(request)
puts response.read_body[
{
"ai_column_id": 123,
"document_id": 123,
"id": 123,
"meta": {},
"modified_at": "<string>",
"response": "<string>",
"task_id": "<string>",
"task_status": "<string>"
}
][
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {}
}
]Authorizations
Body
application/json
Response
OK
