curl --request POST \
--url https://api.pawa-ai.com/v1/agents/chat/request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"intents": [
"Be gentle",
"Be detailed"
],
"model": "pawa-v1-blaze-20250318",
"message": {
"role": "user",
"content": [
{
"type": "text",
"text": "What is the current president of Tanzania?"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/image.png"
}
}
]
},
"temperature": 0.1,
"top_p": 0.95,
"max_tokens": 4096,
"frequency_penalty": 0.3,
"presence_penalty": 0.3,
"seed": 2024,
"stream": false,
"agents": [
2,
3,
4
],
"memoryChat": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Habari yako?"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Nzuri sana, asante. Wewe je?"
}
]
}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "foo",
"strict": true,
"schema": {
"type": "object",
"properties": {
"answer": {
"type": "string",
"pattern": "^\\d+$"
}
},
"required": [
"answer"
],
"additionalProperties": false
}
}
}
}
'import requests
url = "https://api.pawa-ai.com/v1/agents/chat/request"
payload = {
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"intents": ["Be gentle", "Be detailed"],
"model": "pawa-v1-blaze-20250318",
"message": {
"role": "user",
"content": [
{
"type": "text",
"text": "What is the current president of Tanzania?"
},
{
"type": "image_url",
"image_url": { "url": "https://example.com/image.png" }
}
]
},
"temperature": 0.1,
"top_p": 0.95,
"max_tokens": 4096,
"frequency_penalty": 0.3,
"presence_penalty": 0.3,
"seed": 2024,
"stream": False,
"agents": [2, 3, 4],
"memoryChat": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Habari yako?"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Nzuri sana, asante. Wewe je?"
}
]
}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "foo",
"strict": True,
"schema": {
"type": "object",
"properties": { "answer": {
"type": "string",
"pattern": "^\d+$"
} },
"required": ["answer"],
"additionalProperties": False
}
}
}
}
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({
name: 'TutorAI',
description: 'TutorAI is an AI agent designed to assist students with their studies.',
instruction: 'Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to',
intents: ['Be gentle', 'Be detailed'],
model: 'pawa-v1-blaze-20250318',
message: {
role: 'user',
content: [
{type: 'text', text: 'What is the current president of Tanzania?'},
{type: 'image_url', image_url: {url: 'https://example.com/image.png'}}
]
},
temperature: 0.1,
top_p: 0.95,
max_tokens: 4096,
frequency_penalty: 0.3,
presence_penalty: 0.3,
seed: 2024,
stream: false,
agents: [2, 3, 4],
memoryChat: [
{role: 'user', content: [{type: 'text', text: 'Habari yako?'}]},
{
role: 'assistant',
content: [{type: 'text', text: 'Nzuri sana, asante. Wewe je?'}]
}
],
response_format: {
type: 'json_schema',
json_schema: {
name: 'foo',
strict: true,
schema: {
type: 'object',
properties: {answer: {type: 'string', pattern: '^\d+$'}},
required: ['answer'],
additionalProperties: false
}
}
}
})
};
fetch('https://api.pawa-ai.com/v1/agents/chat/request', 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://api.pawa-ai.com/v1/agents/chat/request",
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([
'name' => 'TutorAI',
'description' => 'TutorAI is an AI agent designed to assist students with their studies.',
'instruction' => 'Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to',
'intents' => [
'Be gentle',
'Be detailed'
],
'model' => 'pawa-v1-blaze-20250318',
'message' => [
'role' => 'user',
'content' => [
[
'type' => 'text',
'text' => 'What is the current president of Tanzania?'
],
[
'type' => 'image_url',
'image_url' => [
'url' => 'https://example.com/image.png'
]
]
]
],
'temperature' => 0.1,
'top_p' => 0.95,
'max_tokens' => 4096,
'frequency_penalty' => 0.3,
'presence_penalty' => 0.3,
'seed' => 2024,
'stream' => false,
'agents' => [
2,
3,
4
],
'memoryChat' => [
[
'role' => 'user',
'content' => [
[
'type' => 'text',
'text' => 'Habari yako?'
]
]
],
[
'role' => 'assistant',
'content' => [
[
'type' => 'text',
'text' => 'Nzuri sana, asante. Wewe je?'
]
]
]
],
'response_format' => [
'type' => 'json_schema',
'json_schema' => [
'name' => 'foo',
'strict' => true,
'schema' => [
'type' => 'object',
'properties' => [
'answer' => [
'type' => 'string',
'pattern' => '^\\d+$'
]
],
'required' => [
'answer'
],
'additionalProperties' => false
]
]
]
]),
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://api.pawa-ai.com/v1/agents/chat/request"
payload := strings.NewReader("{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"model\": \"pawa-v1-blaze-20250318\",\n \"message\": {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is the current president of Tanzania?\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\"\n }\n }\n ]\n },\n \"temperature\": 0.1,\n \"top_p\": 0.95,\n \"max_tokens\": 4096,\n \"frequency_penalty\": 0.3,\n \"presence_penalty\": 0.3,\n \"seed\": 2024,\n \"stream\": false,\n \"agents\": [\n 2,\n 3,\n 4\n ],\n \"memoryChat\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Habari yako?\"\n }\n ]\n },\n {\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Nzuri sana, asante. Wewe je?\"\n }\n ]\n }\n ],\n \"response_format\": {\n \"type\": \"json_schema\",\n \"json_schema\": {\n \"name\": \"foo\",\n \"strict\": true,\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"answer\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\d+$\"\n }\n },\n \"required\": [\n \"answer\"\n ],\n \"additionalProperties\": false\n }\n }\n }\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://api.pawa-ai.com/v1/agents/chat/request")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"model\": \"pawa-v1-blaze-20250318\",\n \"message\": {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is the current president of Tanzania?\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\"\n }\n }\n ]\n },\n \"temperature\": 0.1,\n \"top_p\": 0.95,\n \"max_tokens\": 4096,\n \"frequency_penalty\": 0.3,\n \"presence_penalty\": 0.3,\n \"seed\": 2024,\n \"stream\": false,\n \"agents\": [\n 2,\n 3,\n 4\n ],\n \"memoryChat\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Habari yako?\"\n }\n ]\n },\n {\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Nzuri sana, asante. Wewe je?\"\n }\n ]\n }\n ],\n \"response_format\": {\n \"type\": \"json_schema\",\n \"json_schema\": {\n \"name\": \"foo\",\n \"strict\": true,\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"answer\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\d+$\"\n }\n },\n \"required\": [\n \"answer\"\n ],\n \"additionalProperties\": false\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pawa-ai.com/v1/agents/chat/request")
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 \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"model\": \"pawa-v1-blaze-20250318\",\n \"message\": {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is the current president of Tanzania?\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\"\n }\n }\n ]\n },\n \"temperature\": 0.1,\n \"top_p\": 0.95,\n \"max_tokens\": 4096,\n \"frequency_penalty\": 0.3,\n \"presence_penalty\": 0.3,\n \"seed\": 2024,\n \"stream\": false,\n \"agents\": [\n 2,\n 3,\n 4\n ],\n \"memoryChat\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Habari yako?\"\n }\n ]\n },\n {\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Nzuri sana, asante. Wewe je?\"\n }\n ]\n }\n ],\n \"response_format\": {\n \"type\": \"json_schema\",\n \"json_schema\": {\n \"name\": \"foo\",\n \"strict\": true,\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"answer\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\d+$\"\n }\n },\n \"required\": [\n \"answer\"\n ],\n \"additionalProperties\": false\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Chat request processed successfully",
"data": {
"request": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Mimi ni pawa..."
},
"matched_stop": 106
}
],
"created": 1753304351,
"model": "pawa-v1-blaze-20250318",
"object": "chat.request"
}
}{
"success": false,
"message": "Invalid input provided"
}{
"success": false,
"message": "Unauthorized access"
}{
"success": false,
"message": "You do not have permission to access this resource"
}{
"success": false,
"message": "Resource does not exist"
}{
"success": false,
"message": "Rate limit exceeded. Please try again later."
}{
"success": false,
"message": "Internal server error"
}Agents Handoff
This endpoint is used to receive agent chat request from user through API and return the answer.
curl --request POST \
--url https://api.pawa-ai.com/v1/agents/chat/request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"intents": [
"Be gentle",
"Be detailed"
],
"model": "pawa-v1-blaze-20250318",
"message": {
"role": "user",
"content": [
{
"type": "text",
"text": "What is the current president of Tanzania?"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/image.png"
}
}
]
},
"temperature": 0.1,
"top_p": 0.95,
"max_tokens": 4096,
"frequency_penalty": 0.3,
"presence_penalty": 0.3,
"seed": 2024,
"stream": false,
"agents": [
2,
3,
4
],
"memoryChat": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Habari yako?"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Nzuri sana, asante. Wewe je?"
}
]
}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "foo",
"strict": true,
"schema": {
"type": "object",
"properties": {
"answer": {
"type": "string",
"pattern": "^\\d+$"
}
},
"required": [
"answer"
],
"additionalProperties": false
}
}
}
}
'import requests
url = "https://api.pawa-ai.com/v1/agents/chat/request"
payload = {
"name": "TutorAI",
"description": "TutorAI is an AI agent designed to assist students with their studies.",
"instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to",
"intents": ["Be gentle", "Be detailed"],
"model": "pawa-v1-blaze-20250318",
"message": {
"role": "user",
"content": [
{
"type": "text",
"text": "What is the current president of Tanzania?"
},
{
"type": "image_url",
"image_url": { "url": "https://example.com/image.png" }
}
]
},
"temperature": 0.1,
"top_p": 0.95,
"max_tokens": 4096,
"frequency_penalty": 0.3,
"presence_penalty": 0.3,
"seed": 2024,
"stream": False,
"agents": [2, 3, 4],
"memoryChat": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Habari yako?"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Nzuri sana, asante. Wewe je?"
}
]
}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "foo",
"strict": True,
"schema": {
"type": "object",
"properties": { "answer": {
"type": "string",
"pattern": "^\d+$"
} },
"required": ["answer"],
"additionalProperties": False
}
}
}
}
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({
name: 'TutorAI',
description: 'TutorAI is an AI agent designed to assist students with their studies.',
instruction: 'Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to',
intents: ['Be gentle', 'Be detailed'],
model: 'pawa-v1-blaze-20250318',
message: {
role: 'user',
content: [
{type: 'text', text: 'What is the current president of Tanzania?'},
{type: 'image_url', image_url: {url: 'https://example.com/image.png'}}
]
},
temperature: 0.1,
top_p: 0.95,
max_tokens: 4096,
frequency_penalty: 0.3,
presence_penalty: 0.3,
seed: 2024,
stream: false,
agents: [2, 3, 4],
memoryChat: [
{role: 'user', content: [{type: 'text', text: 'Habari yako?'}]},
{
role: 'assistant',
content: [{type: 'text', text: 'Nzuri sana, asante. Wewe je?'}]
}
],
response_format: {
type: 'json_schema',
json_schema: {
name: 'foo',
strict: true,
schema: {
type: 'object',
properties: {answer: {type: 'string', pattern: '^\d+$'}},
required: ['answer'],
additionalProperties: false
}
}
}
})
};
fetch('https://api.pawa-ai.com/v1/agents/chat/request', 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://api.pawa-ai.com/v1/agents/chat/request",
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([
'name' => 'TutorAI',
'description' => 'TutorAI is an AI agent designed to assist students with their studies.',
'instruction' => 'Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to',
'intents' => [
'Be gentle',
'Be detailed'
],
'model' => 'pawa-v1-blaze-20250318',
'message' => [
'role' => 'user',
'content' => [
[
'type' => 'text',
'text' => 'What is the current president of Tanzania?'
],
[
'type' => 'image_url',
'image_url' => [
'url' => 'https://example.com/image.png'
]
]
]
],
'temperature' => 0.1,
'top_p' => 0.95,
'max_tokens' => 4096,
'frequency_penalty' => 0.3,
'presence_penalty' => 0.3,
'seed' => 2024,
'stream' => false,
'agents' => [
2,
3,
4
],
'memoryChat' => [
[
'role' => 'user',
'content' => [
[
'type' => 'text',
'text' => 'Habari yako?'
]
]
],
[
'role' => 'assistant',
'content' => [
[
'type' => 'text',
'text' => 'Nzuri sana, asante. Wewe je?'
]
]
]
],
'response_format' => [
'type' => 'json_schema',
'json_schema' => [
'name' => 'foo',
'strict' => true,
'schema' => [
'type' => 'object',
'properties' => [
'answer' => [
'type' => 'string',
'pattern' => '^\\d+$'
]
],
'required' => [
'answer'
],
'additionalProperties' => false
]
]
]
]),
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://api.pawa-ai.com/v1/agents/chat/request"
payload := strings.NewReader("{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"model\": \"pawa-v1-blaze-20250318\",\n \"message\": {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is the current president of Tanzania?\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\"\n }\n }\n ]\n },\n \"temperature\": 0.1,\n \"top_p\": 0.95,\n \"max_tokens\": 4096,\n \"frequency_penalty\": 0.3,\n \"presence_penalty\": 0.3,\n \"seed\": 2024,\n \"stream\": false,\n \"agents\": [\n 2,\n 3,\n 4\n ],\n \"memoryChat\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Habari yako?\"\n }\n ]\n },\n {\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Nzuri sana, asante. Wewe je?\"\n }\n ]\n }\n ],\n \"response_format\": {\n \"type\": \"json_schema\",\n \"json_schema\": {\n \"name\": \"foo\",\n \"strict\": true,\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"answer\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\d+$\"\n }\n },\n \"required\": [\n \"answer\"\n ],\n \"additionalProperties\": false\n }\n }\n }\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://api.pawa-ai.com/v1/agents/chat/request")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"model\": \"pawa-v1-blaze-20250318\",\n \"message\": {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is the current president of Tanzania?\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\"\n }\n }\n ]\n },\n \"temperature\": 0.1,\n \"top_p\": 0.95,\n \"max_tokens\": 4096,\n \"frequency_penalty\": 0.3,\n \"presence_penalty\": 0.3,\n \"seed\": 2024,\n \"stream\": false,\n \"agents\": [\n 2,\n 3,\n 4\n ],\n \"memoryChat\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Habari yako?\"\n }\n ]\n },\n {\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Nzuri sana, asante. Wewe je?\"\n }\n ]\n }\n ],\n \"response_format\": {\n \"type\": \"json_schema\",\n \"json_schema\": {\n \"name\": \"foo\",\n \"strict\": true,\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"answer\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\d+$\"\n }\n },\n \"required\": [\n \"answer\"\n ],\n \"additionalProperties\": false\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pawa-ai.com/v1/agents/chat/request")
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 \"name\": \"TutorAI\",\n \"description\": \"TutorAI is an AI agent designed to assist students with their studies.\",\n \"instruction\": \"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to\",\n \"intents\": [\n \"Be gentle\",\n \"Be detailed\"\n ],\n \"model\": \"pawa-v1-blaze-20250318\",\n \"message\": {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is the current president of Tanzania?\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://example.com/image.png\"\n }\n }\n ]\n },\n \"temperature\": 0.1,\n \"top_p\": 0.95,\n \"max_tokens\": 4096,\n \"frequency_penalty\": 0.3,\n \"presence_penalty\": 0.3,\n \"seed\": 2024,\n \"stream\": false,\n \"agents\": [\n 2,\n 3,\n 4\n ],\n \"memoryChat\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Habari yako?\"\n }\n ]\n },\n {\n \"role\": \"assistant\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Nzuri sana, asante. Wewe je?\"\n }\n ]\n }\n ],\n \"response_format\": {\n \"type\": \"json_schema\",\n \"json_schema\": {\n \"name\": \"foo\",\n \"strict\": true,\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"answer\": {\n \"type\": \"string\",\n \"pattern\": \"^\\\\d+$\"\n }\n },\n \"required\": [\n \"answer\"\n ],\n \"additionalProperties\": false\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Chat request processed successfully",
"data": {
"request": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Mimi ni pawa..."
},
"matched_stop": 106
}
],
"created": 1753304351,
"model": "pawa-v1-blaze-20250318",
"object": "chat.request"
}
}{
"success": false,
"message": "Invalid input provided"
}{
"success": false,
"message": "Unauthorized access"
}{
"success": false,
"message": "You do not have permission to access this resource"
}{
"success": false,
"message": "Resource does not exist"
}{
"success": false,
"message": "Rate limit exceeded. Please try again later."
}{
"success": false,
"message": "Internal server error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The name of the agent
"TutorAI"
The description about the agent
"TutorAI is an AI agent designed to assist students with their studies."
What should the agent do
"Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to"
The list of intents, how the model should behave?
["Be gentle", "Be detailed"]
The name of the model to use.
Messages to send to the model
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is the current president of Tanzania?"
},
{
"type": "image_url",
"image_url": { "url": "https://example.com/image.png" }
}
]
}
Sampling temperature
Nucleus sampling (top-p)
Maximum number of tokens in the response
Penalty for repeated tokens
Penalty for new topic tokens
Random seed for reproducibility
Whether to stream the response
The list of agent IDs the main agent should use to respond
[2, 3, 4]
Previous messages in the conversation (as a JSON string)
Show child attributes
Show child attributes
[
{
"role": "user",
"content": [{ "type": "text", "text": "Habari yako?" }]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Nzuri sana, asante. Wewe je?"
}
]
}
]
Optional response format specification
Show child attributes
Show child attributes
{
"type": "json_schema",
"json_schema": {
"name": "foo",
"strict": true,
"schema": {
"type": "object",
"properties": {
"answer": { "type": "string", "pattern": "^\\d+$" }
},
"required": ["answer"],
"additionalProperties": false
}
}
}