Справочник API / Intents

Intents

Endpoints группы Intents в API Voiceland AI, с параметрами, схемами и примерами curl.

Последнее обновление:

Описания endpoints и полей показаны на английском языке, ровно так, как их публикует API. Это наш выбор: здесь вы читаете то же, что увидите в ответах.

GET /v1/agents/{name}/intent-candidates#

List intent candidates. What callers asked this agent for that its taxonomy does not cover, most frequent first. Each entry carries how often it recurred and which existing intent it came closest to, a high nearest_score usually means the fix is one more example on an intent you already have, not a new one. **Reading the scores.** threshold is the cut these phrasings failed to clear and threshold_source says whether you set it (agent) or the platform default applies (default). Every nearest_score here is below that number by definition, so the threshold is what makes the scores mean anything. **tuning is the what-if ladder.** Each rung is a lower threshold with how many of the phrasings BELOW, and how many turns they account for, would have been routed to their nearest_intent instead of landing here. It is computed over the rows in this response and nothing else, so you can check any rung by hand, and limit / min_count narrow it along with the feed. A phrasing with no nearest_intent is never counted on any rung: nothing scored against it, so no threshold recovers it and it needs a new intent. An empty ladder means exactly that for the whole page. Entries expire on their own after sixty days, so this is a review feed rather than an archive. truncated: true means the read stopped at its row budget and this is a top-N over the rows it reached.

Параметры

Имя Место Тип Обязательно Описание
name path string Да The agent.
limit query integer Rows to return, 1-500 (default 50).
min_count query integer Drop phrasings heard fewer times than this. Use it to skip one-offs.

Ответы

Код Описание
200 Success.
400 limit or min_count is not a whole number in range (bad_request).
401 Missing or invalid API key.
402 Your plan does not include intent recognition (feature_not_entitled).
4XX Request error (validation, not-found, etc.).
5XX Server or upstream error.

Пример запроса

curl "https://api.voiceland.ai/v1/agents/{name}/intent-candidates" \
  -H "Authorization: Bearer VL_API_KEY"

Успешный ответ возвращает IntentCandidatesResponse.

Пример ответа

{
  "agent": "front-desk",
  "items": [
    {
      "count": 34,
      "hash": "9f2c1a7e4b3d4e219c0a5f6d7e8a9b0c",
      "nearest_intent": "billing_invoice",
      "nearest_score": 0.19,
      "text": "τι ωρα ανοιγετε σημερα"
    }
  ],
  "threshold": 0.35,
  "threshold_source": "default",
  "truncated": false,
  "tuning": [
    {
      "candidates": 0,
      "threshold": 0.3,
      "turns": 0
    },
    {
      "candidates": 0,
      "threshold": 0.25,
      "turns": 0
    },
    {
      "candidates": 0,
      "threshold": 0.2,
      "turns": 0
    },
    {
      "candidates": 1,
      "threshold": 0.15,
      "turns": 34
    },
    {
      "candidates": 1,
      "threshold": 0.1,
      "turns": 34
    },
    {
      "candidates": 1,
      "threshold": 0.05,
      "turns": 34
    }
  ]
}

POST /v1/agents/{name}/intent-candidates/promote#

Promote an intent candidate. Adds a mined phrasing to the taxonomy and drops it from the candidate list. Naming an EXISTING intent adds the phrasing as one more example, which is the usual move; naming a new one creates it and needs an action. The phrasing added is the one that was recorded, taken from the stored candidate rather than from this request, an edited version would not match the traffic it was promoted to cover.

Параметры

Имя Место Тип Обязательно Описание
name path string Да The agent.

Тело запроса

application/json Схема: IntentPromoteRequest

Поле Тип Обязательно Описание
action string
description string
hash string Да
intent string Да
target string

Ответы

Код Описание
200 Success.
400 hash or intent missing, or a new intent named without an action (invalid_request); or the resulting taxonomy is invalid (invalid_intents).
401 Missing or invalid API key.
404 No agent by that name (agent_not_found), or no candidate with that hash (candidate_not_found).
409 That phrasing is already an example on the named intent (example_exists).
422 The body is not valid JSON for this shape (invalid_request).
4XX Request error (validation, not-found, etc.).
5XX Server or upstream error.

Пример запроса

curl -X POST "https://api.voiceland.ai/v1/agents/{name}/intent-candidates/promote" \
  -H "Authorization: Bearer VL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "action": "answer_from_kb",
  "hash": "9f2c1a7e4b3d4e219c0a5f6d7e8a9b0c",
  "intent": "opening_hours"
}'

DELETE /v1/agents/{name}/intent-candidates/{hash}#

Dismiss an intent candidate. Removes one mined phrasing from the candidate list without adding it to the taxonomy, "we are not going to cover this". Dismissing something callers keep saying only clears it until it is said again.

Параметры

Имя Место Тип Обязательно Описание
name path string Да The agent.
hash path string Да The candidate's hash from the listing.

Ответы

Код Описание
204 Dismissed (or already gone).
401 Missing or invalid API key.
4XX Request error (validation, not-found, etc.).
5XX Server or upstream error.

Пример запроса

curl -X DELETE "https://api.voiceland.ai/v1/agents/{name}/intent-candidates/{hash}" \
  -H "Authorization: Bearer VL_API_KEY"

GET /v1/agents/{name}/intents#

Get an agent's intent taxonomy. The list of things this agent recognises callers asking for, and what it does with each. Never configured reads as disabled with an empty list and the platform default threshold. threshold is always the number actually in force, and threshold_source says where it came from: agent when you set one, default when the platform value applies.

Параметры

Имя Место Тип Обязательно Описание
name path string Да The agent.

Ответы

Код Описание
200 Success.
401 Missing or invalid API key.
402 Your plan does not include intent recognition (feature_not_entitled).
404 No agent by that name (agent_not_found).
4XX Request error (validation, not-found, etc.).
5XX Server or upstream error.

Пример запроса

curl "https://api.voiceland.ai/v1/agents/{name}/intents" \
  -H "Authorization: Bearer VL_API_KEY"

Успешный ответ возвращает IntentTaxonomyResponse.

Пример ответа

{
  "agent": "front-desk",
  "enabled": true,
  "items": [
    {
      "action": "answer_from_kb",
      "examples": [
        "Why was I charged twice",
        "Θέλω να δω το τιμολόγιό μου"
      ],
      "name": "billing_invoice"
    }
  ],
  "threshold": 0.35,
  "threshold_source": "default",
  "unknown_action": "record"
}

PUT /v1/agents/{name}/intents#

Set an agent's intent taxonomy. Replaces the whole taxonomy. Every caller turn is then matched against it before the agent answers, and the match steers the answer according to that intent's action: answer_from_kb searches your knowledge base, flow runs a named procedure, tool calls a named tool, escalate_to_human offers a person, transfer hands the call on. **What matching is done on.** The examples are the evidence, write them in the words your callers actually use, in every language the agent answers in. description counts for less, and an intent with no examples matches poorly. **Turns that match nothing** are recorded as taxonomy candidates you can review and promote, and, only if unknown_action is fallback, answered with your agent's existing out-of-scope reply. Leave it on record until the taxonomy covers your traffic; fallback on a partial taxonomy makes the agent decline most of what it is asked. **threshold is per agent and worth tuning.** Omit it for the platform default of 0.35, which is deliberately conservative and is measurably strict on speech carrying a lot of filler: a clean in-scope ask scores 0.76 to 0.83 against a five-intent taxonomy, but the same asks spoken with ordinary greetings and thanks measure 0.19 to 0.30 and are recorded as unknown. Tune it from your own GET /agents/{name}/intent-candidates feed, whose tuning ladder says what each lower cut would have caught in your traffic; lowering it buys recall and costs precision, so move one rung at a time. Setting enabled: true requires the intent-recognition capability on your plan. A stored taxonomy with enabled: false costs nothing and is never matched.

Параметры

Имя Место Тип Обязательно Описание
name path string Да The agent.

Тело запроса

application/json Схема: IntentTaxonomyRequest

Поле Тип Обязательно Описание
enabled boolean Да
items array of IntentWire Да
threshold number
unknown_action string

Ответы

Код Описание
200 Success.
400 An action outside answer_from_kb/flow/tool/escalate_to_human/transfer, a flow or tool action with no target, a duplicate name, a threshold outside 0-1, or an off-vocabulary unknown_action (invalid_intents).
401 Missing or invalid API key.
402 enabled: true but your plan does not include intent recognition (feature_not_entitled).
404 No agent by that name (agent_not_found).
422 The body is not valid JSON for this shape (invalid_request).
4XX Request error (validation, not-found, etc.).
5XX Server or upstream error.

Пример запроса

curl -X PUT "https://api.voiceland.ai/v1/agents/{name}/intents" \
  -H "Authorization: Bearer VL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "enabled": true,
  "items": [
    {
      "action": "answer_from_kb",
      "description": "Questions about an invoice or a charge.",
      "examples": [
        "Why was I charged twice",
        "Θέλω να δω το τιμολόγιό μου"
      ],
      "name": "billing_invoice"
    },
    {
      "action": "escalate_to_human",
      "examples": [
        "Let me speak to a person",
        "Θέλω να μιλήσω με εκπρόσωπο"
      ],
      "name": "speak_to_human"
    }
  ],
  "threshold": 0.35,
  "unknown_action": "record"
}'

Успешный ответ возвращает IntentTaxonomyResponse.

Пример ответа

{
  "agent": "front-desk",
  "enabled": true,
  "items": [
    {
      "action": "answer_from_kb",
      "name": "billing_invoice"
    }
  ],
  "threshold": 0.35,
  "threshold_source": "agent",
  "unknown_action": "record"
}

Схемы#

Error#

Error envelope returned for non-2xx responses.

Поле Тип Обязательно Описание
error object Да

IntentCandidateWire#

Поле Тип Обязательно Описание
count integer Да
first_seen string
hash string Да
last_call_id string
last_seen string
nearest_intent string
nearest_score number
text string Да

IntentCandidatesResponse#

Поле Тип Обязательно Описание
agent string Да
items array of IntentCandidateWire Да
threshold number Да
threshold_source string Да
truncated boolean Да
tuning array of IntentThresholdRung Да

IntentPromoteRequest#

Поле Тип Обязательно Описание
action string
description string
hash string Да
intent string Да
target string

IntentTaxonomyRequest#

Поле Тип Обязательно Описание
enabled boolean Да
items array of IntentWire Да
threshold number
unknown_action string

IntentTaxonomyResponse#

Поле Тип Обязательно Описание
agent string Да
enabled boolean Да
items array of IntentWire Да
threshold number Да
threshold_source string Да
unknown_action string Да

IntentThresholdRung#

Поле Тип Обязательно Описание
candidates integer Да
threshold number Да
turns integer Да

IntentWire#

Поле Тип Обязательно Описание
action string Да
description string
examples array of string
name string Да
target string

Консоль

Эти страницы доступны только для чтения. Тестовый звонок, ключи API и актуальный справочник API находятся в консоли, где выполнен вход в ваш аккаунт.

Открыть консоль