abacusai.api_class.segments =========================== .. py:module:: abacusai.api_class.segments Attributes ---------- .. autoapisummary:: abacusai.api_class.segments.Segment Classes ------- .. autoapisummary:: abacusai.api_class.segments.ResponseSection abacusai.api_class.segments.AgentFlowButtonResponseSection abacusai.api_class.segments.ImageUrlResponseSection abacusai.api_class.segments.TextResponseSection abacusai.api_class.segments.RuntimeSchemaResponseSection abacusai.api_class.segments.CodeResponseSection abacusai.api_class.segments.Base64ImageResponseSection abacusai.api_class.segments.CollapseResponseSection abacusai.api_class.segments.ListResponseSection abacusai.api_class.segments.ChartResponseSection abacusai.api_class.segments.DataframeResponseSection Module Contents --------------- .. py:class:: ResponseSection Bases: :py:obj:`abacusai.api_class.abstract.ApiClass` A response section that an agent can return to render specific UI elements. :param type: The type of the response. :type type: ResponseSectionType :param id: The section key of the segment. :type id: str .. py:attribute:: type :type: abacusai.api_class.enums.ResponseSectionType .. py:attribute:: id :type: str .. py:method:: __post_init__() .. py:method:: to_dict() Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary. .. py:data:: Segment .. py:class:: AgentFlowButtonResponseSection(label, agent_workflow_node_name, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an AI Agent can return to render a button. :param label: The label of the button. :type label: str :param agent_workflow_node_name: The workflow start node to be executed when the button is clicked. :type agent_workflow_node_name: str .. py:attribute:: label :type: str .. py:attribute:: agent_workflow_node_name :type: str .. py:class:: ImageUrlResponseSection(url, height, width, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an agent can return to render an image. :param url: The url of the image to be displayed. :type url: str :param height: The height of the image. :type height: int :param width: The width of the image. :type width: int .. py:attribute:: url :type: str .. py:attribute:: height :type: int .. py:attribute:: width :type: int .. py:class:: TextResponseSection(text, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an agent can return to render text. :param segment: The text to be displayed. :type segment: str .. py:attribute:: segment :type: str .. py:class:: RuntimeSchemaResponseSection(json_schema, ui_schema = None, schema_prop = None) Bases: :py:obj:`ResponseSection` A segment that an agent can return to render json and ui schema in react-jsonschema-form format for workflow nodes. This is primarily used to generate dynamic forms at runtime. If a node returns a runtime schema variable, the UI will render the form upon node execution. :param json_schema: json schema in RJSF format. :type json_schema: dict :param ui_schema: ui schema in RJSF format. :type ui_schema: dict .. py:attribute:: json_schema :type: dict .. py:attribute:: ui_schema :type: dict .. py:class:: CodeResponseSection(code, language, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an agent can return to render code. :param code: The code to be displayed. :type code: str :param language: The language of the code. :type language: CodeLanguage .. py:attribute:: code :type: str .. py:attribute:: language :type: abacusai.api_class.enums.CodeLanguage .. py:class:: Base64ImageResponseSection(b64_image, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an agent can return to render a base64 image. :param b64_image: The base64 image to be displayed. :type b64_image: str .. py:attribute:: b64_image :type: str .. py:class:: CollapseResponseSection(title, content, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an agent can return to render a collapsible component. :param title: The title of the collapsible component. :type title: str :param content: The response section constituting the content of collapsible component :type content: ResponseSection .. py:attribute:: title :type: str .. py:attribute:: content :type: ResponseSection .. py:method:: to_dict() Standardizes converting an ApiClass to dictionary. Keys of response dictionary are converted to camel case. This also validates the fields ( type, value, etc ) received in the dictionary. .. py:class:: ListResponseSection(items, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an agent can return to render a list. :param items: The list items to be displayed. :type items: List[str] .. py:attribute:: items :type: List[str] .. py:class:: ChartResponseSection(chart, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an agent can return to render a chart. :param chart: The chart to be displayed. :type chart: dict .. py:attribute:: chart :type: dict .. py:class:: DataframeResponseSection(df, header = None, section_key = None) Bases: :py:obj:`ResponseSection` A response section that an agent can return to render a pandas dataframe. :param df: The dataframe to be displayed. :type df: pandas.DataFrame :param header: Heading of the table to be displayed. :type header: str .. py:attribute:: df :type: Any .. py:attribute:: header :type: str