Generate your Summary
Explains how to create summary reports or narratives from the insights.
Set OpenAI API Key
To generate a summary of topics or analysis you need to set OpenAI API Key.
You can set the OpenAI API key as given below:
Summary Generation won't work without setting up the OpenAI API Key.
Get Summary
The get_summary
method is designed to allows users to obtain a summarized overview of either a specific set of topics or of generated insights within an analysis, all with the flexibility to customize the level of verbosity and the intended personality in the output. Whether you're working with a complex analysis or a collection of topics, this function simplifies the process of extracting key takeaways.
User can even provide a custom prompt to OpenAI to generate a customized summary of their own.
Method Signature:
on
list/str
Analysis Name/Topics that are to be used to create a summary. This is the most important parameter of the function.
Analysis Name Accepted Values : "descriptor","change","trend", "compare_measure",compare_dimension,
"target","budget"
It should be passed as a string.
focus_on_value
list/str
Narrow down the analysis to a specific value/values within the chosen dimension. Enables you to target a particular data point.
For Example, If dimension is set as "Region", specifying focus_on_value
as "South" will direct the function to specifically analyze and summarize feedback related to South Region.
It can be either a string or list of values.
It is an optional parameter.
compare_value_1
str
Used to contrast or compare against the value provided in compare_value_2
.
To be used with compare_dimension analysis and topics like compare_by_contribution, compare_by_performance and compare_by_rank.
Should be kept blank for other analyses and topics.
compare_value_2
str
Used to contrast or compare against the value provided in compare_value_1
.
To be used with compare_dimension analysis and topics like compare_by_contribution, compare_by_performance and compare_by_rank.
Should be kept blank for other analyses and topics.
personality
str
Allows you to define a specific personality or audience for whom the generated summaries are tailored. By specifying a personality, you can adapt the tone, style, and content of the output to match the preferences and needs of the intended audience. Some examples of personality can be "Product Manager", "Marketing Manager","Sales Manager". It is an optional parameter.
verbosity
str
Provides control over the level of detail in the generated summaries. You can adjust this parameter to choose between concise, high-level summaries or more detailed, comprehensive summaries, depending on your requirements.
Default: low
Accepted Values: low,medium,high
It is an optional parameter.
custom_prompt
str
Allows you to provide a custom instruction or prompt to guide the summary generation process which is sent to OpenAI. It is an optional parameter.
Output Response
sections
list
Contains multiple dictionaries for each metric that is passed.
summary
str
Summary for the analysis/topics that is selected.
name
str
Name of the metric for which the summary is generated.
time_taken
float
Time taken for generation(in seconds).
Examples
Summary by Analysis
In the snippet given below, a basic code block has been added to generate a summary for Change analysis.
Similarly we can add a focus_on_value parameter in the get_summary function call to get summary on a specified data point.
Summary by Topics
In the snippet given below, a basic code block has been added to generate a summary for topics of Descriptor analysis.
Similarly for topics that are selected for Compare Analysis we can pass which values should be compared. Lets say we want to compare Sales of East and West Region then code would look something like:
Last updated