curl --request POST \
--url https://partner.peaka.studio/api/v1/ai/{projectId}/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"message": "What are the top 3 portfolios ranked by their total market value as of the most recent date recorded?"
}'
{
"output": {
"query": "WITH LatestDate AS ( SELECT MAX(\"date\") AS \"latest_date\" FROM \"supabase\".\"public\".\"holdings\" ) SELECT h.\"portfolio_name\", SUM(h.\"ending_market_value\") AS \"total_market_value\" FROM \"supabase\".\"public\".\"holdings\" h JOIN LatestDate ld ON h.\"date\" = ld.\"latest_date\" GROUP BY h.\"portfolio_name\" ORDER BY \"total_market_value\" DESC LIMIT 5",
"data": [
[
{
"dataType": "varchar",
"name": "portfolio_name",
"order": 0,
"value": "102296_9"
},
{
"dataType": "real",
"name": "total_market_value",
"order": 1,
"value": 1887237400
}
],
[
{
"dataType": "varchar",
"name": "portfolio_name",
"order": 0,
"value": "103100_7"
},
{
"dataType": "real",
"name": "total_market_value",
"order": 1,
"value": 6269447.5
}
],
[
{
"dataType": "varchar",
"name": "portfolio_name",
"order": 0,
"value": "103271_3"
},
{
"dataType": "real",
"name": "total_market_value",
"order": 1,
"value": 2563462.8
}
]
],
"text": "The top 3 portfolios ranked by their total market value as of the most recent date recorded are: Portfolio '102296_9' with a total market value of 1,887,237,400, Portfolio '103100_7' with a total market value of 6,269,447.5, and Portfolio '103271_3' with a total market value of 2,563,462.8."
},
"threadId": "2183372c-7b72-479a-9eec-dd29aafa255b"
}
curl --request POST \
--url https://partner.peaka.studio/api/v1/ai/{projectId}/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"message": "What are the top 3 portfolios ranked by their total market value as of the most recent date recorded?"
}'
{
"output": {
"query": "WITH LatestDate AS ( SELECT MAX(\"date\") AS \"latest_date\" FROM \"supabase\".\"public\".\"holdings\" ) SELECT h.\"portfolio_name\", SUM(h.\"ending_market_value\") AS \"total_market_value\" FROM \"supabase\".\"public\".\"holdings\" h JOIN LatestDate ld ON h.\"date\" = ld.\"latest_date\" GROUP BY h.\"portfolio_name\" ORDER BY \"total_market_value\" DESC LIMIT 5",
"data": [
[
{
"dataType": "varchar",
"name": "portfolio_name",
"order": 0,
"value": "102296_9"
},
{
"dataType": "real",
"name": "total_market_value",
"order": 1,
"value": 1887237400
}
],
[
{
"dataType": "varchar",
"name": "portfolio_name",
"order": 0,
"value": "103100_7"
},
{
"dataType": "real",
"name": "total_market_value",
"order": 1,
"value": 6269447.5
}
],
[
{
"dataType": "varchar",
"name": "portfolio_name",
"order": 0,
"value": "103271_3"
},
{
"dataType": "real",
"name": "total_market_value",
"order": 1,
"value": 2563462.8
}
]
],
"text": "The top 3 portfolios ranked by their total market value as of the most recent date recorded are: Portfolio '102296_9' with a total market value of 1,887,237,400, Portfolio '103100_7' with a total market value of 6,269,447.5, and Portfolio '103271_3' with a total market value of 2,563,462.8."
},
"threadId": "2183372c-7b72-479a-9eec-dd29aafa255b"
}
Use the Authorization header with the value 'Bearer <apiKey>' to authenticate. Partner API Keys have full access; Project API Keys are limited to their project scope. Learn more: https://docs.peaka.com/api-reference/authentication
Question to ask
Represents a request for an AI agent task. This class holds the necessary information for processing an AI agent task, including the message content, an optional thread ID for tracking the AI chat thread, and an optional source tag for categorizing chat history.
Ask Question To AI Agent
The response is of type object
.