Skip to content

MngTestAIPromptTemplate

POST ai/prompt/test

Renders a template with sample values and reports which placeholders stayed unresolved. An unresolved placeholder is a hole in a message to a client, and this is where it should be seen — not in the delivered text.

By default nothing is sent to the model, so the preview is free. With run: true the rendered text is also sent to the model and the call costs money — that belongs behind an explicit button.

Access Control

Allowed: admin.

Request

POST request
POST https://{broker_domain}/ai/prompt/test
Authorization: <JWT_TOKEN>
Content-Type: application/json

{
  "id": 4,
  "variables": { "login": 2000067, "margin_level": 95.4 }
}
{
  "command": "MngTestAIPromptTemplate",
  "extID": "1",
  "data": { "content": "Account {{login}}…", "variables": { "login": 2000067 }, "run": false }
}
const preview = await platform.MngTestAIPromptTemplate({ id: 4, variables });

Parameters

Parameter Type Description
id int A saved template. Either id or content is required
content string Raw template text instead of a saved one
variables object Sample values for the placeholders
run bool Also send the rendered text to the model. Costs money
agentId int Which agent's model and prompt to use for run; the brand default otherwise

Response Data

{
  "text": "Account 2000067: margin level 95.4%. Explain to the client what to do.",
  "used": ["login", "margin_level"],
  "missing": [],
  "chars": 69,
  "model": null,
  "answer": null,
  "usage": null
}

With run: true the same object carries model, answer and usage with the cost of that call.

Errors

Code Error Description
400 AI_INVALID_DATA Neither id nor content was given
402 AI_BUDGET_EXCEEDED The agent's daily budget is spent (only with run)
403 AI_ACCESS_DENIED The session is not an administrator
404 AI_INVALID_DATA No such template in this brand
503 AI_MODEL_UNAVAILABLE The model is not configured or unavailable (only with run)