APIs
generate_report

generate_report Function

Summary:

The generate_report function collects visualized data from Python cells on the Morph platform and generates an aggregated report. The function specifically requests the results of cells to which the visualization decorator @visualize has been applied and aggregates them into a single report.

Parameters:

  • refs (list[RefResponse]): list of Python cells to reference.
  • prompt (Optional[str]): additional prompt or description to be used to generate the report.
  • language (Optional[str]): language used to generate the report.

Response:

  • str: content of the generated report, provided in Markdown format.

Usage example:

from typing import Dict
import pandas as pd
import plotly.express as px
from morphdb_utils.annotations import report
from morphdb_utils.api import ref, generate_report
 
# The `data` is not used for reporting, but needs to be declared to execute the main function.
data = {}
 
@report
def main(data: Dict[str, pd.DataFrame]):
    return generate_report(
        refs=[
            ref("python_60096"),
        ],
        prompt="write reports for sales meeting in details according to the data",  # please fill in the prompt for the report
        language="English"
    )

This function works particularly well in situations where data analysis and visualisations are heavily used. It can automatically generate comprehensive reports combining several visualizations.

generate