AI -> Agent
Ask Question To AI Agent
API Documentation
Organization -> Organizations
Organization -> Workspaces
Organization -> Projects
Projects (Deprecated)
Projects -> Api Key
Connections
Data -> Catalogs
Data -> Internal Tables
Data -> Queries
Data -> Semantic Catalogs
Data -> Cache
Embedded Peaka Api
Supported Drivers
Data -> Metadata
- PUTUpdate Metadata
- PUTUpdate Relation From Metadata
- DELDelete Relation From Metadata
- PUTGenerate categorical values from the the column.
- POSTGenerate semantics for the table
- POSTAdd Relation To Metadata
- GETList of golden sqls for the project.
- POSTCreate golden sql for the project
- GETGet Project Metadata
- GETGet Project Catalog Metadata Relations
- GETGenerate sample ai questions for the project
- DELDelete golden sql from the project.
AI -> Agent
Ask Question To AI Agent
POST
/
ai
/
{projectId}
/
agent
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"
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
Body
application/json
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.
Response
200 - application/json
Ask Question To AI Agent
The response is of type object
.
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"
}