Vapi · Schema

StructuredDataPlan

AIVoiceAgentsRealtimeCPaaS

Properties

Name Type Description
messages array These are the messages used to generate the structured data. @default: ``` [ { "role": "system", "content": "You are an expert data extractor. You will be given a transcript of a call. Extract structu
enabled boolean This determines whether structured data is generated and stored in `call.analysis.structuredData`. Defaults to false. Usage: - If you want to extract structured data, set this to true and provide a `s
schema object This is the schema of the structured data. The output is stored in `call.analysis.structuredData`. Complete guide on JSON Schema can be found [here](https://ajv.js.org/json-schema.html#json-data-type)
timeoutSeconds number This is how long the request is tried before giving up. When request times out, `call.analysis.structuredData` will be empty. Usage: - To guarantee the structured data is generated, set this value hig
View JSON Schema on GitHub

JSON Schema

vapi-structureddataplan-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/StructuredDataPlan",
  "title": "StructuredDataPlan",
  "type": "object",
  "properties": {
    "messages": {
      "description": "These are the messages used to generate the structured data.\n\n@default: ```\n[\n  {\n    \"role\": \"system\",\n    \"content\": \"You are an expert data extractor. You will be given a transcript of a call. Extract structured data per the JSON Schema. DO NOT return anything except the structured data.\\n\\nJson Schema:\\\\n{{schema}}\\n\\nOnly respond with the JSON.\"\n  },\n  {\n    \"role\": \"user\",\n    \"content\": \"Here is the transcript:\\n\\n{{transcript}}\\n\\n. Here is the ended reason of the call:\\n\\n{{endedReason}}\\n\\n\"\n  }\n]```\n\nYou can customize by providing any messages you want.\n\nHere are the template variables available:\n- {{transcript}}: the transcript of the call from `call.artifact.transcript`- {{systemPrompt}}: the system prompt of the call from `assistant.model.messages[type=system].content`- {{messages}}: the messages of the call from `assistant.model.messages`- {{schema}}: the schema of the structured data from `structuredDataPlan.schema`- {{endedReason}}: the ended reason of the call from `call.endedReason`",
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "enabled": {
      "type": "boolean",
      "description": "This determines whether structured data is generated and stored in `call.analysis.structuredData`. Defaults to false.\n\nUsage:\n- If you want to extract structured data, set this to true and provide a `schema`.\n\n@default false"
    },
    "schema": {
      "description": "This is the schema of the structured data. The output is stored in `call.analysis.structuredData`.\n\nComplete guide on JSON Schema can be found [here](https://ajv.js.org/json-schema.html#json-data-type).",
      "allOf": [
        {
          "$ref": "#/components/schemas/JsonSchema"
        }
      ]
    },
    "timeoutSeconds": {
      "type": "number",
      "description": "This is how long the request is tried before giving up. When request times out, `call.analysis.structuredData` will be empty.\n\nUsage:\n- To guarantee the structured data is generated, set this value high. Note, this will delay the end of call report in cases where model is slow to respond.\n\n@default 5 seconds",
      "minimum": 1,
      "maximum": 60
    }
  }
}