Structured Data Generation
# support
d
I was wondering if Structured Data can be generated during a voice call. If so, how can we enable this?
v
**Structured data extraction in Vapi is performed after a voice call completes**—not in real time during the call. You define a JSON Schema, link it to your assistant, and Vapi extracts the data from the conversation once the call ends, storing it as a call artifact for later retrieval ([documentation](https://docs.vapi.ai/assistants/structured-outputs)). To better assist you, could you clarify if you specifically need real-time (during-call) structured data extraction, or is post-call extraction sufficient for your use case? Source: - [Structured outputs documentation](https://docs.vapi.ai/assistants/structured-outputs)
d
i need to real-time (during-call) structured data extraction
v
Message marked as helpful by @Devin! 🎉
d
i need real-time (during-call) structured data extraction
g
Yes structured data can be extracted during the voice call.
v
Message marked as helpful by @G - One! 🎉
c
Hi Devin, If you're looking to create structured outputs using our API, you can follow a few key steps: 1. **Define your JSON Schema**: Create a schema outlining the data you need to extract. JSON Schema allows you to specify types, constraints, and required fields. 2. **Select a Model**: Choose the AI model for data extraction, such as OpenAI, Anthropic, or Google. You can define this in your schema under the
model
property. 3. **Create Structured Output**: Use a POST request to
https://api.vapi.ai/structured-output
with a JSON payload containing the
name
,
schema
,
description
, and other configurable settings. Here is an example:
Copy code
json
   {
     "name": "Customer Info",
     "schema": {
       "type": "object",
       "properties": {
         "firstName": {"type": "string"},
         "lastName": {"type": "string"},
         "email": {"type": "string"},
         "phone": {"type": "string"}
       }
     },
     "model": {
       "provider": "openai",
       "model": "gpt-4-turbo"
     }
   }
See the [Create Structured Output](https://docs.vapi.ai/api-reference/structured-outputs/structured-output-controller-create) documentation for detailed guidance. For examples, consider checking out the [structured outputs examples](https://docs.vapi.ai/assistants/structured-outputs-examples) documentation, which provides common scenarios and integration code. Let me know if you need further assistance.
g
@Devin You might not be getting an answer to this, structured data is meant for end-of-call report..
c
Which fields or variables are you looking to extract during the call?
d
@Devin Can't you do this by just defining a Custom Tool?
c
Thanks for getting back to us and updating us We’ll share an update as soon as more information becomes available. We appreciate your understanding and patience as we continue our investigation.
4 Views