Function:
def search_data(table_name: str, columns: List[str]):
    """
    Gets the specified columns from the given table name. All tables return information about all stocks; please use apply_computation with the `filter` argument to get specific stock information.

    Parameters:
    - table_name (str): A table to search. Available tables: stocks, stock_prices, financial_metrics.
    - columns (List[str]): A list of columns corresponding to keywords in the user query. Available columns for each table:
        - stocks: name [The full name of the stock], symbol [The stock symbol], sector [The sector of the stock]
        - stock_prices: symbol [The symbol associated with the stock], date [The date of the stock price], price [The price of the stock], volume [The volume of the stock]
        - financial_metrics: date [The date of the financial metrics], symbol [The stock symbol], market_cap [The market capitalization of the stock], pe_ratio [The price-to-earnings ratio of the stock], dividend_yield [The dividend yield of the stock], eps [The earnings per share of the stock], revenue [The revenue of the stock], net_income [The net income of the stock].
    """

Function:
def moving_average(data_handle: int, column: str, window: int):
    """
    Calculates the moving average for a specified column.

    Parameters:
    - data_handle (int): An integer representing a handle to the input data.
    - column (str): The column from the data handle to apply the computation to.
    - window (int): The window size for the computation.
    """

Function:
def percentage_change(data_handle: int, column: str):
    """
    Computes the percentage change between consecutive values in a column.

    Parameters:
    - data_handle (int): An integer representing a handle to the input data.
    - column (str): The column from the data handle to apply the computation to.
    """

Function:
def rolling_volatility(data_handle: int, column: str, window: int):
    """
    Computes the rolling standard deviation for a specified column.

    Parameters:
    - data_handle (int): An integer representing a handle to the input data.
    - column (str): The column from the data handle to apply the computation to.
    - window (int): The window size for the computation.
    """

Function:
def cumulative_return(data_handle: int, column: str):
    """
    Calculates the cumulative return based on the values in a specified column.

    Parameters:
    - data_handle (int): An integer representing a handle to the input data.
    - column (str): The column from the data handle to apply the computation to.
    """

Function:
def sort_data(data_handle: int, column: str, ascending: bool):
    """
    Sorts the data by the value of a particular column.

    Parameters:
    - data_handle (int): An integer representing a handle to the input data.
    - column (str): The column from the data handle to apply the computation to.
    - ascending (bool): Whether to sort in ascending order (True) or descending order (False).
    """

Function:
def truncate_data(data_handle: int, num_rows: int):
    """
    Truncates the data to the specified number of rows, taking the top rows.

    Parameters:
    - data_handle (int): An integer representing a handle to the input data.
    - num_rows (int): The number of rows to display.
    """

Function:
def display_chart(data_handle: int, chart_type: str, parameters: Dict[str, str]):
    """
    Creates various types of chart visualizations. This function generates different types of charts or plots using the specified data and parameters.

    Parameters:
    - data_handle (int): An integer representing a handle to the input data table.
    - chart_type (str): The type of chart to create. Available values:
        - 'line'
        - 'bar'
        - 'histogram'
        - 'scatter'
        - 'pie'
        - 'box'
        - 'heatmap'
    - parameters (Dict[str, str]): A dictionary of required parameters for the chosen chart type. Has keys:
        - title (str): The title of the chart.
        - x_column (str): The column to use for the x-axis (required for line, bar, scatter, box, and heatmap charts).
        - y_column (str): The column to use for the y-axis (required for line, bar, scatter, box, and heatmap charts).
        - column (str): The column to use for histogram charts.
        - bins (int): The number of bins for histogram charts (optional).
        - values_column (str): The column containing values for pie and heatmap charts.
        - labels_column (str): The column containing labels for pie charts.
    """

Function:
def display_table(data_handle: int, parameters: Dict[str, str]):
    """
    Displays data in a tabular format. This function generates a table view of the specified data.

    Parameters:
    - data_handle (int): An integer representing a handle to the input data table.
    - parameters (Dict[str, str]): A dictionary of required and optional parameters for the table display. Has keys:
        - caption (str): The caption for the table.
        - column_ids (List[str]): A list of column names to include in the table.
        - limit (int): The maximum number of rows to display in the table.
        - order_by (str): The column to use for sorting the table.
        - ascending (bool): Whether to sort in ascending order (True) or descending order (False).
    """

Function:
def apply_filter(data_handle: int, column: str, value: str, operand: str):
    """
    Applies a filtering operation on the specified column of the provided data handle and generates a new data handle. This function allows you to filter data based on various comparison operations.

    Parameters:
    - data_handle (int): The identifier of the data handle to operate on. This should be a valid handle obtained from a previous operation or data loading function.
    - column (str): The name of the column within the data handle to apply the filter on. The column name should exist in the data handle.
    - value (str): The value to filter by. This will be compared against the values in the specified column. For date filtering, use the format 'YYYY-MM-DD'.
    - operand (str): The comparison operation to use for filtering. 'regex' will provide a wildcard value in value and use this to filter using wildcard expressions/regex. Available values:
        - 'less_than'
        - 'greater_than'
        - 'equals'
        - 'not_equals'
        - 'regex'
    """

Instruction: Current Date: 2024-09-04 (YYYY-MM-DD)
- Use the search_data function to retrieve the necessary data, storing the result in a pointer to the data table handle.
- Determine if any computations are needed based on the query intent.
- Sometimes, you might need to pull more data using search_data once you hit a point where you need more data in the middle of the process.
- For transforming the pulled data, use the various computation functions passing the data table pointer.
- Continue applying operations and printing samples until the correct format is achieved.
- Generate the visualization using the chosen function. You might need to visualize multiple times.
- always issue as many calls as you can to fully answer the user query
- search_data returns information about all stocks, please use apply_filter to get the required stock symbol
- always finish up using a visualization function for a table or chart
- The first data handle starts as handle 0, increasing by 1. Each operation (except for display_chart and display_table) creates a new data handle that can be used for subsequent operations.

Current Turn:
User Query: apple stock last month <human_end>

Call: