Skip to main content

How do I set up Structured (JSON) Summaries with generative AI?

Updated over 4 months ago

Summaries and Summarization

Overview of Structured (JSON) Summaries

Structured (JSON) Summaries are summaries whose output is formatted as valid JSON. They enable easier parsing, integration with third-party systems, and more straightforward data processing than free-form text summaries.

{ 
"CompanyMentioned": "ExampleCorp",
"MentionContext": "Customer mentions CompetitorCorp as a competitor",
"MentionSentiment": "Positive"
}

More details on JSON structured format

When to Use JSON Summaries

• You plan to import the summary data into analytics or reporting tools (e.g., splitting each JSON key into its own column in a spreadsheet).

• You want to ensure a consistent, easily readable (machine-readable) format.

• You need to enforce specific fields or data points in every response.

• You need to extract/cover more than one piece of information from the conversation.

Enabling JSON Output

1 - Enable Force JSON mode in GenAI summary

This setting ensures the output will always appear in a valid JSON structure.

2 - Add instructions to the Summary Request / Prompt

Specify which JSON keys should appear in the response and how values will be filled.

Example

Please output your answer in JSON format with the following keys: CompanyMentioned, MentionContext, MentionSentiment.

When the AI processes a conversation or text according to these instructions, it will respond with something like:

{ 
"CompanyMentioned": "ExampleCorp",
"MentionContext": "Customer mentions CompetitorCorp as a competitor",
"MentionSentiment": "Positive"
}

Structuring the Summary Request / Prompt

You can structure your prompt in multiple ways:

Option 1:

In the summary request, explicitly state the keys and how you want them populated:

Analyze conversation and answer next questions:
- Question #1 ...
- Question #2 ...
- Question #3 ...
Please provide the summary as a JSON object with the following keys: Key-1, Key-2, Key-3

Example:

- Record which competitor’s name the client mentioned. 
- Describe the context in which this competitor is mentioned.
- Determine the sentiment (positive, negative, neutral).
Please provide the answer in JSON format with the keys: CompanyMentioned, MentionContext, MentionSentiment.

Option 2:

Give brief instructions stating all keys in one place. For example:

Analyze conversation and provide the answer in JSON format:
- 'Key-1': Question #1 ...
- 'Key-2': Question #2 ...
- 'Key-3': Question #3 ...
...

Example:

Analyze conversation and provide the answer in JSON format:
- 'CompanyMentioned': Question #1 ...
- 'MentionContext': Question #2 ...
- 'MentionSentiment': Question #3 ...
...

Both options should lead to a stable JSON response:

{ 
"CompanyMentioned": "ExampleCorp",
"MentionContext": "Customer mentions CompetitorCorp as a competitor",
"MentionSentiment": "Positive"
}

Benefits of Structured (JSON) Summaries

Consistency: Every summary follows the same layout, making data extraction predictable.

Column Splitting: Tools can automatically split each key into a separate column for easy reporting and analysis.

Automation: JSON data can feed into automated workflows, business intelligence dashboards, or further AI processing without manual parsing of free-form text.

Real-world examples of Summary Prompts

Competitor Analysis

Analyze the {{ session.type }}.
Analyze the conversation between the agent and the client. The client mentioned a competitor company.

Answer the following questions:
- Record which company the client mentioned. Possible competitor company names: “Medlab”, “MedicalCare”, “GlobalLab”, “World Lab”.
- Describe in what context the client mentioned the competitor’s name. Classify the conversation context.
- Determine the sentiment of the mention (positive/negative/neutral).

The answer should be presented in JSON format with the following keys: “Client Mentioned”, “Conversation Context”, “Mention Sentiment”.

The answer should be as short as possible (maximum 50 words) and in {{ language }}.

Advanced Use Case - NPS or Feedback Analysis

Analyze the NPS of the guest's feedback. The following are the characteristics of the product. The answer is in JSON format with the key values ​​below:
- Guest Emotion: Overwhelm, Captivity, Enchantment, Anger, Tasty, Unsavory.
- Type of message: Idea and reason, Rivalry with a competitor, Number of changes, Threat, Information.
- Product and product: which product or product has a seal. Possible options: Casa, Meat, Fish, Confectionery, Pastries, Gastronomy, Dairy, Frozen food, Vegetables, Coffee/tea, Cooking, Alcohol, Drinks/Juice, Groceries.
- The character of the guy: if the comment is to take revenge on the guy, clarify his character. Possible options: Address account, Measurement account, Store account, Subdivision account.
- Category of problem with the product: Rot, Moldy, Third-party item, Added to the taste, Suspect of spoilage, Packing, Taste and freshness, Protermin, Warehouse of the product.
- Assortment: Every day specific product, Request for new product, Incorrectness of surpluses, Small assortment.
- Promotions and prices: High prices, Few promotions, No promotion, Daily promotional item, Price tags, Price tags, Markdown, Insufficient discount.
- Store quality: Smell, Navigation, Parking, Cleanliness, Mosquitoes/rodents, No refrigerators, No cash, Little CSR, Chests, Baskets/carts, Secured passages, Sanitation.

If none of the suggested options fit, propose an answer yourself.

Did this answer your question?